PopUpButtonCell correction for compile error

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17663 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2003-09-13 20:59:10 +00:00
parent 84334f69bc
commit 5f2ee5703a
3 changed files with 33 additions and 9 deletions

View file

@ -1,3 +1,8 @@
2003-09-13 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSPopUpButtonCell.m: Corrected minor problem which
was causing a compilation error.
2003-09-13 Fred Kiefer <FredKiefer@gmx.de> 2003-09-13 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSMenu.m * Source/NSMenu.m
@ -7,7 +12,8 @@
Undid last change. Rewrote [setMenu:] to make the popup button Undid last change. Rewrote [setMenu:] to make the popup button
cell listen to change notifications of the menu. New method cell listen to change notifications of the menu. New method
[itemChanged:] gets called when a menu item changes. Added hack to [itemChanged:] gets called when a menu item changes. Added hack to
[initWithCoder:] to set menu correctly and read old menu items correctly. [initWithCoder:] to set menu correctly and read old menu items
correctly.
Check in [itemAtIndex:] that the index is vaild and return nil Check in [itemAtIndex:] that the index is vaild and return nil
otherwise. otherwise.

View file

@ -353,7 +353,7 @@ static NSImage *_pbc_image[2];
} }
else else
{ {
retun nil; return nil;
} }
} }

View file

@ -183,10 +183,19 @@ static const int current_version = 1;
} }
} }
- (id) initWithIdentifier: (NSString*)identifier - (id) initWithIdentifier: (NSString*)identifier
{ {
[super init]; [super init];
_customizationPaletteIsRunning = NO;
_allowsUserCustomization = NO;
_autosavesConfiguration = NO;
_configurationDictionary = nil;
_delegate = nil;
_displayMode = NSToolbarDisplayModeDefault;
_visible = YES;
_items = nil;
_visibleItems = nil;
ASSIGN(_identifier, identifier); ASSIGN(_identifier, identifier);
[self _loadConfig]; [self _loadConfig];
@ -211,12 +220,17 @@ static const int current_version = 1;
- (void) insertItemWithItemIdentifier: (NSString *)itemIdentifier - (void) insertItemWithItemIdentifier: (NSString *)itemIdentifier
atIndex: (int)index atIndex: (int)index
{ {
NSToolbarItem *item = [_delegate toolbar: self NSToolbarItem *item = nil;
NSArray *allowedItems = [_delegate toolbarAllowedItemIdentifiers: self];
if([allowedItems containsObject: itemIdentifier])
{
item = [_delegate toolbar: self
itemForItemIdentifier: itemIdentifier itemForItemIdentifier: itemIdentifier
willBeInsertedIntoToolbar: YES]; willBeInsertedIntoToolbar: YES];
[nc postNotificationName: NSToolbarWillAddItemNotification [nc postNotificationName: NSToolbarWillAddItemNotification
object: self]; object: self];
[_items insertObject: item atIndex: index]; [_items insertObject: item atIndex: index];
}
} }
- (BOOL) isVisible - (BOOL) isVisible
@ -243,6 +257,10 @@ static const int current_version = 1;
{ {
_customizationPaletteIsRunning = [NSBundle loadNibNamed: @"GSToolbarCustomizationPalette" _customizationPaletteIsRunning = [NSBundle loadNibNamed: @"GSToolbarCustomizationPalette"
owner: self]; owner: self];
if(!_customizationPaletteIsRunning)
{
NSLog(@"Failed to load gorm for GSToolbarCustomizationPalette");
}
} }
- (void) setAllowsUserCustomization: (BOOL)flag - (void) setAllowsUserCustomization: (BOOL)flag