A documentation tweak on ITStatusItem.
[ITKit.git] / ITStatusItem.m
index 3e2ce57..1b51ca2 100755 (executable)
@@ -1,33 +1,58 @@
-//
-//  ITStatusItem.m
-//  iThinkAppKit
-//
-//  Created by Joseph Spiros on Fri Dec 06 2002.
-//  Copyright (c) 2002 iThink Software. All rights reserved.
-//
-
 #import "ITStatusItem.h"
 
+/*************************************************************************/
+#pragma mark -
+#pragma mark EVIL HACKERY
+/*************************************************************************/
+
+// This stuff is actually implemented by the AppKit.
+// We declare it here to cancel out warnings.
+
+@interface NSStatusBarButton : NSButton
+@end
+
+@interface NSStatusItem (HACKHACKHACKHACK)
+- (id) _initInStatusBar:(NSStatusBar*)statusBar
+             withLength:(float)length
+           withPriority:(int)priority;
+- (NSStatusBarButton*) _button;
+@end
+
 
 @implementation ITStatusItem
 
-- (id)initWithStatusBar:(NSStatusBar*)statusBar withLength:(float)length {
-    statusItem = [statusBar statusItemWithLength:length];
+/*************************************************************************/
+#pragma mark -
+#pragma mark INITIALIZATION METHODS
+/*************************************************************************/
+
+- (id)initWithStatusBar:(NSStatusBar*)statusBar withLength:(float)length
+{
+    if ( ( self = [super _initInStatusBar:statusBar
+                               withLength:length
+                             withPriority:1000] ) ) {
+                             
+        //Eliminate the fucking shadow...
+        [[[self _button] cell] setType:NSNullCellType];
+        
+        //Be something other than a dumbshit about highlighting...
+        [self setHighlightMode:YES];
+    }
+    return self;
 }
 
-- (NSStatusItem*) statusItem {
-    return statusItem;
-}
+
+/*************************************************************************/
+#pragma mark -
+#pragma mark ACCESSOR METHODS
+/*************************************************************************/
 
 - (NSImage*) alternateImage {
-    return [[statusItem _button] alternateImage];
+    return [[self _button] alternateImage];
 }
 
 - (void) setAlternateImage:(NSImage*)image {
-    if ([[[[statusItem _button] cell] super] type] != 0) {
-        [[[statusItem _button] cell] setType:0];
-    }
-    [[statusItem _button] setAlternateImage:image];
+    [[self _button] setAlternateImage:image];
 }
 
 @end