Fixes mostly for accessing the popup button items via the keyboard

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15659 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2003-01-21 01:17:26 +00:00
parent b5457230e9
commit 38c0e9037b

View file

@ -292,7 +292,16 @@ Class _nspopupbuttonCellClass = 0;
NSMenu *m = [self menu];
if (m != nil)
return [m performKeyEquivalent: theEvent];
{
if ([m performKeyEquivalent: theEvent])
{
/* If the key equivalent was performed, redisplay ourselves
* to account for potential changes in the selected item.
*/
[self setNeedsDisplay: YES];
return YES;
}
}
return NO;
}
@ -302,6 +311,8 @@ Class _nspopupbuttonCellClass = 0;
NSWindow *menuWindow = [mr window];
NSEvent *e;
NSPoint p;
int lastSelectedItem = [mr highlightedItemIndex];
int highlightedItemIndex;
if ([self isEnabled] == NO)
return;
@ -326,6 +337,16 @@ Class _nspopupbuttonCellClass = 0;
pressure: [theEvent pressure]];
[menuWindow sendEvent: e];
// Selection remains unchanged if selected item is disabled
highlightedItemIndex = [mr highlightedItemIndex];
if (highlightedItemIndex >= 0)
{
if ([[self itemAtIndex: highlightedItemIndex] isEnabled] == NO)
{
[mr setHighlightedItemIndex: lastSelectedItem];
}
}
// Dismiss the popUp
[_cell dismissPopUp];