mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 17:50:38 +00:00
Hanle key equivalents in popup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5675 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
936176ad81
commit
c69a12abec
2 changed files with 51 additions and 31 deletions
|
@ -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];
|
||||
|
|
|
@ -38,21 +38,20 @@
|
|||
#include <AppKit/NSMenuView.h>
|
||||
#include <AppKit/NSFont.h>
|
||||
|
||||
//
|
||||
// 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 <NSMenuItem>) itemWithTitle: (NSString *)title
|
||||
- (id <NSMenuItem>) 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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue