mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-29 19:07:38 +00:00
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:
parent
b5457230e9
commit
38c0e9037b
1 changed files with 22 additions and 1 deletions
|
@ -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];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue