Pop up the list of a combo box when the user presses the down arrow

key. This gives users full keyboard control for NSComboBox.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31120 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
wlux 2010-08-11 20:49:33 +00:00
parent 26019a4955
commit d4e85d8f8d
3 changed files with 31 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2010-08-11 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSComboBox.m (-textView:doCommandBySelector:): New
override to pop up the combo box's list when the user presses
the down arrow key.
* Source/NSComboBoxCell.m (_performClickWithFrame:inView:):
Remember the cell's control view.
2010-08-10 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSPopUpButtonCell.m (-setPullsDown:): Call

View file

@ -29,6 +29,7 @@
#include "AppKit/NSComboBox.h"
#include "AppKit/NSComboBoxCell.h"
#include "AppKit/NSEvent.h"
#include "AppKit/NSTextView.h"
/*
* Class variables
@ -37,6 +38,15 @@ static Class usedCellClass;
static Class comboBoxCellClass;
static NSNotificationCenter *nc;
/*
* Declaration of private cell method
*/
@interface NSComboBoxCell (GNUstepPrivate)
- (void) _performClickWithFrame: (NSRect)cellFrame
inView: (NSView *)controlView;
@end
/**
<unit>
<heading>Class Description</heading>
@ -477,6 +487,18 @@ static NSNotificationCenter *nc;
[super mouseDown: theEvent];
}
- (BOOL) textView: (NSTextView *)textView doCommandBySelector: (SEL)command
{
if ([super textView: textView doCommandBySelector: command])
return YES;
if (sel_eq(command, @selector(moveDown:)))
{
[_cell _performClickWithFrame: [self bounds] inView: self];
return YES;
}
return NO;
}
- (void) setFrame: (NSRect)frame
{
NSRect rect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, 21);

View file

@ -1883,6 +1883,7 @@ static inline NSRect buttonCellFrameFromRect(NSRect cellRect)
NSWindow *cvWindow = [controlView window];
NSRect buttonRect = buttonCellFrameFromRect(cellFrame);
_control_view = controlView;
[controlView lockFocus];
[_buttonCell highlight: YES
withFrame: buttonRect