Created
September 9, 2009 01:12
-
-
Save hlship/183382 to your computer and use it in GitHub Desktop.
This file contains 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 <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