Removed all direct usage of ivar _contents. Implemented

[attributedAlternateTitle] and use this in [cellSize] and
[drawInteriorWithFrame:inView:].


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14953 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2002-11-07 23:34:08 +00:00
parent e3aa46c612
commit 6f075a0a20

View file

@ -95,8 +95,6 @@
{ {
[super initImageCell: anImage]; [super initImageCell: anImage];
_contents = nil;
return [self _init]; return [self _init];
} }
@ -258,7 +256,15 @@
- (NSAttributedString *)attributedAlternateTitle - (NSAttributedString *)attributedAlternateTitle
{ {
// TODO // TODO
return nil; NSDictionary *dict;
NSAttributedString *attrStr;
dict = [self _nonAutoreleasedTypingAttributes];
attrStr = [[NSAttributedString alloc] initWithString: _altContents
attributes: dict];
RELEASE(dict);
return AUTORELEASE(attrStr);
} }
- (void)setAttributedAlternateTitle:(NSAttributedString *)aString - (void)setAttributedAlternateTitle:(NSAttributedString *)aString
@ -631,7 +637,7 @@
unsigned mask; unsigned mask;
NSImage *imageToDisplay; NSImage *imageToDisplay;
NSRect imageRect; NSRect imageRect;
NSString *titleToDisplay; NSAttributedString *titleToDisplay;
NSRect titleRect; NSRect titleRect;
NSSize imageSize = {0, 0}; NSSize imageSize = {0, 0};
NSSize titleSize = {0, 0}; NSSize titleSize = {0, 0};
@ -698,15 +704,19 @@
{ {
imageToDisplay = _altImage; imageToDisplay = _altImage;
if (!imageToDisplay) if (!imageToDisplay)
imageToDisplay = _cell_image; {
titleToDisplay = _altContents; imageToDisplay = _cell_image;
if (titleToDisplay == nil || [titleToDisplay isEqual: @""]) }
titleToDisplay = _contents; titleToDisplay = [self attributedAlternateTitle];
if (titleToDisplay == nil || [titleToDisplay length] == 0)
{
titleToDisplay = [self attributedTitle];
}
} }
else else
{ {
imageToDisplay = _cell_image; imageToDisplay = _cell_image;
titleToDisplay = _contents; titleToDisplay = [self attributedTitle];
} }
if (imageToDisplay) if (imageToDisplay)
@ -722,7 +732,7 @@
if (titleToDisplay && (ipos == NSImageAbove || ipos == NSImageBelow)) if (titleToDisplay && (ipos == NSImageAbove || ipos == NSImageBelow))
{ {
titleSize = [self _sizeText: titleToDisplay]; titleSize = [titleToDisplay size];
} }
if (flippedView == YES) if (flippedView == YES)
@ -875,7 +885,7 @@
} }
if (titleToDisplay != nil) if (titleToDisplay != nil)
{ {
[self _drawText: titleToDisplay inFrame: titleRect]; [self _drawAttributedText: titleToDisplay inFrame: titleRect];
} }
if (_cell.shows_first_responder if (_cell.shows_first_responder
@ -898,7 +908,7 @@
NSSize borderSize; NSSize borderSize;
unsigned mask; unsigned mask;
NSImage *imageToDisplay; NSImage *imageToDisplay;
NSString *titleToDisplay; NSAttributedString *titleToDisplay;
NSSize imageSize; NSSize imageSize;
NSSize titleSize; NSSize titleSize;
@ -925,16 +935,16 @@
{ {
imageToDisplay = _cell_image; imageToDisplay = _cell_image;
} }
titleToDisplay = _altContents; titleToDisplay = [self attributedAlternateTitle];
if (titleToDisplay == nil || [titleToDisplay isEqual: @""]) if (titleToDisplay == nil || [titleToDisplay length] == 0)
{ {
titleToDisplay = _contents; titleToDisplay = [self attributedTitle];
} }
} }
else else
{ {
imageToDisplay = _cell_image; imageToDisplay = _cell_image;
titleToDisplay = _contents; titleToDisplay = [self attributedTitle];
} }
if (imageToDisplay) if (imageToDisplay)
@ -948,7 +958,7 @@
if (titleToDisplay != nil) if (titleToDisplay != nil)
{ {
titleSize = [self _sizeText: titleToDisplay]; titleSize = [titleToDisplay size];
} }
else else
{ {