Skip to content

Instantly share code, notes, and snippets.

@Me1000
Created April 20, 2010 19:05
Show Gist options
  • Select an option

  • Save Me1000/372902 to your computer and use it in GitHub Desktop.

Select an option

Save Me1000/372902 to your computer and use it in GitHub Desktop.
/*
* AppController.j
* blah
*
* Created by You on April 20, 2010.
* Copyright 2010, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(20,20,400,400)];
// create the CPTableView
var tableView = [[CPTableView alloc] initWithFrame:CPMakeRect (0,30,440,478)]
//console.log([ scrollView bounds ]);
[tableView setUsesAlternatingRowBackgroundColors:YES];
// define the header color
var headerColor = [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:@"button-bezel-center.png"]]];
[[tableView cornerView] setBackgroundColor:headerColor];
// add the first column
var column = [[CPTableColumn alloc] initWithIdentifier:@"TwitterUserName"];
[[column headerView] setStringValue:@"Twitter User Name"];
[[column headerView] setBackgroundColor:headerColor];
[column setWidth:125.0];
[tableView addTableColumn:column];
// add the second column
var column = [[CPTableColumn alloc] initWithIdentifier:@"Tweet"];
[[column headerView] setStringValue:@"Tweet"];
[[column headerView] setBackgroundColor:headerColor];
[column setWidth:825.0];
[tableView addTableColumn:column];
[scrollView setDocumentView:tableView];
[tableView setDataSource:self]
[contentView addSubview:scrollView];
[theWindow orderFront:self];
// Uncomment the following line to turn on the standard menu bar.
//[CPMenu setMenuBarVisible:YES];
}
- (int)numberOfRowsInTableView:(CPTableView)aTable
{
return 20;
}
- (id)tableView:(id)a objectValueForTableColumn:(id)b row:(id)c
{
return "123";
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment