mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Add new MacOSX 10.4 files used by simple web kit.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25840 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
83fbeb17f2
commit
4976d1e4dc
9 changed files with 871 additions and 0 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2008-01-03 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSTextList.h,
|
||||
* Headers/AppKit/NSTextTable.h: New files.
|
||||
* Headers/AppKit/AppKit.h: Add these.
|
||||
* Source/NSTextList.m,
|
||||
* Source/NSTextTable.m,
|
||||
* Source/NSTextBlock.m,
|
||||
* Source/NSTextTableBlock.m: New files
|
||||
* Source/GNUmakefile: Add new source file.
|
||||
|
||||
2008-01-01 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Version 0.13.1
|
||||
|
|
|
@ -164,7 +164,9 @@
|
|||
#include <AppKit/NSTabViewItem.h>
|
||||
#include <AppKit/NSTextAttachment.h>
|
||||
#include <AppKit/NSTextContainer.h>
|
||||
#include <AppKit/NSTextList.h>
|
||||
#include <AppKit/NSTextStorage.h>
|
||||
#include <AppKit/NSTextTable.h>
|
||||
#include <AppKit/NSTextView.h>
|
||||
#include <AppKit/NSToolbar.h>
|
||||
#include <AppKit/NSToolbarItem.h>
|
||||
|
|
57
Headers/AppKit/NSTextList.h
Normal file
57
Headers/AppKit/NSTextList.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
/* -*-objc-*-
|
||||
NSTextList.h
|
||||
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: January 2008
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNUstep_H_NSTextList
|
||||
#define _GNUstep_H_NSTextList
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class NSString;
|
||||
|
||||
enum {
|
||||
NSTextListPrependEnclosingMarker = 1
|
||||
};
|
||||
|
||||
@interface NSTextList : NSObject <NSCopying, NSCoding>
|
||||
{
|
||||
NSString *_markerFormat;
|
||||
unsigned int _listOptions;
|
||||
}
|
||||
|
||||
- (id) initWithMarkerFormat: (NSString *)format
|
||||
options: (unsigned int)mask;
|
||||
- (unsigned int) listOptions;
|
||||
- (NSString *) markerForItemNumber: (int)item;
|
||||
- (NSString *) markerFormat;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _GNUstep_H_NSTextList
|
190
Headers/AppKit/NSTextTable.h
Normal file
190
Headers/AppKit/NSTextTable.h
Normal file
|
@ -0,0 +1,190 @@
|
|||
/* -*-objc-*-
|
||||
NSTextTable.h
|
||||
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: January 2008
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNUstep_H_NSTextTable
|
||||
#define _GNUstep_H_NSTextTable
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
|
||||
@class NSColor;
|
||||
@class NSTextContainer;
|
||||
@class NSView;
|
||||
@class NSLayoutManager;
|
||||
@class NSTextTableBlock;
|
||||
|
||||
typedef enum _NSTextBlockValueType
|
||||
{
|
||||
NSTextBlockAbsoluteValueType,
|
||||
NSTextBlockPercentageValueType
|
||||
} NSTextBlockValueType;
|
||||
|
||||
typedef enum _NSTextBlockDimension
|
||||
{
|
||||
NSTextBlockWidth,
|
||||
NSTextBlockMinimumWidth,
|
||||
NSTextBlockMaximumWidth,
|
||||
NSTextBlockHeight,
|
||||
NSTextBlockMinimumHeight,
|
||||
NSTextBlockMaximumHeight
|
||||
} NSTextBlockDimension;
|
||||
|
||||
typedef enum _NSTextBlockLayer
|
||||
{
|
||||
NSTextBlockPadding,
|
||||
NSTextBlockBorder,
|
||||
NSTextBlockMargin
|
||||
} NSTextBlockLayer;
|
||||
|
||||
typedef enum _NSTextBlockVerticalAlignment
|
||||
{
|
||||
NSTextBlockTopAlignment,
|
||||
NSTextBlockMiddleAlignment,
|
||||
NSTextBlockBottomAlignment,
|
||||
NSTextBlockBaselineAlignment
|
||||
} NSTextBlockVerticalAlignment;
|
||||
|
||||
@interface NSTextBlock : NSObject <NSCoding, NSCopying>
|
||||
{
|
||||
NSColor *_backgroundColor;
|
||||
NSColor *_borderColorForEdge[NSMaxYEdge + 1];
|
||||
NSTextBlockVerticalAlignment _verticalAlignment;
|
||||
// The following ivars come in pairs
|
||||
float _contentWidth;
|
||||
NSTextBlockValueType _contentWidthValueType;
|
||||
float _value[NSTextBlockMaximumHeight + 1];
|
||||
NSTextBlockValueType _valueType[NSTextBlockMaximumHeight + 1];
|
||||
float _width[NSTextBlockMargin + 1][NSMaxYEdge + 1];
|
||||
NSTextBlockValueType _widthType[NSTextBlockMargin + 1][NSMaxYEdge + 1];
|
||||
}
|
||||
|
||||
- (NSColor *) backgroundColor;
|
||||
- (NSColor *) borderColorForEdge: (NSRectEdge)edge;
|
||||
- (NSRect) boundsRectForContentRect: (NSRect)cont
|
||||
inRect: (NSRect)rect
|
||||
textContainer: (NSTextContainer *)container
|
||||
characterRange: (NSRange)range;
|
||||
- (float) contentWidth;
|
||||
- (NSTextBlockValueType) contentWidthValueType;
|
||||
- (void) drawBackgroundWithFrame: (NSRect)rect
|
||||
inView: (NSView *)view
|
||||
characterRange: (NSRange)range
|
||||
layoutManager: (NSLayoutManager *)lm;
|
||||
- (id) init;
|
||||
- (NSRect) rectForLayoutAtPoint: (NSPoint)point
|
||||
inRect: (NSRect)rect
|
||||
textContainer: (NSTextContainer *)cont
|
||||
characterRange: (NSRange)range;
|
||||
- (void) setBackgroundColor: (NSColor *)color;
|
||||
- (void) setBorderColor: (NSColor *)color;
|
||||
- (void) setBorderColor: (NSColor *)color forEdge: (NSRectEdge)edge;
|
||||
- (void) setContentWidth: (float)val type: (NSTextBlockValueType)type;
|
||||
- (void) setValue: (float)val
|
||||
type: (NSTextBlockValueType)type
|
||||
forDimension: (NSTextBlockDimension)dimension;
|
||||
- (void) setVerticalAlignment: (NSTextBlockVerticalAlignment)alignment;
|
||||
- (void) setWidth: (float)val
|
||||
type: (NSTextBlockValueType)type
|
||||
forLayer: (NSTextBlockLayer)layer;
|
||||
- (void) setWidth: (float)val
|
||||
type: (NSTextBlockValueType)type
|
||||
forLayer: (NSTextBlockLayer)layer
|
||||
edge: (NSRectEdge)edge;
|
||||
- (float) valueForDimension: (NSTextBlockDimension)dimension;
|
||||
- (NSTextBlockValueType) valueTypeForDimension: (NSTextBlockDimension)dimension;
|
||||
- (NSTextBlockVerticalAlignment) verticalAlignment;
|
||||
- (float) widthForLayer: (NSTextBlockLayer)layer edge: (NSRectEdge)edge;
|
||||
- (NSTextBlockValueType) widthValueTypeForLayer: (NSTextBlockLayer)layer
|
||||
edge: (NSRectEdge)edge;
|
||||
@end
|
||||
|
||||
typedef enum _NSTextTableLayoutAlgorithm {
|
||||
NSTextTableAutomaticLayoutAlgorithm,
|
||||
NSTextTableFixedLayoutAlgorithm
|
||||
} NSTextTableLayoutAlgorithm;
|
||||
|
||||
@interface NSTextTable : NSTextBlock
|
||||
{
|
||||
NSTextTableLayoutAlgorithm _layoutAlgorithm;
|
||||
unsigned int _numberOfColumns;
|
||||
BOOL _collapsesBorders;
|
||||
BOOL _hidesEmptyCells;
|
||||
}
|
||||
|
||||
- (NSRect) boundsRectForBlock: (NSTextTableBlock *)block
|
||||
contentRect: (NSRect)content
|
||||
inRect: (NSRect)rect
|
||||
textContainer: (NSTextContainer *)container
|
||||
characterRange: (NSRange)range;
|
||||
- (BOOL) collapsesBorders;
|
||||
- (void) drawBackgroundForBlock: (NSTextTableBlock *)block
|
||||
withFrame: (NSRect)frame
|
||||
inView: (NSView *)controlView
|
||||
characterRange: (NSRange)range
|
||||
layoutManager: (NSLayoutManager *)manager;
|
||||
- (BOOL) hidesEmptyCells;
|
||||
- (NSTextTableLayoutAlgorithm) layoutAlgorithm;
|
||||
- (unsigned int) numberOfColumns;
|
||||
- (NSRect) rectForBlock: (NSTextTableBlock *)block
|
||||
layoutAtPoint: (NSPoint)start
|
||||
inRect: (NSRect)rect
|
||||
textContainer: (NSTextContainer *)container
|
||||
characterRange: (NSRange)range;
|
||||
- (void) setCollapsesBorders: (BOOL)flag;
|
||||
- (void) setHidesEmptyCells: (BOOL)flag;
|
||||
- (void) setLayoutAlgorithm: (NSTextTableLayoutAlgorithm)algorithm;
|
||||
- (void) setNumberOfColumns: (unsigned int)numCols;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSTextTableBlock : NSTextBlock
|
||||
{
|
||||
NSTextTable *_table;
|
||||
int _row;
|
||||
int _rowSpan;
|
||||
int _col;
|
||||
int _colSpan;
|
||||
}
|
||||
|
||||
- (id) initWithTable: (NSTextTable *)table
|
||||
startingRow: (int)row
|
||||
rowSpan: (int)rspan
|
||||
startingColumn: (int)col
|
||||
columnSpan: (int)cspan;
|
||||
- (int) columnSpan;
|
||||
- (int) rowSpan;
|
||||
- (int) startingColumn;
|
||||
- (int) startingRow;
|
||||
- (NSTextTable *) table;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _GNUstep_H_NSTextTable
|
|
@ -162,10 +162,14 @@ NSTableHeaderCell.m \
|
|||
NSTableView.m \
|
||||
NSText.m \
|
||||
NSTextAttachment.m \
|
||||
NSTextBlock.m \
|
||||
NSTextContainer.m \
|
||||
NSTextField.m \
|
||||
NSTextFieldCell.m \
|
||||
NSTextList.m \
|
||||
NSTextStorage.m \
|
||||
NSTextTable.m \
|
||||
NSTextTableBlock.m \
|
||||
NSToolbar.m \
|
||||
NSToolbarItem.m \
|
||||
NSUserDefaultsController.m \
|
||||
|
@ -349,7 +353,9 @@ NSTextAttachment.h \
|
|||
NSTextContainer.h \
|
||||
NSTextField.h \
|
||||
NSTextFieldCell.h \
|
||||
NSTextList.h \
|
||||
NSTextStorage.h \
|
||||
NSTextTable.h \
|
||||
NSTextView.h \
|
||||
NSToolbar.h \
|
||||
NSToolbarItem.h \
|
||||
|
|
220
Source/NSTextBlock.m
Normal file
220
Source/NSTextBlock.m
Normal file
|
@ -0,0 +1,220 @@
|
|||
/* NSTextBlock.m
|
||||
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Author: H. Nikolaus Schaller
|
||||
Date: 2007
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: January 2008
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
||||
#include "AppKit/NSTextTable.h"
|
||||
|
||||
@implementation NSTextBlock
|
||||
|
||||
- (id) init
|
||||
{
|
||||
// FIXME
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_backgroundColor);
|
||||
RELEASE(_borderColorForEdge[NSMinXEdge]);
|
||||
RELEASE(_borderColorForEdge[NSMinYEdge]);
|
||||
RELEASE(_borderColorForEdge[NSMaxXEdge]);
|
||||
RELEASE(_borderColorForEdge[NSMaxYEdge]);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSColor *) backgroundColor
|
||||
{
|
||||
return _backgroundColor;
|
||||
}
|
||||
|
||||
- (void) setBackgroundColor: (NSColor *)color
|
||||
{
|
||||
ASSIGN(_backgroundColor, color);
|
||||
}
|
||||
|
||||
- (NSColor *) borderColorForEdge: (NSRectEdge)edge
|
||||
{
|
||||
return _borderColorForEdge[edge];
|
||||
}
|
||||
|
||||
- (void) setBorderColor: (NSColor *)color forEdge: (NSRectEdge)edge
|
||||
{
|
||||
ASSIGN(_borderColorForEdge[edge], color);
|
||||
}
|
||||
|
||||
- (void) setBorderColor: (NSColor *)color
|
||||
{
|
||||
ASSIGN(_borderColorForEdge[NSMinXEdge], color);
|
||||
ASSIGN(_borderColorForEdge[NSMinYEdge], color);
|
||||
ASSIGN(_borderColorForEdge[NSMaxXEdge], color);
|
||||
ASSIGN(_borderColorForEdge[NSMaxYEdge], color);
|
||||
}
|
||||
|
||||
- (float) contentWidth
|
||||
{
|
||||
return _contentWidth;
|
||||
}
|
||||
|
||||
- (NSTextBlockValueType) contentWidthValueType
|
||||
{
|
||||
return _contentWidthValueType;
|
||||
}
|
||||
|
||||
- (void) setContentWidth: (float)val type: (NSTextBlockValueType)type
|
||||
{
|
||||
_contentWidth = val;
|
||||
_contentWidthValueType = type;
|
||||
}
|
||||
|
||||
- (NSTextBlockVerticalAlignment) verticalAlignment
|
||||
{
|
||||
return _verticalAlignment;
|
||||
}
|
||||
|
||||
- (void) setVerticalAlignment: (NSTextBlockVerticalAlignment)alignment
|
||||
{
|
||||
_verticalAlignment = alignment;
|
||||
}
|
||||
|
||||
- (float) valueForDimension: (NSTextBlockDimension)dimension
|
||||
{
|
||||
return _value[dimension];
|
||||
}
|
||||
|
||||
- (NSTextBlockValueType) valueTypeForDimension: (NSTextBlockDimension)dimension
|
||||
{
|
||||
return _valueType[dimension];
|
||||
}
|
||||
|
||||
- (void) setValue: (float)val
|
||||
type: (NSTextBlockValueType)type
|
||||
forDimension: (NSTextBlockDimension)dimension
|
||||
{
|
||||
_value[dimension] = val;
|
||||
_valueType[dimension] = type;
|
||||
}
|
||||
|
||||
- (float) widthForLayer: (NSTextBlockLayer)layer edge: (NSRectEdge)edge
|
||||
{
|
||||
return _width[layer][edge];
|
||||
}
|
||||
|
||||
- (NSTextBlockValueType) widthValueTypeForLayer: (NSTextBlockLayer)layer
|
||||
edge: (NSRectEdge)edge
|
||||
{
|
||||
return _widthType[layer][edge];
|
||||
}
|
||||
|
||||
- (void) setWidth: (float)val
|
||||
type: (NSTextBlockValueType)type
|
||||
forLayer: (NSTextBlockLayer)layer
|
||||
edge: (NSRectEdge)edge
|
||||
{
|
||||
_width[layer][edge] = val;
|
||||
_widthType[layer][edge] = type;
|
||||
}
|
||||
|
||||
- (void) setWidth: (float)val
|
||||
type: (NSTextBlockValueType)type
|
||||
forLayer: (NSTextBlockLayer)layer
|
||||
{
|
||||
_width[layer][NSMinXEdge] = val;
|
||||
_widthType[layer][NSMinXEdge] = type;
|
||||
_width[layer][NSMinYEdge] = val;
|
||||
_widthType[layer][NSMinYEdge] = type;
|
||||
_width[layer][NSMaxXEdge] = val;
|
||||
_widthType[layer][NSMaxXEdge] = type;
|
||||
_width[layer][NSMaxYEdge] = val;
|
||||
_widthType[layer][NSMaxYEdge] = type;
|
||||
}
|
||||
|
||||
- (NSRect) boundsRectForContentRect: (NSRect)cont
|
||||
inRect: (NSRect)rect
|
||||
textContainer: (NSTextContainer *)container
|
||||
characterRange: (NSRange)range
|
||||
{
|
||||
// FIXME
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
- (NSRect) rectForLayoutAtPoint: (NSPoint)point
|
||||
inRect: (NSRect)rect
|
||||
textContainer: (NSTextContainer *)cont
|
||||
characterRange: (NSRange)range
|
||||
{
|
||||
// FIXME
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
- (void) drawBackgroundWithFrame: (NSRect)rect
|
||||
inView: (NSView *)view
|
||||
characterRange: (NSRange)range
|
||||
layoutManager: (NSLayoutManager *)lm
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NSTextBlock *t = (NSTextBlock*)NSCopyObject(self, 0, zone);
|
||||
|
||||
TEST_RETAIN(_backgroundColor);
|
||||
TEST_RETAIN(_borderColorForEdge[NSMinXEdge]);
|
||||
TEST_RETAIN(_borderColorForEdge[NSMinYEdge]);
|
||||
TEST_RETAIN(_borderColorForEdge[NSMaxXEdge]);
|
||||
TEST_RETAIN(_borderColorForEdge[NSMaxYEdge]);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
// FIXME
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
// FIXME
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
185
Source/NSTextList.m
Normal file
185
Source/NSTextList.m
Normal file
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
NSTextList.m
|
||||
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Author: H. Nikolaus Schaller
|
||||
Date: 2007
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: January 2008
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
||||
#include "AppKit/NSTextList.h"
|
||||
|
||||
|
||||
@implementation NSTextList
|
||||
|
||||
- (id) initWithMarkerFormat: (NSString *)format
|
||||
options: (unsigned int)mask
|
||||
{
|
||||
ASSIGN(_markerFormat, format);
|
||||
_listOptions = mask;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc;
|
||||
{
|
||||
RELEASE(_markerFormat);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL) isEqual: (id)anObject
|
||||
{
|
||||
if (anObject == self)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
if (anObject == nil || [anObject isKindOfClass: [NSTextList class]] == NO)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
return ([anObject listOptions] == _listOptions)
|
||||
&& [_markerFormat isEqualToString: [anObject markerFormat]];
|
||||
}
|
||||
|
||||
- (unsigned int) listOptions
|
||||
{
|
||||
return _listOptions;
|
||||
}
|
||||
|
||||
- (NSString *) markerFormat
|
||||
{
|
||||
return _markerFormat;
|
||||
}
|
||||
|
||||
- (NSString *) markerForItemNumber: (int)item
|
||||
{
|
||||
NSMutableString *s = [_markerFormat mutableCopy];
|
||||
unichar box = 0x25A1;
|
||||
unichar check = 0x2713;
|
||||
unichar circle = 0x25E6;
|
||||
unichar diamond = 0x25C6;
|
||||
unichar disc = 0x2022;
|
||||
unichar hyphen = 0x2043;
|
||||
unichar square = 0x25A0;
|
||||
|
||||
// FIXME: Needs optimisation and roman numbers
|
||||
[s replaceOccurrencesOfString: @"{box}"
|
||||
withString: [NSString stringWithCharacters: &box length: 1]
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{check}"
|
||||
withString: [NSString stringWithCharacters: &check length: 1]
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{circle}"
|
||||
withString: [NSString stringWithCharacters: &circle length: 1]
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{diamond}"
|
||||
withString: [NSString stringWithCharacters: &diamond length: 1]
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{disc}"
|
||||
withString: [NSString stringWithCharacters: &disc length: 1]
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{hyphen}"
|
||||
withString: [NSString stringWithCharacters: &hyphen length: 1]
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{square}"
|
||||
withString: [NSString stringWithCharacters: &square length: 1]
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{decimal}"
|
||||
withString: [NSString stringWithFormat: @"%d", item]
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{octal}"
|
||||
withString: [NSString stringWithFormat: @"%o", item]
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{lower-hexadecimal}"
|
||||
withString: [NSString stringWithFormat: @"%x", item]
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{upper-hexadecimal}"
|
||||
withString: [NSString stringWithFormat: @"%X", item]
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{lower-alpha}"
|
||||
withString: [NSString stringWithFormat: @"%c", item + 'a']
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{lower-latin}"
|
||||
withString: [NSString stringWithFormat: @"%c", item + 'a']
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{upper-alpha}"
|
||||
withString: [NSString stringWithFormat: @"%c", item + 'A']
|
||||
options: 0 range: NSMakeRange(0, [s length])];
|
||||
[s replaceOccurrencesOfString: @"{upper-latin}"
|
||||
withString: [NSString stringWithFormat: @"%c", item + 'A']
|
||||
options: 0
|
||||
range: NSMakeRange(0, [s length])];
|
||||
|
||||
return AUTORELEASE(s);
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NSTextList *l = (NSTextList*)NSCopyObject(self, 0, zone);
|
||||
|
||||
TEST_RETAIN(_markerFormat);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
// FIXME
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
// FIXME
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
105
Source/NSTextTable.m
Normal file
105
Source/NSTextTable.m
Normal file
|
@ -0,0 +1,105 @@
|
|||
/* NSTextTable.m
|
||||
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Author: H. Nikolaus Schaller
|
||||
Date: 2007
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: January 2008
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
||||
#include "AppKit/NSTextTable.h"
|
||||
|
||||
@implementation NSTextTable
|
||||
|
||||
- (BOOL) collapsesBorders
|
||||
{
|
||||
return _collapsesBorders;
|
||||
}
|
||||
|
||||
- (void) setCollapsesBorders: (BOOL)flag
|
||||
{
|
||||
_collapsesBorders = flag;
|
||||
}
|
||||
|
||||
- (BOOL) hidesEmptyCells
|
||||
{
|
||||
return _hidesEmptyCells;
|
||||
}
|
||||
|
||||
- (void) setHidesEmptyCells: (BOOL)flag
|
||||
{
|
||||
_hidesEmptyCells = flag;
|
||||
}
|
||||
|
||||
- (NSTextTableLayoutAlgorithm) layoutAlgorithm
|
||||
{
|
||||
return _layoutAlgorithm;
|
||||
}
|
||||
|
||||
- (void) setLayoutAlgorithm: (NSTextTableLayoutAlgorithm)algorithm
|
||||
{
|
||||
_layoutAlgorithm = algorithm;
|
||||
}
|
||||
|
||||
- (unsigned int) numberOfColumns
|
||||
{
|
||||
return _numberOfColumns;
|
||||
}
|
||||
|
||||
- (void) setNumberOfColumns: (unsigned int)numCols
|
||||
{
|
||||
_numberOfColumns = numCols;
|
||||
}
|
||||
|
||||
- (NSRect) boundsRectForBlock: (NSTextTableBlock *)block
|
||||
contentRect: (NSRect)content
|
||||
inRect: (NSRect)rect
|
||||
textContainer: (NSTextContainer *)container
|
||||
characterRange: (NSRange)range
|
||||
{
|
||||
// FIXME
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
- (NSRect) rectForBlock: (NSTextTableBlock *)block
|
||||
layoutAtPoint: (NSPoint)start
|
||||
inRect: (NSRect)rect
|
||||
textContainer: (NSTextContainer *)container
|
||||
characterRange: (NSRange)range
|
||||
{
|
||||
// FIXME
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
- (void) drawBackgroundForBlock: (NSTextTableBlock *)block
|
||||
withFrame: (NSRect)frame
|
||||
inView: (NSView *)controlView
|
||||
characterRange: (NSRange)range
|
||||
layoutManager: (NSLayoutManager *)manager
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
|
||||
@end
|
95
Source/NSTextTableBlock.m
Normal file
95
Source/NSTextTableBlock.m
Normal file
|
@ -0,0 +1,95 @@
|
|||
/* NSTextTableBlock.m
|
||||
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Author: H. Nikolaus Schaller
|
||||
Date: 2007
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: January 2008
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
||||
#include "AppKit/NSTextTable.h"
|
||||
|
||||
@implementation NSTextTableBlock
|
||||
|
||||
- (id) initWithTable: (NSTextTable *)table
|
||||
startingRow: (int)row
|
||||
rowSpan: (int)rspan
|
||||
startingColumn: (int)col
|
||||
columnSpan: (int)cspan;
|
||||
{
|
||||
self = [super init];
|
||||
if (self == nil)
|
||||
return nil;
|
||||
|
||||
ASSIGN(_table, table);
|
||||
_row = row;
|
||||
_rowSpan = rspan;
|
||||
_col = col;
|
||||
_colSpan = cspan;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_table);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (int) columnSpan
|
||||
{
|
||||
return _colSpan;
|
||||
}
|
||||
|
||||
- (int) rowSpan
|
||||
{
|
||||
return _rowSpan;
|
||||
}
|
||||
|
||||
- (int) startingColumn
|
||||
{
|
||||
return _col;
|
||||
}
|
||||
|
||||
- (int) startingRow
|
||||
{
|
||||
return _row;
|
||||
}
|
||||
|
||||
- (NSTextTable *) table
|
||||
{
|
||||
return _table;
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NSTextTableBlock *t = [super copyWithZone: zone];
|
||||
|
||||
TEST_RETAIN(_table);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in a new issue