Skip to content

Instantly share code, notes, and snippets.

@jlebrech
Created January 21, 2011 10:57
Show Gist options
  • Save jlebrech/789532 to your computer and use it in GitHub Desktop.
Save jlebrech/789532 to your computer and use it in GitHub Desktop.
@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