* Source/NSTextField.m (-mouseDown:): Check if the control is

disabled. (bug #13916)
        (-acceptFirstResponder:): Return no if disabled.
        (-acceptFirstMouse:): Ditto.
        * Source/NSTextFieldCell.m (-setEnabled:): Reset the string 
	value to an empty string if disabling.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23574 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Matt Rice 2006-09-20 20:04:31 +00:00
parent 9d21170e10
commit 8dce386f4d
3 changed files with 22 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2006-09-20 Matt Rice <ratmice@yahoo.com>
* Source/NSTextField.m (-mouseDown:): Check if the control is
disabled. (bug #13916)
(-acceptFirstResponder:): Return no if disabled.
(-acceptFirstMouse:): Ditto.
* Source/NSTextFieldCell.m (-setEnabled:): Reset the string value
to an empty string if disabling.
2006-09-20 Richard Frith-Macdonald <rfm@gnu.org> 2006-09-20 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSWindowDecorationView.m: ([removeSubview:]) override to * Source/GSWindowDecorationView.m: ([removeSubview:]) override to

View file

@ -338,7 +338,7 @@ static Class textFieldCellClass;
// //
- (void) mouseDown: (NSEvent*)theEvent - (void) mouseDown: (NSEvent*)theEvent
{ {
if ([self isSelectable] == NO) if ([self isSelectable] == NO || [self isEnabled] == NO)
{ {
[super mouseDown: theEvent]; [super mouseDown: theEvent];
return; return;
@ -392,7 +392,7 @@ static Class textFieldCellClass;
- (BOOL) acceptsFirstMouse: (NSEvent *)aEvent - (BOOL) acceptsFirstMouse: (NSEvent *)aEvent
{ {
return [self isEditable]; return [self isEditable] && [self isEnabled];
} }
/** <p>Returns whether the NSTextField accepts to be the first responder. /** <p>Returns whether the NSTextField accepts to be the first responder.
@ -405,7 +405,7 @@ static Class textFieldCellClass;
// we do not accept first responder if there is already a // we do not accept first responder if there is already a
// _text_object, else it would make the _text_object resign // _text_object, else it would make the _text_object resign
// and end editing // and end editing
return (_text_object == nil) && [self isSelectable]; return (_text_object == nil) && [self isSelectable] && [self isEnabled];
} }
- (BOOL) becomeFirstResponder - (BOOL) becomeFirstResponder

View file

@ -176,6 +176,16 @@ static NSColor *txtCol;
return _text_color; return _text_color;
} }
/** <p>Enables or Disables the cell. If disabling the cell, resets its string
value to an empty string.</p>
*/
- (void) setEnabled:(BOOL)flag
{
[super setEnabled:flag];
if (flag == NO)
[self setStringValue:@""];
}
- (NSText *) setUpFieldEditorAttributes: (NSText *)textObject - (NSText *) setUpFieldEditorAttributes: (NSText *)textObject
{ {
textObject = [super setUpFieldEditorAttributes: textObject]; textObject = [super setUpFieldEditorAttributes: textObject];