Add MacOSX 10.3 methods and constants.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25362 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2007-07-28 13:41:18 +00:00
parent 7708759dc2
commit 94a4f0fd3d
4 changed files with 165 additions and 23 deletions

View file

@ -1,3 +1,9 @@
2007-07-28 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSBrowser.h,
* Source/NSBrowser.m: Add MacOSX 10.3 methods and constants.
* Source/externs.m: Define new string constant.
2007-07-27 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSBox.h,

View file

@ -41,6 +41,15 @@
@class NSScroller;
//@class NSBox;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
typedef enum _NSBrowserColumnResizingType
{
NSBrowserNoColumnResizing,
NSBrowserAutoColumnResizing,
NSBrowserUserColumnResizing
} NSBrowserColumnResizingType;
#endif
@interface NSBrowser : NSControl <NSCoding>
{
// Attributes
@ -67,6 +76,7 @@
BOOL _sendsActionOnArrowKeys;
BOOL _acceptsAlphaNumericalKeys;
BOOL _sendsActionOnAlphaNumericalKeys;
BOOL _prefersAllColumnUserResizing;
BOOL _passiveDelegate;
id _browserDelegate;
@ -82,6 +92,8 @@
int _lastColumnLoaded;
int _firstVisibleColumn;
int _lastVisibleColumn;
NSString *_columnsAutosaveName;
NSBrowserColumnResizingType _columnResizing;
}
//
@ -148,6 +160,10 @@
- (void) setMaxVisibleColumns: (int)columnCount;
- (void) setMinColumnWidth: (int)columnWidth;
- (void) setSeparatesColumns: (BOOL)flag;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
- (float) columnWidthForColumnContentWidth: (float)columnContentWidth;
- (float) columnContentWidthForColumnWidth: (float)columnWidth;
#endif
//
// Manipulating Columns
@ -233,6 +249,24 @@
//
- (void) tile;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
//
// Resizing
//
- (NSBrowserColumnResizingType) columnResizingType;
- (void) setColumnResizingType:(NSBrowserColumnResizingType) type;
- (BOOL) prefersAllColumnUserResizing;
- (void) setPrefersAllColumnUserResizing: (BOOL)flag;
- (float) widthOfColumn: (int)column;
- (void) setWidth: (float)columnWidth ofColumn: (int)columnIndex;
//
// Autosave names
//
+ (void) removeSavedColumnsWithAutosaveName: (NSString *)name;
- (NSString *) columnsAutosaveName;
- (void) setColumnsAutosaveName: (NSString *)name;
#endif
@end
//
@ -261,12 +295,24 @@
- (NSString *) browser: (NSBrowser *)sender titleOfColumn: (int)column;
- (void) browser: (NSBrowser *)sender
willDisplayCell: (id)cell
atRow: (int)row
column: (int)column;
atRow: (int)row
column: (int)column;
- (void) browserDidScroll: (NSBrowser *)sender;
- (void) browserWillScroll: (NSBrowser *)sender;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
- (float) browser: (NSBrowser *)browser
shouldSizeColumn: (int)column
forUserResize: (BOOL)flag
toWidth: (float)width;
- (float) browser: (NSBrowser *)browser
sizeToFitWidthOfColumn: (int)column;
- (void) browserColumnConfigurationDidChange: (NSNotification *)notification;
#endif
@end
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
APPKIT_EXPORT NSString *NSBrowserColumnConfigurationDidChangeNotification;
#endif
#endif // _GNUstep_H_NSBrowser

View file

@ -76,6 +76,7 @@ static NSTextFieldCell *titleCell;
id _columnScrollView;
id _columnMatrix;
NSString *_columnTitle;
float _width;
}
- (void) setIsLoaded: (BOOL)flag;
@ -609,7 +610,7 @@ static NSTextFieldCell *titleCell;
NSBrowserColumn *bc = [_browserColumns objectAtIndex: column];
NSMatrix *matrix = [bc columnMatrix];
NSBrowserCell *selectedCell = nil;
BOOL found = NO;
BOOL found = NO;
if (useDelegate == YES)
{
@ -683,7 +684,7 @@ static NSTextFieldCell *titleCell;
- (NSString *) pathToColumn: (int)column
{
NSMutableString *separator = [_pathSeparator mutableCopy];
NSString *string;
NSString *string;
int i;
/*
@ -888,7 +889,7 @@ static NSTextFieldCell *titleCell;
for (i = 0; i < count; ++i)
{
if (matrix == [self matrixInColumn: i])
return i;
return i;
}
// Not found
@ -904,7 +905,7 @@ static NSTextFieldCell *titleCell;
for (i = _lastColumnLoaded; i >= 0; i--)
{
if (!(matrix = [self matrixInColumn: i]))
continue;
continue;
if ([matrix selectedCell])
return i;
}
@ -1250,6 +1251,74 @@ static NSTextFieldCell *titleCell;
[self tile];
}
- (float) columnWidthForColumnContentWidth: (float)columnContentWidth
{
float cw;
cw = columnContentWidth;
if (scrollerWidth > cw)
{
cw = scrollerWidth;
}
// Take the border into account
if (_separatesColumns)
cw += 2 * (_sizeForBorderType(NSBezelBorder)).width;
return cw;
}
- (float) columnContentWidthForColumnWidth: (float)columnWidth
{
float cw;
// Take the border into account
if (_separatesColumns)
cw -= 2 * (_sizeForBorderType(NSBezelBorder)).width;
return cw;
}
- (NSBrowserColumnResizingType) columnResizingType
{
return _columnResizing;
}
- (void) setColumnResizingType:(NSBrowserColumnResizingType) type
{
_columnResizing = type;
}
- (BOOL) prefersAllColumnUserResizing
{
return _prefersAllColumnUserResizing;
}
- (void) setPrefersAllColumnUserResizing: (BOOL)flag
{
_prefersAllColumnUserResizing = flag;
}
- (float) widthOfColumn: (int)column
{
NSBrowserColumn *browserColumn;
browserColumn = [_browserColumns objectAtIndex: column];
return browserColumn->_width;
}
- (void) setWidth: (float)columnWidth ofColumn: (int)column
{
NSBrowserColumn *browserColumn;
browserColumn = [_browserColumns objectAtIndex: column];
browserColumn->_width = columnWidth;
// FIXME: Send a notifiaction
}
/**<p> Returns YES if the title of a column is set to the string value of
the selected NSCell in the previous column. By default YES</p>
<p>See Also: -setTakesTitleFromPreviousColumn: -selectedCellInColumn:</p>
@ -1551,12 +1620,12 @@ static NSTextFieldCell *titleCell;
// The knob or knob slot
case NSScrollerKnob:
case NSScrollerKnobSlot:
{
float f = [sender floatValue];
{
float f = [sender floatValue];
[self scrollColumnToVisible: rintf(f * _lastColumnLoaded)];
}
break;
[self scrollColumnToVisible: rintf(f * _lastColumnLoaded)];
}
break;
// NSScrollerNoPart ???
default:
@ -1667,17 +1736,17 @@ static NSTextFieldCell *titleCell;
if (column == _firstVisibleColumn)
rect.origin.x = (n * _columnSize.width) + 2;
else
rect.origin.x = (n * _columnSize.width) + (n + 2);
rect.origin.x = (n * _columnSize.width) + (n + 2);
}
// Adjust for horizontal scroller
if (_hasHorizontalScroller)
{
if (_separatesColumns)
rect.origin.y = (scrollerWidth - 1) + (2 * bezelBorderSize.height) +
NSBR_VOFFSET;
rect.origin.y = (scrollerWidth - 1) + (2 * bezelBorderSize.height) +
NSBR_VOFFSET;
else
rect.origin.y = scrollerWidth + bezelBorderSize.width;
rect.origin.y = scrollerWidth + bezelBorderSize.width;
}
else
{
@ -1688,10 +1757,10 @@ static NSTextFieldCell *titleCell;
if (column == _lastVisibleColumn)
{
if (_separatesColumns)
rect.size.width = _frame.size.width - rect.origin.x;
rect.size.width = _frame.size.width - rect.origin.x;
else
rect.size.width = _frame.size.width -
(rect.origin.x + bezelBorderSize.width);
rect.size.width = _frame.size.width -
(rect.origin.x + bezelBorderSize.width);
}
if (rect.size.width < 0)
@ -1714,6 +1783,21 @@ static NSTextFieldCell *titleCell;
return [self frameOfColumn: column];
}
+ (void) removeSavedColumnsWithAutosaveName: (NSString *)name
{
[[NSUserDefaults standardUserDefaults] removeObjectForKey: name];
}
- (NSString *) columnsAutosaveName
{
return _columnsAutosaveName;
}
- (void) setColumnsAutosaveName: (NSString *)name
{
// FIXME: More to do. The whole column width saving is missing!
ASSIGN(_columnsAutosaveName, name);
}
/*
* Arranging browser components
@ -2083,7 +2167,10 @@ static NSTextFieldCell *titleCell;
titleCell = [GSBrowserTitleCell new];
}
self = [super initWithFrame: rect];
if ((self = [super initWithFrame: rect]) == nil)
{
return nil;
}
// Class setting
_browserCellPrototype = [[[NSBrowser cellClass] alloc] init];
@ -2536,7 +2623,7 @@ static NSTextFieldCell *titleCell;
[aCoder encodeInt: _maxVisibleColumns forKey: @"NSNumberOfVisibleColumns"];
[aCoder encodeInt: _minColumnWidth forKey: @"NSMinColumnWidth"];
//[aCoder encodeInt: columnResizingType forKey: @"NSColumnResizingType"]];
[aCoder encodeInt: _columnResizing forKey: @"NSColumnResizingType"];
//[aCoder encodeInt: prefWidth forKey: @"NSPreferedColumnWidth"];
}
else
@ -2634,7 +2721,7 @@ static NSTextFieldCell *titleCell;
bs = _sizeForBorderType (NSBezelBorder);
_minColumnWidth = scrollerWidth + (2 * bs.width);
if (_minColumnWidth < 100.0)
_minColumnWidth = 100.0;
_minColumnWidth = 100.0;
// Horizontal scroller
_scrollerRect.origin.x = bs.width;
@ -2691,8 +2778,8 @@ static NSTextFieldCell *titleCell;
if ([aDecoder containsValueForKey: @"NSColumnResizingType"])
{
//[self setColumnResizingType: [aDecoder decodeIntForKey: @"NSColumnResizingType"]];
}
[self setColumnResizingType: [aDecoder decodeIntForKey: @"NSColumnResizingType"]];
}
if ([aDecoder containsValueForKey: @"NSPreferedColumnWidth"])
{

View file

@ -114,6 +114,9 @@ NSString *NSImageGamma = @"NSImageGamma";
NSString *NSImageProgressive = @"NSImageProgressive";
NSString *NSImageEXIFData = @"NSImageEXIFData"; // No support yet in GNUstep
// NSBrowser notification
NSString *NSBrowserColumnConfigurationDidChangeNotification = @"NSBrowserColumnConfigurationDidChange";
// NSColor Global strings
NSString *NSCalibratedWhiteColorSpace = @"NSCalibratedWhiteColorSpace";
NSString *NSCalibratedBlackColorSpace = @"NSCalibratedBlackColorSpace";