Small changes to prepare for merge of NSToolbar and GSToolbar.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27488 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2009-01-01 19:22:50 +00:00
parent 7219a2e126
commit 46af2db2df
6 changed files with 36 additions and 78 deletions

View file

@ -1,4 +1,14 @@
2009-01-10 Richard Frith-Macdonald <rfm@gnu.org>
2009-01-01 Fred Kiefer <FredKiefer@gmx.de>
* Headers/Additions/GNUstepGUI/GSToolbar.h,
* Source/GSToolbar.m,
* Source/NSToolbar.m: Remove unused initializer.
* Source/GSToolbarView.m: Remove method _setToolbar:, code is now
in setToolbar:.
* Source/NSWindow+Toolbar.m (-setToolbar:): Adopt to changes in
GSToolbarView.
2009-01-01 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Additions/GNUstepGUI/GSTheme.h:
* Source/GSTheme.m:

View file

@ -85,10 +85,6 @@ APPKIT_EXPORT NSString *NSToolbarWillAddItemNotification;
// Instance methods
- (id) initWithIdentifier: (NSString*)identifier;
- (id) initWithIdentifier: (NSString *)identifier
displayMode: (NSToolbarDisplayMode)displayMode
sizeMode: (NSToolbarSizeMode)sizeMode;
- (void) insertItemWithItemIdentifier: (NSString*)itemIdentifier atIndex: (int)index;
- (void) removeItemAtIndex: (int)index;
- (void) runCustomizationPalette: (id)sender;

View file

@ -474,7 +474,6 @@ static GSValidationCenter *vc = nil;
// Private class method
+ (NSArray *) _toolbars;
+ (NSArray *) _toolbarsWithIdentifier: (NSString *)identifier;
- (void) _insertItemWithItemIdentifier: (NSString *)itemIdentifier
@ -546,11 +545,6 @@ static GSValidationCenter *vc = nil;
// Private class method to access static variable toolbars in subclasses
+ (NSArray *) _toolbars
{
return toolbars;
}
+ (NSArray *) _toolbarsWithIdentifier: (NSString *)identifier
{
return [toolbars objectsWithValue: identifier
@ -559,18 +553,8 @@ static GSValidationCenter *vc = nil;
// Instance methods
- (id) initWithIdentifier: (NSString *)identifier
{
return [self initWithIdentifier: identifier
displayMode: NSToolbarDisplayModeIconAndLabel
sizeMode: NSToolbarSizeModeRegular];
}
// default initialiser
- (id) initWithIdentifier: (NSString *)identifier
displayMode: (NSToolbarDisplayMode)displayMode
sizeMode: (NSToolbarSizeMode)sizeMode
- (id) initWithIdentifier: (NSString *)identifier
{
GSToolbar *toolbarModel;
@ -589,12 +573,8 @@ static GSValidationCenter *vc = nil;
_allowsUserCustomization = [toolbarModel allowsUserCustomization];
_autosavesConfiguration = [toolbarModel autosavesConfiguration];
ASSIGN(_configurationDictionary, [toolbarModel configurationDictionary]);
if ([toolbarModel displayMode] != displayMode
&& [toolbarModel sizeMode] != sizeMode)
{
// Raise an exception.
}
_displayMode = [toolbarModel displayMode];
_sizeMode = [toolbarModel sizeMode];
// [self _loadConfig];
}
@ -604,14 +584,15 @@ static GSValidationCenter *vc = nil;
_allowsUserCustomization = NO;
_autosavesConfiguration = NO;
_configurationDictionary = nil;
_displayMode = NSToolbarDisplayModeIconAndLabel;
_sizeMode = NSToolbarSizeModeRegular;
// [self _loadConfig];
}
_displayMode = displayMode;
_sizeMode = sizeMode;
_delegate = nil;
// Store in list of toolbars
[toolbars addObject: self];
return self;
@ -638,6 +619,7 @@ static GSValidationCenter *vc = nil;
[super dealloc];
}
// FIXME: Hack
- (void) release
{
// We currently only worry about when our toolbar view is deallocated.
@ -651,10 +633,6 @@ static GSValidationCenter *vc = nil;
[super release];
}
/*
* FIXME: Replace the deprecated method which follows by this one when -base
* NSObject will implement it.
*
- (id) valueForUndefinedKey: (NSString *)key
{
if ([key isEqualToString: @"window"] || [key isEqualToString: @"_window"])
@ -662,15 +640,6 @@ static GSValidationCenter *vc = nil;
return [super valueForUndefinedKey: key];
}
*/
- (id) handleQueryWithUnboundKey: (NSString *)key
{
if ([key isEqualToString: @"window"] || [key isEqualToString: @"_window"])
return [NSNull null];
return [super handleQueryWithUnboundKey: key];
}
- (void) insertItemWithItemIdentifier: (NSString *)itemIdentifier
atIndex: (int)index

View file

@ -178,7 +178,6 @@ static void initSystemExtensionsColors(void)
- (void) _handleBackViewsFrame;
- (void) _handleViewsVisibility;
- (void) _reload;
- (void) _setToolbar: (GSToolbar *)toolbar;
- (void) _takeInAccountFlexibleSpaces;
- (int) _insertionIndexAtPoint: (NSPoint)location;
@ -659,13 +658,21 @@ static void initSystemExtensionsColors(void)
- (void) setToolbar: (GSToolbar *)toolbar
{
if ([toolbar isKindOfClass: NSClassFromString(@"NSToolbar")])
[NSException raise: NSInvalidArgumentException
format: @"NSToolbar instance can't be attached directly to a \
toolbar view, setToolbar: from the NSWindow toolbar \
category must be used."];
[self _setToolbar: toolbar];
if ([toolbar sizeMode] != _sizeMode)
; // FIXME: Raise exception here
if (_toolbar == toolbar)
return;
// We unset the toolbar view from the previous toolbar
[_toolbar _setToolbarView: nil];
ASSIGN(_toolbar, toolbar);
// We set the toolbar view on the new toolbar
[_toolbar _setToolbarView: self];
[_clippedItemsMark setToolbar: _toolbar];
// Load the toolbar in the toolbar view
[self _reload];
}
- (NSColor *) standardBackgroundColor
@ -821,21 +828,6 @@ static void initSystemExtensionsColors(void)
[self setNeedsDisplay: YES];
}
- (void) _setToolbar: (GSToolbar *)toolbar
{
if ([toolbar sizeMode] != _sizeMode)
; // FIXME: Raise exception here
[toolbar _setToolbarView: self]; // We set the toolbar view on the new toolbar
[_toolbar _setToolbarView: nil]; // We unset the toolbar view from the previous toolbar
ASSIGN(_toolbar, toolbar);
[_clippedItemsMark setToolbar: _toolbar];
[self _reload]; // Load the toolbar in the toolbar view
}
- (void) _takeInAccountFlexibleSpaces
{
NSArray *items = [_toolbar items];

View file

@ -93,14 +93,10 @@ static const int current_version = 1;
// Instance methods
- (id) initWithIdentifier: (NSString *)identifier
displayMode: (NSToolbarDisplayMode)displayMode
sizeMode: (NSToolbarSizeMode)sizeMode
{
NSToolbar *toolbarModel = nil;
if ((self = [super initWithIdentifier: identifier
displayMode: displayMode
sizeMode: sizeMode]) == nil)
if ((self = [super initWithIdentifier: identifier]) == nil)
{
return nil;
}
@ -109,14 +105,10 @@ static const int current_version = 1;
if (toolbarModel != nil)
{
_displayMode = [toolbarModel displayMode];
_sizeMode = [toolbarModel sizeMode];
_visible = [toolbarModel isVisible];
}
else
{
_displayMode = displayMode;
_sizeMode = sizeMode;
_visible = YES;
}

View file

@ -39,7 +39,6 @@
@end
@interface GSToolbarView (GNUstepPrivate)
- (void) _setToolbar: (NSToolbar *)toolbar;
- (float) _heightFromLayout;
- (void) _reload;
@end
@ -135,7 +134,7 @@
{
[self _toggleToolbarView];
}
[toolbarView _setToolbar: nil];
[toolbarView setToolbar: nil];
// Release the toolbarView, this will release the toolbar
RELEASE(toolbarView);
}
@ -164,7 +163,7 @@
[toolbarView setBorderMask: GSToolbarViewBottomBorder];
// Load the toolbar inside the toolbar view
// Will set the _toolbarView variable for the toolbar
[toolbarView _setToolbar: toolbar];
[toolbarView setToolbar: toolbar];
}
// Make the toolbar view visible