Skip to content

Instantly share code, notes, and snippets.

@hlship
Created September 9, 2009 01:12
Show Gist options
  • Save hlship/183382 to your computer and use it in GitHub Desktop.
Save hlship/183382 to your computer and use it in GitHub Desktop.
@import <AppKit/CPView.j>
@import <AppKit/CPTextField.j>
@implementation TwitView : CPView
{
CPTextField _label;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
[self setAutoresizingMask:CPViewWidthSizable];
return self;
}
- (void) setRepresentedObject:(JSONObject)obj
{
CPLog.debug("Adding status: " + obj.text);
if (!_label)
{
_label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[_label setFont:[CPFont systemFontOfSize:12]];
[_label setTextColor:[CPColor whiteColor]];
[self addSubview:_label];
}
[_label setStringValue:obj.text];
[_label setFrameSize:CGSizeMake(600, 60)] ;
[_label setFrameOrigin:CGPointMake(10, 0)]
// [_label setLineBreakMode:CPLineBreakByWordWrapping];
}
- (void)setSelected:(BOOL)isSelected
{
[self setBackgroundColor:isSelected ? [CPColor blueColor] : nil] ;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment