mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-26 05:27:03 +00:00
make editable textfield bordered Finished CPOutlineView view-based. With example
59 lines
1.2 KiB
Plaintext
59 lines
1.2 KiB
Plaintext
/*
|
|
* AppController.j
|
|
* CPOutlineViewViewBasedCibTest
|
|
*
|
|
* Created by You on April 11, 2012.
|
|
* Copyright 2012, Your Company All rights reserved.
|
|
*/
|
|
|
|
@import <Foundation/CPObject.j>
|
|
|
|
|
|
@implementation AppController : CPObject
|
|
{
|
|
@outlet CPWindow theWindow;
|
|
@outlet CPOutlineView outlineView;
|
|
}
|
|
|
|
- (void)awakeFromCib
|
|
{
|
|
[theWindow setFullPlatformWindow:YES];
|
|
}
|
|
|
|
- (int)outlineView:(id)oview numberOfChildrenOfItem:(id)item
|
|
{
|
|
return 3;
|
|
}
|
|
|
|
- (id)outlineView:(id)oview child:(int)childnum ofItem:(id)item
|
|
{
|
|
return [CPObject new];
|
|
}
|
|
|
|
- (BOOL)outlineView:(id)oview isItemExpandable:(id)item
|
|
{
|
|
return YES;
|
|
}
|
|
|
|
-(id)outlineView:(id)oview dataViewForTableColumn:(id)tableColumn item:(id)item
|
|
{
|
|
var identifier = [tableColumn identifier];
|
|
if (identifier == @"first" && [oview parentForItem:item] == nil)
|
|
identifier = @"firstRoot";
|
|
|
|
var view = [oview makeViewWithIdentifier:identifier owner:self];
|
|
[[view textField] setStringValue:@"Item <" + [item UID] + ">"];
|
|
|
|
return view;
|
|
}
|
|
|
|
- (IBAction)expand:(id)sender
|
|
{
|
|
var row = [outlineView rowForView:sender],
|
|
item = [outlineView itemAtRow:row];
|
|
|
|
[outlineView expandItem:item];
|
|
}
|
|
|
|
@end
|