* Source/NSCell.m: Change to implement 10.3 and later behavior for

the method setStringValue: as documented in Apple's documentation
	for the method.  This behavior was observed on Cocoa under 
	Mac OS 10.5.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27874 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2009-02-16 00:31:23 +00:00
parent a96c94e755
commit 5efe558c2b
2 changed files with 40 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2009-02-15 19:38-EST Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSCell.m: Change to implement 10.3 and later behavior for
the method setStringValue: as documented in Apple's documentation
for the method. This behavior was observed on Cocoa under
Mac OS 10.5.
2009-02-12 Riccardo Mottola <rmottola@users.sf.net>
* Source/NSSavePanel.m: Return autoreleased copy of the directory

View file

@ -329,10 +329,23 @@ static NSColor *dtxtCol;
}
else
{
newContents = [_object_value description];
_cell.contents_is_attributed_string = NO;
_cell.has_valid_object_value = YES;
}
///
// If the thing that was assigned is not a string, but
// responds to stringValue then get that.
///
if([_object_value respondsToSelector: @selector(attributedStringValue)])
{
newContents = [_object_value attributedStringValue];
}
else if([_object_value respondsToSelector: @selector(stringValue)])
{
newContents = [_object_value stringValue];
}
newContents = [_object_value description];
_cell.contents_is_attributed_string = NO;
_cell.has_valid_object_value = YES;
}
}
else
{
@ -420,6 +433,22 @@ static NSColor *dtxtCol;
if (_formatter == nil)
{
if([string isKindOfClass: [NSString class]] == NO)
{
///
// If the thing that was assigned is not a string, but
// responds to stringValue then get that.
///
if([string respondsToSelector: @selector(attributedStringValue)])
{
string = (NSString *)[(id)string attributedStringValue];
}
else if([string respondsToSelector: @selector(stringValue)])
{
string = (NSString *)[(id)string stringValue];
}
}
ASSIGN (_contents, string);
ASSIGN (_object_value, string);
_cell.has_valid_object_value = YES;