X-Git-Url: http://git.ithinksw.org/ITKit.git/blobdiff_plain/32440a12defde03dcc52e42cff4aa6300d7d96fb..475a1064c9d3637e7fae211d7a18d411c1178af0:/ITStatusItem.m diff --git a/ITStatusItem.m b/ITStatusItem.m index 5e517a0..bf1d18f 100755 --- a/ITStatusItem.m +++ b/ITStatusItem.m @@ -12,21 +12,26 @@ @end @interface NSStatusItem (HACKHACKHACKHACK) -- (id) _initInStatusBar:(NSStatusBar*)statusBar +- (id)_initInStatusBar:(NSStatusBar*)statusBar withLength:(float)length withPriority:(int)priority; -- (NSStatusBarButton*) _button; +- (NSStatusBarButton*)_button; @end + /*************************************************************************/ #pragma mark - #pragma mark PRIVATE METHOD DECLARATIONS /*************************************************************************/ @interface ITStatusItem (Private) -- (void) setSmallTitle:(NSString*)title; +- (void)setImage:(NSImage*)image; +- (NSString*) title; +- (void)setTitle:(NSString*)title; +- (void)setSmallTitle:(NSString*)title; @end + @implementation ITStatusItem /*************************************************************************/ @@ -55,45 +60,39 @@ #pragma mark ACCESSOR METHODS /*************************************************************************/ -- (NSImage*) alternateImage { +- (NSImage*)alternateImage { return [[self _button] alternateImage]; } -- (void) setAlternateImage:(NSImage*)image { +- (void)setAlternateImage:(NSImage*)image { [[self _button] setAlternateImage:image]; } -- (void) setImage:(NSImage*)image { +- (void)setImage:(NSImage*)image { [super setImage:image]; - if ([self title]) { - [self setSmallTitle:[self title]]; - } + if ( [self title] ) { + [self setTitle:[self title]]; + } } -- (NSString*) title { - if ([self image]) { - return [[self attributedTitle] string]; +- (void)setTitle:(NSString*)title { + if ( [self image] && (title != nil) ) { + [self setSmallTitle:title]; } else { - [super title]; + [super setTitle:title]; } } -- (void) setTitle:(NSString*)title { - [super setTitle:title]; - if ([self image]) { - [self setSmallTitle:[self title]]; - } -} /*************************************************************************/ #pragma mark - #pragma mark PRIVATE METHODS /*************************************************************************/ -- (void) setSmallTitle:(NSString*)title { - NSAttributedString *attrTitle = [[NSAttributedString alloc] initWithString:title attributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"Lucida Grande" size:12.0] forKey:NSFontAttributeName]]; +- (void)setSmallTitle:(NSString*)title { + NSAttributedString *attrTitle = [[[NSAttributedString alloc] initWithString:title attributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"LucidaGrande" size:12.0] forKey:NSFontAttributeName]] autorelease]; [self setAttributedTitle:attrTitle]; - [attrTitle release]; } + @end