Created
January 21, 2011 10:57
-
-
Save jlebrech/789532 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <Foundation/CPObject.j> | |
| @implementation TimerMenuItem : CPView | |
| { | |
| id _delegate @accessors(property=delegate); | |
| CPButton startButton; | |
| } | |
| - (id)initWithFrame:(CPRect)frame | |
| { | |
| self = [super initWithFrame:frame]; | |
| if (self){ | |
| buttonWidth = 100; | |
| buttonHeight = 25; | |
| horizontalPos = (CGRectGetWidth([self frame])-buttonWidth)/2; | |
| verticalPos = (CGRectGetHeight([self frame])-buttonHeight)/2; | |
| startButton = [[CPButton alloc] initWithFrame:CGRectMake(horizontalPos,verticalPos,buttonWidth,buttonHeight)]; | |
| [startButton setTitle:@"Start"]; | |
| [startButton setTarget:_delegate]; | |
| [startButton setAction:@selector(timerClicked:)]; | |
| [self addSubview:startButton]; | |
| } | |
| return self; | |
| } | |
| - (void)setTaskName:(CPString)name | |
| { | |
| CPLog.trace(name); | |
| [startButton setTitle:name]; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment