Add ivar in_editing, which gets set, during the editing/selection of the cell.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25460 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2007-09-06 21:30:13 +00:00
parent 852a7aff1d
commit 94ad6e600e
4 changed files with 22 additions and 9 deletions

View file

@ -1,3 +1,13 @@
2007-09-06 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSCell.h: Add ivar in_editing, which gets set,
during the editing/selection of the cell.
* Source/NSCell.m (-_setupTextWithFrame:..., endEditing:): Set/
clear the in_editing flag.
* Source/NSActionCell.m (-objectValue, -attributedStringValue,
-intValue, -floatValue, -doubleValue, -stringValue): Check flag
in_editing before validating the editing.
2007-09-05 Nicolas Roard <nicolas@roard.com>
* Source/NSView.m (-scrollRect:by:): reversed the coordinates
@ -5,7 +15,7 @@
* Source/NSClipView.m (-setBoundsOrigin): reversed the coordinates
of the call to scrollRect:by:, to match OSX behaviour.
2007-09-06 Fred Kiefer <FredKiefer@gmx.de>
2007-09-05 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSWindow.m (-sendEvent:, -selectKeyViewFollowingView:,
-selectKeyViewPrecedingView:, -selectNextKeyView:,

View file

@ -151,7 +151,7 @@ enum {
unsigned allows_undo: 1;
unsigned line_break_mode: 3; // 6 values
// total 19 bits. 4 bits extension, 9 bits left.
// total 20 bits. 4 bits extension, 8 bits left.
int state: 2; // 3 values but one negative
unsigned mnemonic_location: 8;
unsigned control_tint: 3;
@ -163,9 +163,11 @@ enum {
unsigned subclass_bool_two: 1;
unsigned subclass_bool_three: 1;
unsigned subclass_bool_four: 1;
// Set while the cell is edited/selected
unsigned in_editing: 1;
} _cell;
unsigned int _mouse_down_flags;
unsigned int _action_mask;
unsigned int _action_mask;
NSFormatter *_formatter;
NSMenu *_menu;
id _represented_object;

View file

@ -146,7 +146,7 @@ static Class controlClass;
*/
- (id)objectValue
{
if (_control_view)
if (_cell.in_editing && _control_view)
if ([_control_view isKindOfClass: controlClass])
[(NSControl *)_control_view validateEditing];
return [super objectValue];
@ -157,7 +157,7 @@ static Class controlClass;
*/
- (NSAttributedString*)attributedStringValue
{
if (_control_view)
if (_cell.in_editing && _control_view)
if ([_control_view isKindOfClass: controlClass])
[(NSControl *)_control_view validateEditing];
return [super attributedStringValue];
@ -168,7 +168,7 @@ static Class controlClass;
*/
- (NSString *)stringValue
{
if (_control_view)
if (_cell.in_editing && _control_view)
if ([_control_view isKindOfClass: controlClass])
[(NSControl *)_control_view validateEditing];
return [super stringValue];
@ -179,7 +179,7 @@ static Class controlClass;
*/
- (double)doubleValue
{
if (_control_view)
if (_cell.in_editing && _control_view)
if ([_control_view isKindOfClass: controlClass])
[(NSControl *)_control_view validateEditing];
return [super doubleValue];
@ -190,7 +190,7 @@ static Class controlClass;
*/
- (float)floatValue
{
if (_control_view)
if (_cell.in_editing && _control_view)
if ([_control_view isKindOfClass: controlClass])
[(NSControl *)_control_view validateEditing];
return [super floatValue];

View file

@ -2144,6 +2144,7 @@ static NSColor *shadowCol;
[textObject setDelegate: anObject];
[[controlView window] makeFirstResponder: textObject];
_cell.in_editing = YES;
}
/**<p>Ends any text editing. This method sets the text object's delegate
@ -2154,9 +2155,9 @@ static NSColor *shadowCol;
{
NSClipView *clipView;
_cell.in_editing = NO;
[textObject setString: @""];
[textObject setDelegate: nil];
clipView = (NSClipView*)[textObject superview];
[textObject removeFromSuperview];