From c69a12abeccd5291167ae21c78acb6011963d86c Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Thu, 6 Jan 2000 19:49:19 +0000 Subject: [PATCH] Hanle key equivalents in popup git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5675 72102866-910b-0410-8b05-ffd578937521 --- Source/NSApplication.m | 12 ++++++++ Source/NSPopUpButton.m | 70 +++++++++++++++++++++++------------------- 2 files changed, 51 insertions(+), 31 deletions(-) diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 97fc36fe0..9d468a579 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -109,6 +109,18 @@ NSApplication *NSApp = nil; return YES; } +- (void) orderWindow: (NSWindowOrderingMode)place relativeTo: (int)otherWin +{ + if (place == NSWindowOut) + { + NSLog(@"Argh - icon window ordered out"); + } + else + { + [super orderWindow: place relativeTo: otherWin]; + } +} + - (void) initDefaults { [super initDefaults]; diff --git a/Source/NSPopUpButton.m b/Source/NSPopUpButton.m index 1f3ad6c34..df610ef71 100644 --- a/Source/NSPopUpButton.m +++ b/Source/NSPopUpButton.m @@ -38,21 +38,20 @@ #include #include -// -// class variables -// +/* + * class variables + */ Class _nspopupbuttonCellClass = 0; -// -// NSPopUpButton implementation -// +/* + * NSPopUpButton implementation + */ @implementation NSPopUpButton -/////////////////////////////////////////////////////////////// -// -// Class methods -// +/* + * Class methods + */ + (void) initialize { if (self == [NSPopUpButton class]) @@ -73,9 +72,9 @@ Class _nspopupbuttonCellClass = 0; _nspopupbuttonCellClass = classId; } -// -// Initializing an NSPopUpButton -// +/* + * Initializing an NSPopUpButton + */ - (id) init { return [self initWithFrame: NSZeroRect pullsDown: NO]; @@ -95,12 +94,12 @@ Class _nspopupbuttonCellClass = 0; return self; } -- (void) setMenu: (NSMenu *)menu +- (void) setMenu: (NSMenu*)menu { [_cell setMenu: menu]; } -- (NSMenu *) menu +- (NSMenu*) menu { return [_cell menu]; } @@ -132,22 +131,31 @@ Class _nspopupbuttonCellClass = 0; [self synchronizeTitleAndSelectedItem]; } -- (void) addItemsWithTitles: (NSArray *)itemTitles +- (void) addItemsWithTitles: (NSArray*)itemTitles { [_cell addItemsWithTitles: itemTitles]; [self synchronizeTitleAndSelectedItem]; } -- (void) insertItemWithTitle: (NSString *)title +- (void) insertItemWithTitle: (NSString*)title atIndex: (int)index { [_cell insertItemWithTitle: title - atIndex: index]; + atIndex: index]; [self synchronizeTitleAndSelectedItem]; } +- (BOOL) performKeyEquivalent: (NSEvent*)theEvent +{ + NSMenu *m = [self menu]; + + if (m != nil) + return [m performKeyEquivalent: theEvent]; + return NO; +} + - (void) removeAllItems { [_cell removeAllItems]; @@ -155,7 +163,7 @@ Class _nspopupbuttonCellClass = 0; [self synchronizeTitleAndSelectedItem]; } -- (void) removeItemWithTitle: (NSString *)title +- (void) removeItemWithTitle: (NSString*)title { [_cell removeItemWithTitle: title]; @@ -174,7 +182,7 @@ Class _nspopupbuttonCellClass = 0; return [_cell selectedItem]; } -- (NSString *) titleOfSelectedItem +- (NSString*) titleOfSelectedItem { return [_cell titleOfSelectedItem]; } @@ -194,7 +202,7 @@ Class _nspopupbuttonCellClass = 0; [_cell selectItemAtIndex: index]; } -- (void) selectItemWithTitle: (NSString *)title +- (void) selectItemWithTitle: (NSString*)title { [_cell selectItemWithTitle: title]; } @@ -204,7 +212,7 @@ Class _nspopupbuttonCellClass = 0; return [_cell numberOfItems]; } -- (NSArray *) itemArray +- (NSArray*) itemArray { return [_cell itemArray]; } @@ -214,17 +222,17 @@ Class _nspopupbuttonCellClass = 0; return [_cell itemAtIndex: index]; } -- (NSString *) itemTitleAtIndex: (int)index +- (NSString*) itemTitleAtIndex: (int)index { return [_cell itemTitleAtIndex: index]; } -- (NSArray *) itemTitles +- (NSArray*) itemTitles { return [_cell itemTitles]; } -- (id ) itemWithTitle: (NSString *)title +- (id ) itemWithTitle: (NSString*)title { return [_cell itemWithTitle: title]; } @@ -244,7 +252,7 @@ Class _nspopupbuttonCellClass = 0; return [_cell indexOfItemWithTag: tag]; } -- (int) indexOfItemWithTitle: (NSString *)title +- (int) indexOfItemWithTitle: (NSString*)title { return [_cell indexOfItemWithTitle: title]; } @@ -270,7 +278,7 @@ Class _nspopupbuttonCellClass = 0; return [_cell preferredEdge]; } -- (void) setTitle: (NSString *)aString +- (void) setTitle: (NSString*)aString { [_cell setTitle: aString]; } @@ -289,7 +297,7 @@ Class _nspopupbuttonCellClass = 0; [[popb_menu menuRepresentation] sizeToFit]; } -- (void) mouseDown: (NSEvent *)theEvent +- (void) mouseDown: (NSEvent*)theEvent { NSMenuView *mr = [[_cell menu] menuRepresentation]; NSEvent *e; @@ -332,9 +340,9 @@ Class _nspopupbuttonCellClass = 0; } -// -// NSCoding protocol -// +/* + * NSCoding protocol + */ - (void) encodeWithCoder: (NSCoder*)aCoder { [super encodeWithCoder: aCoder];