Skip to content

Instantly share code, notes, and snippets.

@ConnorD
Created January 11, 2011 00:01
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 ConnorD/773743 to your computer and use it in GitHub Desktop.
Save ConnorD/773743 to your computer and use it in GitHub Desktop.
@implementation AppController : CPObject
{
CPScrollView scrollView;
CPTableView tableView;
CPArray data;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
scrollView = [[CPScrollView alloc] initWithFrame:[contentView bounds]];
tableView = [[CPTableView alloc] init];
//[tableView setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
data = [[CPArray alloc] init];
[data addObject:@"test"];
[data addObject:@"another 1"];
var theColumn = [[CPTableColumn alloc] initWithIdentifier:@"theColumn"];
[[theColumn headerView] setStringValue:@"The Column"];
[theColumn setTableView:tableView];
[tableView addTableColumn:theColumn];
[scrollView setDocumentView:tableView];
[tableView setDataSource:self];
[tableView setDelegate:self];
[contentView addSubview:tableView];
[theWindow orderFront:self];
// Uncomment the following line to turn on the standard menu bar.
//[CPMenu setMenuBarVisible:YES];
}
- (int)numberOfRowsInTableView:(CPTableView)aTableView {
return [data count];
}
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex {
return [data objectAtIndex:rowIndex];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment