Fix bug where the field editor of an edited combo box cell overlaps

the cell's ellipsis button.
Fix bug where the pop up window of a combo box might stay open when
the user leaves the combo box with the keyboard.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29135 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
wlux 2009-12-17 02:21:56 +00:00
parent 00fb50716f
commit f670165fc2
2 changed files with 21 additions and 10 deletions

View file

@ -1,3 +1,15 @@
2009-12-17 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSComboBoxCell.m (-drawInteriorWithFrame:inView:): Fix
bug where the field editor of an edited combo box cell overlaps
the cell's ellipsis button.
* Source/NSComboBoxCell.m (-endEditing): Make sure the pop up
window is closed when editing ends.
* Source/NSComboBoxCell.m (-validateSelection): Remove obsolete
workaround code.
2009-12-17 Wolfgang Lux <wolfgang.lux@gmail.com> 2009-12-17 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSCell.m (-wraps, -setWraps:, -setLineBreakMode:, * Source/NSCell.m (-wraps, -setWraps:, -setLineBreakMode:,

View file

@ -711,12 +711,6 @@ static GSComboWindow *gsWindow = nil;
[_cell setStringValue: [_cell _stringValueAtIndex: [_cell setStringValue: [_cell _stringValueAtIndex:
[_cell indexOfSelectedItem]]]; [_cell indexOfSelectedItem]]];
// Will update the editor when needed // Will update the editor when needed
// FIXME: Because NSCell doesn't behave correctly the line just over has
// no effect, to correct this fact, the code below is needed.
[textObject setString: [_cell _stringValueAtIndex:
[_cell indexOfSelectedItem]]];
// End of the code to remove
} }
if (textObject != nil) if (textObject != nil)
@ -1518,21 +1512,21 @@ static inline NSRect buttonCellFrameFromRect(NSRect cellRect)
return mySize; return mySize;
} }
- (void) drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView - (void) drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{ {
NSRect rect = cellFrame; NSRect rect = cellFrame;
// FIX ME: Is this test case below with the method call really needed ? // FIX ME: Is this test case below with the method call really needed ?
if ([GSCurrentContext() isDrawingToScreen]) if ([GSCurrentContext() isDrawingToScreen])
{ {
[super drawWithFrame: rect [super drawInteriorWithFrame: textCellFrameFromRect(rect)
inView: controlView]; inView: controlView];
[_buttonCell drawWithFrame: buttonCellFrameFromRect(rect) [_buttonCell drawWithFrame: buttonCellFrameFromRect(rect)
inView: controlView]; inView: controlView];
} }
else else
{ {
[super drawWithFrame: rect inView: controlView]; [super drawInteriorWithFrame: rect inView: controlView];
} }
// Used by GSComboWindow to appear in the right position // Used by GSComboWindow to appear in the right position
@ -1801,6 +1795,11 @@ static inline NSRect buttonCellFrameFromRect(NSRect cellRect)
- (void) endEditing: (NSText *)editor - (void) endEditing: (NSText *)editor
{ {
/* Close the pop up if it is still open. This may happen, e.g., when the
user presses the Tab key to shift focus to a different cell or view. */
if (_popup)
[_popup onWindowEdited: nil];
[super endEditing: editor]; [super endEditing: editor];
[nc removeObserver: self name: NSTextDidChangeNotification object: editor]; [nc removeObserver: self name: NSTextDidChangeNotification object: editor];
[nc removeObserver: self [nc removeObserver: self