mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 12:00:45 +00:00
Fixed small NSMenu bugglets.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4574 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1452e6dc22
commit
bf4db87fb3
2 changed files with 35 additions and 11 deletions
|
@ -1,3 +1,9 @@
|
|||
1999-07-12 Michael Hanni <mhanni@sprintmail.com>
|
||||
|
||||
* Source/NSMenu.m: added code to convert anything that conforms to
|
||||
<NSMenuItem> into an NSMenuItemCell. Not tested, but should work.
|
||||
Also fixed a small bug in -init, it was not returning.
|
||||
|
||||
Mon Jul 12 5:40:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSOpenPanel.m: In ([-runModalForTypes:]) made change
|
||||
|
|
|
@ -61,7 +61,7 @@ static NSZone *menuZone = NULL;
|
|||
|
||||
- (id)init
|
||||
{
|
||||
[self initWithTitle:@"Menu"];
|
||||
return [self initWithTitle:@"Menu"];
|
||||
}
|
||||
|
||||
- (id)initWithTitle:(NSString *)aTitle
|
||||
|
@ -89,13 +89,37 @@ static NSZone *menuZone = NULL;
|
|||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* - (void)insertItem:(id <NSMenuItem>)newItem
|
||||
* atIndex:(int)index
|
||||
*
|
||||
* This method has been modified to convert anything that conforms to the
|
||||
* <NSMenuItem> Protocol into a NSMenuItemCell which will be added to the
|
||||
* items array.
|
||||
*
|
||||
* Blame: Michael
|
||||
*/
|
||||
|
||||
- (void)insertItem:(id <NSMenuItem>)newItem
|
||||
atIndex:(int)index
|
||||
{
|
||||
if ([(NSMenuItemCell *)newItem isKindOfClass:[NSMenuItemCell class]])
|
||||
[menu_items insertObject:newItem atIndex:index];
|
||||
if ([newItem conformsToProtocol:@protocol(NSMenuItem)])
|
||||
{
|
||||
if ([newItem isKindOfClass:[NSMenuItemCell class]])
|
||||
[menu_items insertObject:newItem atIndex:index];
|
||||
else
|
||||
{
|
||||
[self insertItemWithTitle:[newItem title]
|
||||
action:[newItem action]
|
||||
keyEquivalent:[newItem keyEquivalent]
|
||||
atIndex:index];
|
||||
[(NSMenuItem *)newItem release];
|
||||
}
|
||||
}
|
||||
else
|
||||
NSLog(@"You must use an NSMenuItemCell, or a derivative thereof.\n");
|
||||
NSLog(@"You must use an object that conforms to NSMenuItem.\n");
|
||||
|
||||
menu_changed = YES;
|
||||
}
|
||||
|
||||
- (id <NSMenuItem>)insertItemWithTitle:(NSString *)aString
|
||||
|
@ -117,13 +141,7 @@ static NSZone *menuZone = NULL;
|
|||
|
||||
- (void)addItem:(id <NSMenuItem>)newItem
|
||||
{
|
||||
// The spec says we call [self insertItem]; but why waste the overhead?
|
||||
if ([(NSMenuItemCell *)newItem isKindOfClass:[NSMenuItemCell class]])
|
||||
[menu_items insertObject:newItem atIndex:[menu_items count]];
|
||||
else
|
||||
NSLog(@"You must use an NSMenuItemCell, or a derivative thereof.\n");
|
||||
|
||||
menu_changed = YES;
|
||||
[self insertItem:newItem atIndex:[menu_items count]];
|
||||
}
|
||||
|
||||
- (id <NSMenuItem>)addItemWithTitle:(NSString *)aString
|
||||
|
|
Loading…
Reference in a new issue