Created
November 19, 2008 21:12
-
-
Save j4johnfox/26720 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import <AppKit/CPButton.j> | |
@implementation MMSToolbarButton : CPButton | |
{ | |
CPString identifier @accessors; | |
CPString buttonType @accessors; | |
} | |
- (id)initWithFrame:(CPRect)frame | |
{ | |
self = [super initWithFrame: frame]; | |
[self setState:CPOffState]; | |
return self; | |
} | |
- (void)mouseUp:(CPEvent)anEvent | |
{ | |
[super mouseUp:anEvent]; | |
if ([self buttonType] == CPToggleButton) | |
{ | |
[self swapImages]; | |
[self setNextState]; | |
} | |
} | |
- (void)swapImages | |
{ | |
var nextAltImage = [self image]; | |
var nextImage = [self alternateImage]; | |
[self setImage:nextImage]; | |
[self setAlternateImage:nextAltImage]; | |
} | |
@end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment