Changeset 1312


Ignore:
Timestamp:
Jan 2, 2007, 7:51:02 PM (15 years ago)
Author:
livings124
Message:

streamline action button code

Location:
trunk
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Transmission.xcodeproj/project.pbxproj

    r1307 r1312  
    112112                A24600520A6DCE6600D19088 /* SpeedLimitButtonGraphite.png in Resources */ = {isa = PBXBuildFile; fileRef = A24600500A6DCE6600D19088 /* SpeedLimitButtonGraphite.png */; };
    113113                A24999230B49F1B5001EADA3 /* ActionPopUpButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */; };
    114                 A24999440B49F5AD001EADA3 /* ActionPopUpButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A24999420B49F5AD001EADA3 /* ActionPopUpButtonCell.m */; };
    115114                A24F19080A3A790800C9C145 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; };
    116115                A24F19210A3A796800C9C145 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; };
     
    314313                A24999200B49F1B5001EADA3 /* ActionPopUpButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ActionPopUpButton.h; path = macosx/ActionPopUpButton.h; sourceTree = "<group>"; };
    315314                A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ActionPopUpButton.m; path = macosx/ActionPopUpButton.m; sourceTree = "<group>"; };
    316                 A24999420B49F5AD001EADA3 /* ActionPopUpButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ActionPopUpButtonCell.m; path = macosx/ActionPopUpButtonCell.m; sourceTree = "<group>"; };
    317                 A24999430B49F5AD001EADA3 /* ActionPopUpButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ActionPopUpButtonCell.h; path = macosx/ActionPopUpButtonCell.h; sourceTree = "<group>"; };
    318315                A24F19070A3A790800C9C145 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = macosx/Sparkle.framework; sourceTree = "<group>"; };
    319316                A253F6F20A698970008EE24F /* FilterBarBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterBarBackground.png; path = macosx/Images/FilterBarBackground.png; sourceTree = "<group>"; };
     
    468465                                A24999200B49F1B5001EADA3 /* ActionPopUpButton.h */,
    469466                                A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */,
    470                                 A24999420B49F5AD001EADA3 /* ActionPopUpButtonCell.m */,
    471                                 A24999430B49F5AD001EADA3 /* ActionPopUpButtonCell.h */,
    472467                        );
    473468                        name = Sources;
     
    935930                                A2BF07910B066E0800757C92 /* SpeedLimitToTurtleIconTransformer.m in Sources */,
    936931                                A24999230B49F1B5001EADA3 /* ActionPopUpButton.m in Sources */,
    937                                 A24999440B49F5AD001EADA3 /* ActionPopUpButtonCell.m in Sources */,
    938932                        );
    939933                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/macosx/ActionPopUpButton.h

    r1307 r1312  
    55@interface ActionPopUpButton : NSPopUpButton
    66{
     7    NSImage * fImage, * fImagePressed;
    78}
    89@end
  • trunk/macosx/ActionPopUpButton.m

    r1311 r1312  
    11#import "ActionPopUpButton.h"
    2 #import "ActionPopUpButtonCell.h"
    32
    43@implementation ActionPopUpButton
     
    65- (id) initWithCoder: (NSCoder *) coder
    76{
    8         if (self = [super initWithCoder: coder])
     7        if ((self = [super initWithCoder: coder]))
    98    {
    10         [self setCell: [[ActionPopUpButtonCell alloc] initTextCell: @"" pullsDown: YES]];
     9        fImage = [NSImage imageNamed: @"ActionButton.png"];
     10        [fImage setFlipped: YES];
     11        fImagePressed = [NSImage imageNamed: @"ActionButtonPressed.png"];
     12        [fImagePressed setFlipped: YES];
    1113        }
    1214        return self;
    1315}
    1416
     17- (void) drawRect: (NSRect) rect
     18{
     19    NSImage * image = [[self cell] isHighlighted] ? fImagePressed : fImage;
     20        [image drawInRect: rect fromRect: NSMakeRect(0.0, 0.0, [image size].width, [image size].height)
     21            operation: NSCompositeSourceOver fraction: 1.0];
     22}
     23
    1524@end
Note: See TracChangeset for help on using the changeset viewer.