Skip to content

Instantly share code, notes, and snippets.

@jaigouk
Forked from nicoclavier/CPOutlineView Try
Created October 16, 2009 19:19
Show Gist options
  • Save jaigouk/211992 to your computer and use it in GitHub Desktop.
Save jaigouk/211992 to your computer and use it in GitHub Desktop.
/*
* AppController.j
* test
*
* Created by You on October 2, 2009.
* Copyright 2009, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@import <AppKit/CPOutlineView.j>
@implementation AppController : CPObject
{
CPArray items;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
items = [CPArray array];
for (var i=0; i< 40; i++)
{
item = [CPString stringWithString:@"Some Text"];
[items addObject:item];
}
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
var myView = [[CPOutlineView alloc] initWithFrame:CGRectMake(100,100,400,400)];
// theController = [[MyController alloc] init];
[myView setDelegate:self];
[myView setDataSource:self];
[contentView addSubview:myView];
[theWindow orderFront:self];
console.log(myView);
}
- (id)outlineView:(CPOutlineView)outlineView child:(int)index ofItem:(id)item
{
return [items objectAtIndex:index];
}
- (BOOL)outlineView:(CPOutlineView)outlineView isItemExpandable:(id)item
{
return YES;
}
- (int)outlineView:(CPOutlineView)outlineView numberOfChildrenOfItem:(id)item
{
return 10;
}
- (id)outlineView:(CPOutlineView)outlineView objectValueForTableColumn:(CPTableColumn)tableColumn byItem:(id)item
{
return [items objectAtIndex:index];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment