mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-01 06:37:41 +00:00
New: preparedViewAtColumn:row: These methods allow to enumerate visible data views or data views in specified columns and rows. -enumerateAvailableViewsUsingBlock: is the counterpart of cocoa's -enumerateAvailableRowViewsUsingBlock: except that it enumerates data views instead of CPTableRowView and the block has an additional column parameter. This commit reverses the way views are stored and accessed in the table view: rows>columns instead of columns>rows. Applied the second method where it is relevant, making the code more compact and readable.
57 lines
1.6 KiB
Plaintext
57 lines
1.6 KiB
Plaintext
/*
|
|
* AppController.j
|
|
* TableCibTest
|
|
*
|
|
* Created by Francisco Tolmasky on July 5, 2009.
|
|
* Copyright 2009, 280 North, Inc. All rights reserved.
|
|
*/
|
|
|
|
@import <Foundation/CPObject.j>
|
|
@import "../../CPTrace.j"
|
|
|
|
CPLogRegister(CPLogConsole);
|
|
|
|
@implementation AppController : CPObject
|
|
{
|
|
CPWindow theWindow; //this "outlet" is connected automatically by the Cib
|
|
CPImage iconImage;
|
|
}
|
|
|
|
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
|
{
|
|
// This is called when the application is done loading.
|
|
iconImage = [[CPImage alloc] initWithContentsOfFile:"http://cappuccino-project.org/img/favicon.ico" size:CGSizeMake(16,16)];
|
|
|
|
var averager = moving_averager(50);
|
|
|
|
CPTrace("CPTableView", "load", function(receiver, selector, args, duration)
|
|
{
|
|
if (duration)
|
|
console.log(receiver + " " + selector + " in " + averager(duration));
|
|
});
|
|
}
|
|
|
|
- (void)awakeFromCib
|
|
{
|
|
// This is called when the cib is done loading.
|
|
// You can implement this method on any object instantiated from a Cib.
|
|
// It's a useful hook for setting up current UI values, and other things.
|
|
|
|
// In this case, we want the window from Cib to become our full browser window
|
|
[theWindow setFullPlatformWindow:YES];
|
|
}
|
|
|
|
- (int)numberOfRowsInTableView:(CPTableView)tableView
|
|
{
|
|
return 100000;
|
|
}
|
|
|
|
- (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(int)row
|
|
{
|
|
if ([tableColumn identifier] === "icons")
|
|
return iconImage;
|
|
else
|
|
return String((row + 1) * [[tableColumn identifier] intValue]);
|
|
}
|
|
|
|
@end |