mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
* Source/NSButtonCell.m (-title): Return @"" instead of nil
* Source/NSButtonCell.m (-alternateTitle): Return @"" instead of nil * Source/NSButtonCell.m (-attributedAlternateTitle): Use [self alternateTitle] instead of accessing _altContents directly to guard against _altContents being nil * Source/NSButtonCell.m (-attributedTitle): Don't return nil. Use [self title] instead of accessing _contents directly to guard against _contents being nil * Source/NSButtonCell.m (-keyEquivalent): Return @"" instead of nil * Source/NSButtonCell.m (-encodeWithCoder): For keyEquivelant and alternateTitle, now that the methods never return nil, instead of checking if they return nil to decide whether to encode them, check if the string length is > 0. * Source/NSToolbarItem.m (-label): Return @"" instead of nil. * Source/NSCell.m (-stringValue): Return @"" instead of nil * Source/NSCell.m (-attributedStringValue): Don't return nil. Use [self stringValue] instead of accessing _contents directly to guard against _contents being nil. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33598 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d919131abb
commit
a15066d183
4 changed files with 64 additions and 10 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2011-07-21 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSButtonCell.m (-title): Return @"" instead of nil
|
||||
* Source/NSButtonCell.m (-alternateTitle): Return @"" instead of nil
|
||||
* Source/NSButtonCell.m (-attributedAlternateTitle): Use
|
||||
[self alternateTitle] instead of accessing _altContents directly to guard
|
||||
against _altContents being nil
|
||||
* Source/NSButtonCell.m (-attributedTitle): Don't return nil. Use
|
||||
[self title] instead of accessing _contents directly to guard against
|
||||
_contents being nil
|
||||
* Source/NSButtonCell.m (-keyEquivalent): Return @"" instead of nil
|
||||
* Source/NSButtonCell.m (-encodeWithCoder):
|
||||
For keyEquivelant and alternateTitle, now that the methods never return
|
||||
nil, instead of checking if they return nil to decide whether to encode them,
|
||||
check if the string length is > 0.
|
||||
* Source/NSToolbarItem.m (-label): Return @"" instead of nil.
|
||||
* Source/NSCell.m (-stringValue): Return @"" instead of nil
|
||||
* Source/NSCell.m (-attributedStringValue): Don't return nil. Use
|
||||
[self stringValue] instead of accessing _contents directly to guard against
|
||||
_contents being nil.
|
||||
|
||||
2011-07-20 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSTextView.m (-view:stringForToolTip:point:userData:):
|
||||
|
|
|
@ -200,6 +200,11 @@ typedef struct _GSButtonCellFlags
|
|||
*/
|
||||
- (NSString*) title
|
||||
{
|
||||
if (nil == _contents)
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
|
||||
if (_cell.contents_is_attributed_string == NO)
|
||||
{
|
||||
// If we have a formatter this is also the string of the _object_value
|
||||
|
@ -216,7 +221,14 @@ typedef struct _GSButtonCellFlags
|
|||
*/
|
||||
- (NSString*) alternateTitle
|
||||
{
|
||||
return _altContents;
|
||||
if (_altContents != nil)
|
||||
{
|
||||
return _altContents;
|
||||
}
|
||||
else
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
}
|
||||
|
||||
- (int) cellAttribute: (NSCellAttribute)aParameter
|
||||
|
@ -371,7 +383,7 @@ typedef struct _GSButtonCellFlags
|
|||
NSAttributedString *attrStr;
|
||||
|
||||
dict = [self _nonAutoreleasedTypingAttributes];
|
||||
attrStr = [[NSAttributedString alloc] initWithString: _altContents
|
||||
attrStr = [[NSAttributedString alloc] initWithString: [self alternateTitle]
|
||||
attributes: dict];
|
||||
RELEASE(dict);
|
||||
|
||||
|
@ -386,7 +398,8 @@ typedef struct _GSButtonCellFlags
|
|||
|
||||
- (NSAttributedString *)attributedTitle
|
||||
{
|
||||
if (_cell.contents_is_attributed_string)
|
||||
if (_cell.contents_is_attributed_string &&
|
||||
nil != _contents)
|
||||
{
|
||||
return (NSAttributedString *)_contents;
|
||||
}
|
||||
|
@ -396,7 +409,7 @@ typedef struct _GSButtonCellFlags
|
|||
NSAttributedString *attrStr;
|
||||
|
||||
dict = [self _nonAutoreleasedTypingAttributes];
|
||||
attrStr = [[NSAttributedString alloc] initWithString: _contents
|
||||
attrStr = [[NSAttributedString alloc] initWithString: [self title]
|
||||
attributes: dict];
|
||||
RELEASE(dict);
|
||||
return AUTORELEASE(attrStr);
|
||||
|
@ -562,7 +575,14 @@ typedef struct _GSButtonCellFlags
|
|||
*/
|
||||
- (NSString*) keyEquivalent
|
||||
{
|
||||
return _keyEquivalent;
|
||||
if (nil == _keyEquivalent)
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
else
|
||||
{
|
||||
return _keyEquivalent;
|
||||
}
|
||||
}
|
||||
|
||||
/**<p>Returns the NSFont of the key equivalent.</p>
|
||||
|
@ -1545,7 +1565,7 @@ typedef struct _GSButtonCellFlags
|
|||
NSImage *image = [self image];
|
||||
NSButtonImageSource *bi = nil;
|
||||
|
||||
if ([self keyEquivalent] != nil)
|
||||
if ([[self keyEquivalent] length] > 0)
|
||||
{
|
||||
[aCoder encodeObject: [self keyEquivalent] forKey: @"NSKeyEquivalent"];
|
||||
}
|
||||
|
@ -1553,7 +1573,7 @@ typedef struct _GSButtonCellFlags
|
|||
{
|
||||
[aCoder encodeObject: [self image] forKey: @"NSNormalImage"];
|
||||
}
|
||||
if ([self alternateTitle] != nil)
|
||||
if ([[self alternateTitle] length] > 0)
|
||||
{
|
||||
[aCoder encodeObject: [self alternateTitle] forKey: @"NSAlternateContents"];
|
||||
}
|
||||
|
|
|
@ -316,6 +316,11 @@ static NSColor *dtxtCol;
|
|||
*/
|
||||
- (NSString*) stringValue
|
||||
{
|
||||
if (nil == _contents)
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
|
||||
if (_cell.contents_is_attributed_string == NO)
|
||||
{
|
||||
// If we have a formatter this is also the string of the _object_value
|
||||
|
@ -1019,7 +1024,8 @@ static NSColor *dtxtCol;
|
|||
}
|
||||
|
||||
/* In all other cases */
|
||||
if (_cell.contents_is_attributed_string)
|
||||
if (_cell.contents_is_attributed_string &&
|
||||
nil != _contents)
|
||||
{
|
||||
return (NSAttributedString *)_contents;
|
||||
}
|
||||
|
@ -1029,7 +1035,7 @@ static NSColor *dtxtCol;
|
|||
NSAttributedString *attrStr;
|
||||
|
||||
dict = [self _nonAutoreleasedTypingAttributes];
|
||||
attrStr = [[NSAttributedString alloc] initWithString: _contents
|
||||
attrStr = [[NSAttributedString alloc] initWithString: [self stringValue]
|
||||
attributes: dict];
|
||||
RELEASE(dict);
|
||||
return AUTORELEASE(attrStr);
|
||||
|
|
|
@ -1282,7 +1282,14 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
|
|||
return [menuItem title];
|
||||
}
|
||||
|
||||
return _label;
|
||||
if (nil != _label)
|
||||
{
|
||||
return _label;
|
||||
}
|
||||
else
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
}
|
||||
|
||||
- (NSSize) maxSize
|
||||
|
|
Loading…
Reference in a new issue