1 #import "ITStatusItem.h"
3 @class NSStatusBarButton;
5 @interface NSStatusItem (ITStatusItemHacks)
6 - (id)_initInStatusBar:(NSStatusBar *)statusBar withLength:(float)length withPriority:(int)priority;
7 - (NSStatusBarButton *)_button;
10 @protocol _ITStatusItemNSStatusItemPantherCompatability
11 - (void)setAlternateImage:(NSImage *)image;
12 - (NSImage *)alternateImage;
15 @implementation ITStatusItem
17 static BOOL _ITStatusItemShouldKillShadow = NO;
20 if ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_1) && (floor(NSAppKitVersionNumber) <= 663.6)) {
21 _ITStatusItemShouldKillShadow = YES;
25 - (id)initWithStatusBar:(NSStatusBar *)statusBar withLength:(float)length {
26 return [self _initInStatusBar:statusBar withLength:length withPriority:1000];
29 - (id)_initInStatusBar:(NSStatusBar *)statusBar withLength:(float)length withPriority:(int)priority {
30 if ((self = [super _initInStatusBar:statusBar withLength:length withPriority:priority])) {
31 if (_ITStatusItemShouldKillShadow) {
32 [[(NSButton *)[self _button] cell] setType:NSNullCellType];
34 [self setHighlightMode:YES];
39 - (NSImage *)alternateImage {
40 if ([super respondsToSelector:@selector(alternateImage)]) {
41 return [(id <_ITStatusItemNSStatusItemPantherCompatability>)super alternateImage];
43 return [(NSButton *)[self _button] alternateImage];
46 - (void)setAlternateImage:(NSImage*)image {
47 if ([super respondsToSelector:@selector(setAlternateImage:)]) {
48 [(id <_ITStatusItemNSStatusItemPantherCompatability>)super setAlternateImage:image];
51 [(NSButton *)[self _button] setAlternateImage:image];