Created
January 24, 2012 00:29
-
-
Save toddfreese/1666886 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
| @implementation SearchCloseCell : CPView | |
| { | |
| CPDictionary viewStyleDict @accessors; | |
| CPString presentationMode @accessors; | |
| CPString company @accessors; | |
| CPButton closeButton; | |
| CPImage icon; | |
| CPImage icon2; | |
| BOOL isSelected; | |
| JSObject folderObject; | |
| } | |
| - (id)initWithFrame:(CPRect)aFrame withStyleDict:(CPDictionary)aStyleDict presentationMode:(CPString)mode | |
| { | |
| [self setViewStyleDict:aStyleDict]; | |
| [self setPresentationMode:mode]; | |
| return [self initWithFrame:aFrame]; | |
| } | |
| - (id)initWithFrame:(CPRect)aFrame | |
| { | |
| if (self = [super initWithFrame:aFrame]) { | |
| icon = [[CPImage alloc] initWithContentsOfFile:@"Resources/closeButton.png"]; | |
| [icon setDelegate:self]; | |
| icon2 = [[CPImage alloc] initWithContentsOfFile:@"Resources/closeButtonPressed.png"]; | |
| [icon2 setDelegate:self]; | |
| closeButton = [[CPButton alloc] initWithFrame:CGRectMake(20, 12, 20, 20)]; | |
| [closeButton setImage:icon]; | |
| [closeButton setAlternateImage:icon2]; | |
| [closeButton setBordered:NO]; | |
| [closeButton setAction:@selector(close:)]; | |
| [self addSubview:closeButton]; | |
| } | |
| return self; | |
| } | |
| - (void)setObjectValue:(id)anObject | |
| { | |
| folderObject = anObject; | |
| // Nothing to set here as class is just a button. | |
| } | |
| - (void)encodeWithCoder:(CPCoder)coder | |
| { | |
| [super encodeWithCoder:coder]; | |
| [coder encodeObject:[self viewStyleDict] forKey:@"viewStyleDict"]; | |
| [coder encodeObject:[self presentationMode] forKey:@"presentationMode"]; | |
| [coder encodeObject:[self company] forKey:@"company"]; | |
| [coder encodeObject:closeButton forKey:@"closeButton"]; | |
| } | |
| - (id)initWithCoder:(CPCoder)coder | |
| { | |
| self = [super initWithCoder:coder]; | |
| if (self) { | |
| [self setViewStyleDict:[[coder decodeObjectForKey:@"viewStyleDict"] retain]]; | |
| [self setPresentationMode:[[coder decodeObjectForKey:@"presentationMode"] retain]]; | |
| [self setCompany:[[coder decodeObjectForKey:@"company"] retain]]; | |
| closeButton = [coder decodeObjectForKey:@"closeButton"]; | |
| } | |
| return self; | |
| } | |
| - (void)close:(id)sender | |
| { | |
| CPLog(@"close called"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment