1 #import "ITStatusItem.h"
3 /*************************************************************************/
5 #pragma mark EVIL HACKERY
6 /*************************************************************************/
8 // This stuff is actually implemented by the AppKit.
9 // We declare it here to cancel out warnings.
11 @interface NSStatusBarButton : NSButton
14 @interface NSStatusItem (HACKHACKHACKHACK)
15 - (id) _initInStatusBar:(NSStatusBar*)statusBar
16 withLength:(float)length
17 withPriority:(int)priority;
18 - (NSStatusBarButton*) _button;
21 /*************************************************************************/
23 #pragma mark PRIVATE METHOD DECLARATIONS
24 /*************************************************************************/
26 @interface ITStatusItem (Private)
27 - (void) setSmallTitle:(NSString*)title;
30 @implementation ITStatusItem
32 /*************************************************************************/
34 #pragma mark INITIALIZATION METHODS
35 /*************************************************************************/
37 - (id)initWithStatusBar:(NSStatusBar*)statusBar withLength:(float)length
39 if ( ( self = [super _initInStatusBar:statusBar
41 withPriority:1000] ) ) {
43 //Eliminate the fucking shadow...
44 [[[self _button] cell] setType:NSNullCellType];
46 //Be something other than a dumbshit about highlighting...
47 [self setHighlightMode:YES];
53 /*************************************************************************/
55 #pragma mark ACCESSOR METHODS
56 /*************************************************************************/
58 - (NSImage*) alternateImage {
59 return [[self _button] alternateImage];
62 - (void) setAlternateImage:(NSImage*)image {
63 [[self _button] setAlternateImage:image];
66 - (void) setImage:(NSImage*)image {
67 [super setImage:image];
69 [self setSmallTitle:[self title]];
75 return [[self attributedTitle] string];
81 - (void) setTitle:(NSString*)title {
82 [super setTitle:title];
84 [self setSmallTitle:[self title]];
88 /*************************************************************************/
90 #pragma mark PRIVATE METHODS
91 /*************************************************************************/
93 - (void) setSmallTitle:(NSString*)title {
94 NSAttributedString *attrTitle = [[NSAttributedString alloc] initWithString:title attributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"Lucida Grande" size:12.0] forKey:NSFontAttributeName]];
95 [self setAttributedTitle:attrTitle];