Added a commented-out line, template for when making builds for beta testers.
[MenuTunes.git] / MenuTunesView.m
index 824683b..08e7ceb 100755 (executable)
@@ -1,13 +1,6 @@
-//
-//  MenuTunesView.m
-//  MenuTunes
-//
-//  Created by Kent Sutherland on Tue Nov 19 2002.
-//  Copyright (c) 2002 Kent Sutherland. All rights reserved.
-//
-
 #import "MenuTunesView.h"
 
+extern NSColor* _NSGetThemePartColorPattern(int, int, int);
 
 @implementation MenuTunesView
 
     {
         image = [NSImage imageNamed:@"menu"];
         altImage = [NSImage imageNamed:@"selected_image"];
-       curImage = image;
+        mouseIsPressed = NO;
     }
     return self;
 }
 
 - (void)drawRect:(NSRect)rect
 {
-    [curImage compositeToPoint:NSMakePoint(0, 0) operation:NSCompositeSourceOver];
+    NSImage *icon;
+    NSColor *background;
+    
+    if ( mouseIsPressed ) {
+        icon = altImage;
+        background = _NSGetThemePartColorPattern(44, 2, 0);
+    } else {
+        icon = image;
+        background = [NSColor clearColor];
+    }
+    [background set];
+    NSRectFill(rect);
+    [icon compositeToPoint:NSMakePoint(((rect.size.width - [icon size].width) / 2), 0)
+                 operation:NSCompositeSourceOver];
 }
 
 - (void)mouseDown:(NSEvent *)event
 {
-    curImage = altImage;
+    mouseIsPressed = YES;
     [self setNeedsDisplay:YES];
     [super mouseDown:event];
 }
 
 - (void)mouseUp:(NSEvent *)event
 {
-    curImage = image;
+    mouseIsPressed = NO;
     [self setNeedsDisplay:YES];
     [super mouseUp:event];
 }