Created
September 9, 2009 01:11
-
-
Save hlship/183381 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
- (id)init | |
{ | |
self = [super init]; | |
_panel = [[CPPanel alloc] initWithContentRect:CGRectMake(20, 30, 245, 184) | |
styleMask:CPHUDBackgroundWindowMask | CPClosableWindowMask | CPResizableWindowMask]; | |
[_panel setTitle:@"Twitter"]; | |
[_panel setMinSize:CGSizeMake(245, 184)]; | |
var content = [_panel contentView]; | |
var label = [CPTextField labelWithTitle:"User:"]; | |
[label setFrame:CGRectMake(3, 7, 50, 24)]; | |
[label setTextColor:[CPColor whiteColor]]; | |
_field = [CPTextField textFieldWithStringValue:"" placeholder:"Twitter User" width:200]; | |
[_field setFrame:CGRectMake(40, 0, 200, 28)]; | |
[_field setTarget:self]; | |
[_field setAction:@selector(startSearch:)]; | |
[_field setAutoresizingMask:CPViewWidthSizable]; | |
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(3, 40, | |
CGRectGetWidth([content bounds]) - 10, | |
CGRectGetHeight([content bounds]) - 50)]; | |
[scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; | |
[scrollView setAutohidesScrollers:YES]; | |
[scrollView setBackgroundColor:[CPColor greenColor]]; // TEMP | |
var scrollViewBounds = [[scrollView contentView] bounds]; | |
var itemPrototype = [[CPCollectionViewItem alloc] init]; | |
[itemPrototype setView:[[TwitView alloc] initWithFrame:CGRectMakeZero()]]; | |
_timelineView = [[CPCollectionView alloc] initWithFrame:CGRectMake(0, 0, | |
CGRectGetWidth(scrollViewBounds), 60)]; | |
[_timelineView setItemPrototype:itemPrototype]; | |
[_timelineView setDelegate:self]; | |
[_timelineView setMaxNumberOfColumns:1]; | |
[_timelineView setBackgroundColor:[CPColor darkGrayColor]]; // TEMP | |
[_timelineView setMinItemSize:CGSizeMake(CGRectGetWidth([content bounds]) - 20, 60)]; | |
// [_timelineView setMaxItemSize:CGSizeMake(CGRectGetWidth([content bounds]) - 20, 600)]; | |
[_timelineView setAutoresizingMask:CPViewWidthSizable]; | |
[scrollView setDocumentView:_timelineView]; | |
[content addSubview:label]; | |
[content addSubview:_field]; | |
[content addSubview:scrollView]; | |
return self; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment