Guest User

Untitled

a guest
Feb 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. @import <AppKit/CPButton.j>
  2.  
  3. @implementation MMSToolbarButton : CPButton
  4. {
  5. CPString identifier @accessors;
  6. CPString buttonType @accessors;
  7. }
  8.  
  9. - (id)initWithFrame:(CPRect)frame
  10. {
  11. self = [super initWithFrame: frame];
  12.  
  13. [self setState:CPOffState];
  14.  
  15. return self;
  16. }
  17.  
  18. - (void)mouseUp:(CPEvent)anEvent
  19. {
  20. [super mouseUp:anEvent];
  21.  
  22. if ([self buttonType] == CPToggleButton)
  23. {
  24. [self swapImages];
  25. [self setNextState];
  26. }
  27. }
  28.  
  29. - (void)swapImages
  30. {
  31. var nextAltImage = [self image];
  32. var nextImage = [self alternateImage];
  33.  
  34. [self setImage:nextImage];
  35. [self setAlternateImage:nextAltImage];
  36. }
  37.  
  38. @end
Add Comment
Please, Sign In to add comment