Files
cappuccino/Tests/Manual/TableTest/DelegateSelectionTest/AppController.j
T
Alexandre Wilhelm c22f489ee9 Fixed: shouldSelectTableColumn isn't called in CPTableView and CPOutlineView
Previously shouldSelectTableColumn wasn't called in CPTableView and CPOutlineView.
This PR resolves this issue, shouldSelectTableColumn is now called between selectionShouldChangeInTableView and tableViewSelectionIsChanging as in COCOA.

Test app Tests/Manual/TableTest/DelegateSelectionTest/
2013-10-24 22:13:35 -07:00

141 lines
3.3 KiB
Plaintext
Executable File

/*
* AppController.j
* DelegateSelectionTest
*
* Created by You on October 16, 2013.
* Copyright 2013, Your Company All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@implementation AppController : CPObject
{
CPArray _names;
@outlet CPWindow theWindow;
@outlet CPTableView tableView;
@outlet CPTableView secondTableView;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
// This is called when the application is done loading.
}
- (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.
_names = [@"Alexandre Wilhelm", @"Alexander Ljungberg", @"Antoine Mercadal", @"Aparajita Fishman"];
[tableView setAllowsMultipleSelection:YES];
[tableView reloadData];
[secondTableView setDelegate:[DelegateSecondTableView new]];
[secondTableView reloadData];
// In this case, we want the window from Cib to become our full browser window
[theWindow setFullPlatformWindow:YES];
}
- (int)numberOfRowsInTableView:(CPTableView)aTableView
{
return [_names count];
}
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRowIndex
{
return _names[aRowIndex];
}
- (void)tableViewSelectionDidChange:(CPNotification)aNotification
{
console.log(@"tableViewSelectionDidChange")
}
- (BOOL)selectionShouldChangeInTableView:(CPTableView)aTableView
{
console.log(@"selectionShouldChangeInTableView")
return YES;
}
- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(int)rowIndex
{
console.log(@"shouldSelectRow");
return YES;
}
- (void)tableViewSelectionIsChanging:(CPNotification)aNotification
{
console.log(@"tableViewSelectionIsChanging");
}
- (void)tableView:(CPTableView)tableView didClickTableColumn:(CPTableColumn)tableColumn;
{
console.log(@"didClickTableColumn");
}
- (BOOL)tableView:(CPTableView)aTableView shouldSelectTableColumn:(CPTableColumn)aTableColumn
{
console.log(@"shouldSelectTableColumn");
return YES;
}
@end
@implementation DelegateSecondTableView : CPObject
{
}
- (id)init
{
if (self = [super init])
{
}
return self;
}
- (CPIndexSet)tableView:(CPTableView)tableView selectionIndexesForProposedSelection:(CPIndexSet)proposedSelectionIndexes
{
console.log(@"selectionIndexesForProposedSelection")
return proposedSelectionIndexes;
}
- (void)tableViewSelectionDidChange:(CPNotification)aNotification
{
console.log(@"tableViewSelectionDidChange")
}
- (BOOL)selectionShouldChangeInTableView:(CPTableView)aTableView
{
console.log(@"selectionShouldChangeInTableView")
return YES;
}
- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(int)rowIndex
{
console.log(@"shouldSelectRow");
return YES;
}
- (BOOL)tableView:(CPTableView)aTableView shouldSelectTableColumn:(CPTableColumn)aTableColumn
{
console.log(@"shouldSelectTableColumn");
return YES;
}
- (void)tableViewSelectionIsChanging:(CPNotification)aNotification
{
console.log(@"tableViewSelectionIsChanging");
}
- (void)tableView:(CPTableView)tableView didClickTableColumn:(CPTableColumn)tableColumn;
{
console.log(@"didClickTableColumn");
}
@end