streamline action button code

This commit is contained in:
Mitchell Livingston 2007-01-02 19:51:02 +00:00
parent afb50f6997
commit 81292cd568
5 changed files with 13 additions and 42 deletions

View File

@ -111,7 +111,6 @@
A24600510A6DCE6600D19088 /* SpeedLimitButtonBlue.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004F0A6DCE6600D19088 /* SpeedLimitButtonBlue.png */; };
A24600520A6DCE6600D19088 /* SpeedLimitButtonGraphite.png in Resources */ = {isa = PBXBuildFile; fileRef = A24600500A6DCE6600D19088 /* SpeedLimitButtonGraphite.png */; };
A24999230B49F1B5001EADA3 /* ActionPopUpButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */; };
A24999440B49F5AD001EADA3 /* ActionPopUpButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A24999420B49F5AD001EADA3 /* ActionPopUpButtonCell.m */; };
A24F19080A3A790800C9C145 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; };
A24F19210A3A796800C9C145 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; };
A253F6F30A698970008EE24F /* FilterBarBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F6F20A698970008EE24F /* FilterBarBackground.png */; };
@ -313,8 +312,6 @@
A24600500A6DCE6600D19088 /* SpeedLimitButtonGraphite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = SpeedLimitButtonGraphite.png; path = macosx/Images/SpeedLimitButtonGraphite.png; sourceTree = "<group>"; };
A24999200B49F1B5001EADA3 /* ActionPopUpButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ActionPopUpButton.h; path = macosx/ActionPopUpButton.h; sourceTree = "<group>"; };
A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ActionPopUpButton.m; path = macosx/ActionPopUpButton.m; sourceTree = "<group>"; };
A24999420B49F5AD001EADA3 /* ActionPopUpButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ActionPopUpButtonCell.m; path = macosx/ActionPopUpButtonCell.m; sourceTree = "<group>"; };
A24999430B49F5AD001EADA3 /* ActionPopUpButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ActionPopUpButtonCell.h; path = macosx/ActionPopUpButtonCell.h; sourceTree = "<group>"; };
A24F19070A3A790800C9C145 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = macosx/Sparkle.framework; sourceTree = "<group>"; };
A253F6F20A698970008EE24F /* FilterBarBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterBarBackground.png; path = macosx/Images/FilterBarBackground.png; sourceTree = "<group>"; };
A253F7080A6990EB008EE24F /* FilterButtonOverMain.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterButtonOverMain.png; path = macosx/Images/FilterButtonOverMain.png; sourceTree = "<group>"; };
@ -467,8 +464,6 @@
A2AA579B0ADFCAB400CA59F6 /* PiecesImageView.m */,
A24999200B49F1B5001EADA3 /* ActionPopUpButton.h */,
A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */,
A24999420B49F5AD001EADA3 /* ActionPopUpButtonCell.m */,
A24999430B49F5AD001EADA3 /* ActionPopUpButtonCell.h */,
);
name = Sources;
sourceTree = "<group>";
@ -934,7 +929,6 @@
A25E74660AF5097D006F11AE /* ExpandedPathToIconTransformer.m in Sources */,
A2BF07910B066E0800757C92 /* SpeedLimitToTurtleIconTransformer.m in Sources */,
A24999230B49F1B5001EADA3 /* ActionPopUpButton.m in Sources */,
A24999440B49F5AD001EADA3 /* ActionPopUpButtonCell.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -4,5 +4,6 @@
@interface ActionPopUpButton : NSPopUpButton
{
NSImage * fImage, * fImagePressed;
}
@end

View File

@ -1,15 +1,24 @@
#import "ActionPopUpButton.h"
#import "ActionPopUpButtonCell.h"
@implementation ActionPopUpButton
- (id) initWithCoder: (NSCoder *) coder
{
if (self = [super initWithCoder: coder])
if ((self = [super initWithCoder: coder]))
{
[self setCell: [[ActionPopUpButtonCell alloc] initTextCell: @"" pullsDown: YES]];
fImage = [NSImage imageNamed: @"ActionButton.png"];
[fImage setFlipped: YES];
fImagePressed = [NSImage imageNamed: @"ActionButtonPressed.png"];
[fImagePressed setFlipped: YES];
}
return self;
}
- (void) drawRect: (NSRect) rect
{
NSImage * image = [[self cell] isHighlighted] ? fImagePressed : fImage;
[image drawInRect: rect fromRect: NSMakeRect(0.0, 0.0, [image size].width, [image size].height)
operation: NSCompositeSourceOver fraction: 1.0];
}
@end

View File

@ -1,9 +0,0 @@
/* ActionPopUpButton */
#import <Cocoa/Cocoa.h>
@interface ActionPopUpButtonCell : NSPopUpButtonCell
{
NSImage * fImage, * fImagePressed;
}
@end

View File

@ -1,24 +0,0 @@
#import "ActionPopUpButtonCell.h"
@implementation ActionPopUpButtonCell
- (id) initTextCell: (NSString *) string pullsDown: (BOOL) pullDown
{
if ((self = [super initTextCell: string pullsDown: YES]))
{
fImage = [NSImage imageNamed: @"ActionButton.png"];
[fImage setFlipped: YES];
fImagePressed = [NSImage imageNamed: @"ActionButtonPressed.png"];
[fImagePressed setFlipped: YES];
}
return self;
}
- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
{
NSImage * image = [self isHighlighted] ? fImagePressed : fImage;
[image drawInRect: cellFrame fromRect: NSMakeRect(0.0, 0.0, [image size].width, [image size].height)
operation: NSCompositeSourceOver fraction: 1.0];
}
@end