Fixes, improvements of editing

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5147 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
nico 1999-11-09 23:08:25 +00:00
parent f05e6a54fd
commit 29ac8fa334

View file

@ -493,7 +493,19 @@ static NSColor *shadowCol;
*/ */
- (NSText*) setUpFieldEditorAttributes: (NSText*)textObject - (NSText*) setUpFieldEditorAttributes: (NSText*)textObject
{ {
return nil; if ([self isEnabled])
[textObject setTextColor: txtCol];
else
[textObject setTextColor: dtxtCol];
if (cell_highlighted)
[textObject setBackgroundColor: hbgCol];
else
[textObject setBackgroundColor: bgCol];
[textObject setFont: [self font]];
[textObject setAlignment: [self alignment]];
return textObject;
} }
- (void) editWithFrame: (NSRect)aRect - (void) editWithFrame: (NSRect)aRect
@ -506,13 +518,12 @@ static NSColor *shadowCol;
(cell_type != NSTextCellType)) (cell_type != NSTextCellType))
return; return;
textObject = [self setUpFieldEditorAttributes: textObject];
[textObject setDelegate: anObject]; [textObject setDelegate: anObject];
aRect.origin.y -= 1;
[textObject setFrame: aRect]; [textObject setFrame: aRect];
[textObject setText: [self stringValue]]; [textObject setText: [self stringValue]];
[controlView addSubview:textObject]; [controlView addSubview:textObject];
[textObject display];
[[controlView window] makeFirstResponder: textObject]; [[controlView window] makeFirstResponder: textObject];
@ -530,9 +541,10 @@ static NSColor *shadowCol;
[textObject retain]; [textObject retain];
[textObject removeFromSuperview]; [textObject removeFromSuperview];
[self setStringValue: [textObject text]]; [self setStringValue: [textObject text]];
[textObject setString:@""]; [textObject setString: @""];
} }
// TODO: Check, what exactly this method is supposed to do?
- (void) selectWithFrame: (NSRect)aRect - (void) selectWithFrame: (NSRect)aRect
inView: (NSView *)controlView inView: (NSView *)controlView
editor: (NSText *)textObject editor: (NSText *)textObject
@ -544,16 +556,13 @@ static NSColor *shadowCol;
(cell_type != NSTextCellType)) (cell_type != NSTextCellType))
return; return;
[[controlView window] makeFirstResponder: textObject]; textObject = [self setUpFieldEditorAttributes: textObject];
[textObject setFrame: aRect]; [textObject setFrame: aRect];
[textObject setAlignment: text_align];
[textObject setText: [self stringValue]]; [textObject setText: [self stringValue]];
[textObject setDelegate: anObject]; [textObject setDelegate: anObject];
[textObject setSelectedRange: NSMakeRange (selStart, selLength)];
[controlView addSubview: textObject]; [controlView addSubview: textObject];
[controlView lockFocus]; [[controlView window] makeFirstResponder: textObject];
NSEraseRect(aRect);
[controlView unlockFocus];
[textObject display]; [textObject display];
} }