mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 16:21:56 +00:00
Fix NSActionCell implementation so that -setObjectValue: and
-setStringValue: have an effect while the cell is edited. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29010 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
840fb95699
commit
b34a156dd0
4 changed files with 61 additions and 29 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,7 +1,15 @@
|
||||||
|
2009-11-14 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSCell.m(-_setupTextWithFrame:inView:editor:delegate:range:,
|
||||||
|
-_updateFieldEditor):
|
||||||
|
* Source/NSActionCell.m (-setObjectValue:, -setStringValue:):
|
||||||
|
Fix NSActionCell implementation so that -setObjectValue: and
|
||||||
|
-setStringValue: have an effect while the cell is edited.
|
||||||
|
|
||||||
2009-11-14 Hans Baier <hansfbaier@googlemail.com>
|
2009-11-14 Hans Baier <hansfbaier@googlemail.com>
|
||||||
|
|
||||||
* Source/GSThemeDrawing.m: fix bug introduced in last commit
|
* Source/GSThemeDrawing.m: fix bug introduced in last commit
|
||||||
(progress bar fills the whole area)
|
(progress bar fills the whole area)
|
||||||
|
|
||||||
2009-11-14 Hans Baier <hansfbaier@googlemail.com>
|
2009-11-14 Hans Baier <hansfbaier@googlemail.com>
|
||||||
|
|
||||||
|
|
|
@ -491,6 +491,7 @@ enum {
|
||||||
inView: (NSView*)controlView;
|
inView: (NSView*)controlView;
|
||||||
- (void) _drawFocusRingWithFrame: (NSRect)cellFrame
|
- (void) _drawFocusRingWithFrame: (NSRect)cellFrame
|
||||||
inView: (NSView*)controlView;
|
inView: (NSView*)controlView;
|
||||||
|
- (void) _updateFieldEditor: (NSText*)textObject;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // _GNUstep_H_NSCell
|
#endif // _GNUstep_H_NSCell
|
||||||
|
|
|
@ -215,8 +215,17 @@ static Class controlClass;
|
||||||
{
|
{
|
||||||
[super setObjectValue: anObject];
|
[super setObjectValue: anObject];
|
||||||
if (_control_view)
|
if (_control_view)
|
||||||
if ([_control_view isKindOfClass: controlClass])
|
{
|
||||||
[(NSControl *)_control_view updateCell: self];
|
if ([_control_view isKindOfClass: controlClass])
|
||||||
|
{
|
||||||
|
if (_cell.in_editing)
|
||||||
|
{
|
||||||
|
[self _updateFieldEditor:
|
||||||
|
[(NSControl *)_control_view currentEditor]];
|
||||||
|
}
|
||||||
|
[(NSControl *)_control_view updateCell: self];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,8 +237,17 @@ static Class controlClass;
|
||||||
{
|
{
|
||||||
[super setStringValue: aString];
|
[super setStringValue: aString];
|
||||||
if (_control_view)
|
if (_control_view)
|
||||||
if ([_control_view isKindOfClass: controlClass])
|
{
|
||||||
[(NSControl *)_control_view updateCell: self];
|
if ([_control_view isKindOfClass: controlClass])
|
||||||
|
{
|
||||||
|
if (_cell.in_editing)
|
||||||
|
{
|
||||||
|
[self _updateFieldEditor:
|
||||||
|
[(NSControl *)_control_view currentEditor]];
|
||||||
|
}
|
||||||
|
[(NSControl *)_control_view updateCell: self];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2129,30 +2129,7 @@ static NSColor *dtxtCol;
|
||||||
[textObject setMaxSize: maxRect.size];
|
[textObject setMaxSize: maxRect.size];
|
||||||
[textObject setMinSize: titleRect.size];
|
[textObject setMinSize: titleRect.size];
|
||||||
|
|
||||||
if (_formatter != nil)
|
[self _updateFieldEditor: textObject];
|
||||||
{
|
|
||||||
NSString *contents;
|
|
||||||
|
|
||||||
contents = [_formatter editingStringForObjectValue: _object_value];
|
|
||||||
if (contents == nil)
|
|
||||||
{
|
|
||||||
contents = _contents;
|
|
||||||
}
|
|
||||||
[textObject setText: contents];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_cell.contents_is_attributed_string == NO)
|
|
||||||
{
|
|
||||||
[textObject setText: _contents];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// The curent text has size 0, so this replaces the whole text.
|
|
||||||
[textObject replaceCharactersInRange: NSMakeRange(0, 0)
|
|
||||||
withAttributedString: (NSAttributedString *)_contents];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[textObject sizeToFit];
|
[textObject sizeToFit];
|
||||||
[textObject setSelectedRange: selection];
|
[textObject setSelectedRange: selection];
|
||||||
|
@ -2876,4 +2853,32 @@ static NSColor *dtxtCol;
|
||||||
return (_action_mask & eventTypeMask);
|
return (_action_mask & eventTypeMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) _updateFieldEditor: (NSText*)textObject
|
||||||
|
{
|
||||||
|
if (_formatter != nil)
|
||||||
|
{
|
||||||
|
NSString *contents;
|
||||||
|
|
||||||
|
contents = [_formatter editingStringForObjectValue: _object_value];
|
||||||
|
if (contents == nil)
|
||||||
|
{
|
||||||
|
contents = _contents;
|
||||||
|
}
|
||||||
|
[textObject setText: contents];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_cell.contents_is_attributed_string == NO)
|
||||||
|
{
|
||||||
|
[textObject setText: _contents];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSRange range = NSMakeRange(0, [[textObject string] length]);
|
||||||
|
[textObject replaceCharactersInRange: range
|
||||||
|
withAttributedString: (NSAttributedString *)_contents];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue