Skip to content

Instantly share code, notes, and snippets.

@tingham
Created May 1, 2010 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tingham/386466 to your computer and use it in GitHub Desktop.
Save tingham/386466 to your computer and use it in GitHub Desktop.
@import <Foundation/CPObject.j>
@implementation ActionTableDataView : CPView
{
}
- (void)setObjectValue:(id)value {
CPLog(value);
if( [value containsKey:@"image"] ){
var iconView = [[CPImageView alloc] initWithFrame:CGRectMake(0,0,22,22)];
[iconView setImageScaling:CPScaleProportionally];
[iconView setImage:[[CPImage alloc] initByReferencingFile:[value valueForKey:@"image"] size:CGSizeMake(22,22)]];
var labelView = [[CPTextField alloc] initWithFrame:CGRectMake(0,0,178,22)];
[labelView setStringValue:[value valueForKey:@"name"]];
[label setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
var wrapperView = [[CPView alloc] initWithFrame:CGRectMake(0,0,200,22)];
[wrapperView addSubview:iconView];
[wrapperView addSubview:labelView];
CPLog(@"composite");
return wrapperView;
}else{
var labelView = [[CPTextField alloc] initWithFrame:CGRectMake(0,0,200,22)];
[labelView setStringValue:[value valueForKey:@"name"]];
CPLog(@"text");
return labelView;
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment