-
-
Save jaigouk/211992 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
/* | |
* 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