mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 08:10:59 +00:00
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:
parent
d9dd70caf8
commit
a7ba44ca0b
4 changed files with 165 additions and 23 deletions
|
@ -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>
|
2007-07-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Headers/AppKit/NSBox.h,
|
* Headers/AppKit/NSBox.h,
|
||||||
|
|
|
@ -41,6 +41,15 @@
|
||||||
@class NSScroller;
|
@class NSScroller;
|
||||||
//@class NSBox;
|
//@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>
|
@interface NSBrowser : NSControl <NSCoding>
|
||||||
{
|
{
|
||||||
// Attributes
|
// Attributes
|
||||||
|
@ -67,6 +76,7 @@
|
||||||
BOOL _sendsActionOnArrowKeys;
|
BOOL _sendsActionOnArrowKeys;
|
||||||
BOOL _acceptsAlphaNumericalKeys;
|
BOOL _acceptsAlphaNumericalKeys;
|
||||||
BOOL _sendsActionOnAlphaNumericalKeys;
|
BOOL _sendsActionOnAlphaNumericalKeys;
|
||||||
|
BOOL _prefersAllColumnUserResizing;
|
||||||
|
|
||||||
BOOL _passiveDelegate;
|
BOOL _passiveDelegate;
|
||||||
id _browserDelegate;
|
id _browserDelegate;
|
||||||
|
@ -82,6 +92,8 @@
|
||||||
int _lastColumnLoaded;
|
int _lastColumnLoaded;
|
||||||
int _firstVisibleColumn;
|
int _firstVisibleColumn;
|
||||||
int _lastVisibleColumn;
|
int _lastVisibleColumn;
|
||||||
|
NSString *_columnsAutosaveName;
|
||||||
|
NSBrowserColumnResizingType _columnResizing;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -148,6 +160,10 @@
|
||||||
- (void) setMaxVisibleColumns: (int)columnCount;
|
- (void) setMaxVisibleColumns: (int)columnCount;
|
||||||
- (void) setMinColumnWidth: (int)columnWidth;
|
- (void) setMinColumnWidth: (int)columnWidth;
|
||||||
- (void) setSeparatesColumns: (BOOL)flag;
|
- (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
|
// Manipulating Columns
|
||||||
|
@ -233,6 +249,24 @@
|
||||||
//
|
//
|
||||||
- (void) tile;
|
- (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
|
@end
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -261,12 +295,24 @@
|
||||||
- (NSString *) browser: (NSBrowser *)sender titleOfColumn: (int)column;
|
- (NSString *) browser: (NSBrowser *)sender titleOfColumn: (int)column;
|
||||||
- (void) browser: (NSBrowser *)sender
|
- (void) browser: (NSBrowser *)sender
|
||||||
willDisplayCell: (id)cell
|
willDisplayCell: (id)cell
|
||||||
atRow: (int)row
|
atRow: (int)row
|
||||||
column: (int)column;
|
column: (int)column;
|
||||||
- (void) browserDidScroll: (NSBrowser *)sender;
|
- (void) browserDidScroll: (NSBrowser *)sender;
|
||||||
- (void) browserWillScroll: (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
|
@end
|
||||||
|
|
||||||
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
|
||||||
|
APPKIT_EXPORT NSString *NSBrowserColumnConfigurationDidChangeNotification;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _GNUstep_H_NSBrowser
|
#endif // _GNUstep_H_NSBrowser
|
||||||
|
|
|
@ -76,6 +76,7 @@ static NSTextFieldCell *titleCell;
|
||||||
id _columnScrollView;
|
id _columnScrollView;
|
||||||
id _columnMatrix;
|
id _columnMatrix;
|
||||||
NSString *_columnTitle;
|
NSString *_columnTitle;
|
||||||
|
float _width;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setIsLoaded: (BOOL)flag;
|
- (void) setIsLoaded: (BOOL)flag;
|
||||||
|
@ -609,7 +610,7 @@ static NSTextFieldCell *titleCell;
|
||||||
NSBrowserColumn *bc = [_browserColumns objectAtIndex: column];
|
NSBrowserColumn *bc = [_browserColumns objectAtIndex: column];
|
||||||
NSMatrix *matrix = [bc columnMatrix];
|
NSMatrix *matrix = [bc columnMatrix];
|
||||||
NSBrowserCell *selectedCell = nil;
|
NSBrowserCell *selectedCell = nil;
|
||||||
BOOL found = NO;
|
BOOL found = NO;
|
||||||
|
|
||||||
if (useDelegate == YES)
|
if (useDelegate == YES)
|
||||||
{
|
{
|
||||||
|
@ -683,7 +684,7 @@ static NSTextFieldCell *titleCell;
|
||||||
- (NSString *) pathToColumn: (int)column
|
- (NSString *) pathToColumn: (int)column
|
||||||
{
|
{
|
||||||
NSMutableString *separator = [_pathSeparator mutableCopy];
|
NSMutableString *separator = [_pathSeparator mutableCopy];
|
||||||
NSString *string;
|
NSString *string;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -888,7 +889,7 @@ static NSTextFieldCell *titleCell;
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if (matrix == [self matrixInColumn: i])
|
if (matrix == [self matrixInColumn: i])
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not found
|
// Not found
|
||||||
|
@ -904,7 +905,7 @@ static NSTextFieldCell *titleCell;
|
||||||
for (i = _lastColumnLoaded; i >= 0; i--)
|
for (i = _lastColumnLoaded; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (!(matrix = [self matrixInColumn: i]))
|
if (!(matrix = [self matrixInColumn: i]))
|
||||||
continue;
|
continue;
|
||||||
if ([matrix selectedCell])
|
if ([matrix selectedCell])
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -1250,6 +1251,74 @@ static NSTextFieldCell *titleCell;
|
||||||
[self tile];
|
[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
|
/**<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>
|
the selected NSCell in the previous column. By default YES</p>
|
||||||
<p>See Also: -setTakesTitleFromPreviousColumn: -selectedCellInColumn:</p>
|
<p>See Also: -setTakesTitleFromPreviousColumn: -selectedCellInColumn:</p>
|
||||||
|
@ -1551,12 +1620,12 @@ static NSTextFieldCell *titleCell;
|
||||||
// The knob or knob slot
|
// The knob or knob slot
|
||||||
case NSScrollerKnob:
|
case NSScrollerKnob:
|
||||||
case NSScrollerKnobSlot:
|
case NSScrollerKnobSlot:
|
||||||
{
|
{
|
||||||
float f = [sender floatValue];
|
float f = [sender floatValue];
|
||||||
|
|
||||||
[self scrollColumnToVisible: rintf(f * _lastColumnLoaded)];
|
[self scrollColumnToVisible: rintf(f * _lastColumnLoaded)];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// NSScrollerNoPart ???
|
// NSScrollerNoPart ???
|
||||||
default:
|
default:
|
||||||
|
@ -1667,17 +1736,17 @@ static NSTextFieldCell *titleCell;
|
||||||
if (column == _firstVisibleColumn)
|
if (column == _firstVisibleColumn)
|
||||||
rect.origin.x = (n * _columnSize.width) + 2;
|
rect.origin.x = (n * _columnSize.width) + 2;
|
||||||
else
|
else
|
||||||
rect.origin.x = (n * _columnSize.width) + (n + 2);
|
rect.origin.x = (n * _columnSize.width) + (n + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust for horizontal scroller
|
// Adjust for horizontal scroller
|
||||||
if (_hasHorizontalScroller)
|
if (_hasHorizontalScroller)
|
||||||
{
|
{
|
||||||
if (_separatesColumns)
|
if (_separatesColumns)
|
||||||
rect.origin.y = (scrollerWidth - 1) + (2 * bezelBorderSize.height) +
|
rect.origin.y = (scrollerWidth - 1) + (2 * bezelBorderSize.height) +
|
||||||
NSBR_VOFFSET;
|
NSBR_VOFFSET;
|
||||||
else
|
else
|
||||||
rect.origin.y = scrollerWidth + bezelBorderSize.width;
|
rect.origin.y = scrollerWidth + bezelBorderSize.width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1688,10 +1757,10 @@ static NSTextFieldCell *titleCell;
|
||||||
if (column == _lastVisibleColumn)
|
if (column == _lastVisibleColumn)
|
||||||
{
|
{
|
||||||
if (_separatesColumns)
|
if (_separatesColumns)
|
||||||
rect.size.width = _frame.size.width - rect.origin.x;
|
rect.size.width = _frame.size.width - rect.origin.x;
|
||||||
else
|
else
|
||||||
rect.size.width = _frame.size.width -
|
rect.size.width = _frame.size.width -
|
||||||
(rect.origin.x + bezelBorderSize.width);
|
(rect.origin.x + bezelBorderSize.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rect.size.width < 0)
|
if (rect.size.width < 0)
|
||||||
|
@ -1714,6 +1783,21 @@ static NSTextFieldCell *titleCell;
|
||||||
return [self frameOfColumn: column];
|
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
|
* Arranging browser components
|
||||||
|
@ -2083,7 +2167,10 @@ static NSTextFieldCell *titleCell;
|
||||||
titleCell = [GSBrowserTitleCell new];
|
titleCell = [GSBrowserTitleCell new];
|
||||||
}
|
}
|
||||||
|
|
||||||
self = [super initWithFrame: rect];
|
if ((self = [super initWithFrame: rect]) == nil)
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
// Class setting
|
// Class setting
|
||||||
_browserCellPrototype = [[[NSBrowser cellClass] alloc] init];
|
_browserCellPrototype = [[[NSBrowser cellClass] alloc] init];
|
||||||
|
@ -2536,7 +2623,7 @@ static NSTextFieldCell *titleCell;
|
||||||
[aCoder encodeInt: _maxVisibleColumns forKey: @"NSNumberOfVisibleColumns"];
|
[aCoder encodeInt: _maxVisibleColumns forKey: @"NSNumberOfVisibleColumns"];
|
||||||
[aCoder encodeInt: _minColumnWidth forKey: @"NSMinColumnWidth"];
|
[aCoder encodeInt: _minColumnWidth forKey: @"NSMinColumnWidth"];
|
||||||
|
|
||||||
//[aCoder encodeInt: columnResizingType forKey: @"NSColumnResizingType"]];
|
[aCoder encodeInt: _columnResizing forKey: @"NSColumnResizingType"];
|
||||||
//[aCoder encodeInt: prefWidth forKey: @"NSPreferedColumnWidth"];
|
//[aCoder encodeInt: prefWidth forKey: @"NSPreferedColumnWidth"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2634,7 +2721,7 @@ static NSTextFieldCell *titleCell;
|
||||||
bs = _sizeForBorderType (NSBezelBorder);
|
bs = _sizeForBorderType (NSBezelBorder);
|
||||||
_minColumnWidth = scrollerWidth + (2 * bs.width);
|
_minColumnWidth = scrollerWidth + (2 * bs.width);
|
||||||
if (_minColumnWidth < 100.0)
|
if (_minColumnWidth < 100.0)
|
||||||
_minColumnWidth = 100.0;
|
_minColumnWidth = 100.0;
|
||||||
|
|
||||||
// Horizontal scroller
|
// Horizontal scroller
|
||||||
_scrollerRect.origin.x = bs.width;
|
_scrollerRect.origin.x = bs.width;
|
||||||
|
@ -2691,8 +2778,8 @@ static NSTextFieldCell *titleCell;
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSColumnResizingType"])
|
if ([aDecoder containsValueForKey: @"NSColumnResizingType"])
|
||||||
{
|
{
|
||||||
//[self setColumnResizingType: [aDecoder decodeIntForKey: @"NSColumnResizingType"]];
|
[self setColumnResizingType: [aDecoder decodeIntForKey: @"NSColumnResizingType"]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSPreferedColumnWidth"])
|
if ([aDecoder containsValueForKey: @"NSPreferedColumnWidth"])
|
||||||
{
|
{
|
||||||
|
|
|
@ -114,6 +114,9 @@ NSString *NSImageGamma = @"NSImageGamma";
|
||||||
NSString *NSImageProgressive = @"NSImageProgressive";
|
NSString *NSImageProgressive = @"NSImageProgressive";
|
||||||
NSString *NSImageEXIFData = @"NSImageEXIFData"; // No support yet in GNUstep
|
NSString *NSImageEXIFData = @"NSImageEXIFData"; // No support yet in GNUstep
|
||||||
|
|
||||||
|
// NSBrowser notification
|
||||||
|
NSString *NSBrowserColumnConfigurationDidChangeNotification = @"NSBrowserColumnConfigurationDidChange";
|
||||||
|
|
||||||
// NSColor Global strings
|
// NSColor Global strings
|
||||||
NSString *NSCalibratedWhiteColorSpace = @"NSCalibratedWhiteColorSpace";
|
NSString *NSCalibratedWhiteColorSpace = @"NSCalibratedWhiteColorSpace";
|
||||||
NSString *NSCalibratedBlackColorSpace = @"NSCalibratedBlackColorSpace";
|
NSString *NSCalibratedBlackColorSpace = @"NSCalibratedBlackColorSpace";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue