mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
CPTableView has no focus ring, and currently gives no visual feedback of its firstResponder status. In Cocoa when the table view resigns firstResponder or its window loses key status, the selection color turns gray. This commit sets the selection color to gray when a table view resign firstResponder or its window loses key status. A second window and a couple of textfields were added to the CPDictionaryControllerTest to demonstrate the changes. Fixes #1839
64 lines
1.9 KiB
Plaintext
64 lines
1.9 KiB
Plaintext
/*
|
|
* AppController.j
|
|
* CPDictionaryControllerTest
|
|
*
|
|
* Created by Blair Duncan on February 17, 2013.
|
|
* Copyright 2013, SGL Studio, BBDO Toronto All rights reserved.
|
|
*/
|
|
|
|
@import <Foundation/CPObject.j>
|
|
@import <AppKit/CPDictionaryController.j>
|
|
|
|
|
|
@implementation AppController : CPObject
|
|
{
|
|
CPDictionaryController dictionaryController @accessors;
|
|
CPTableView tableView @accessors;
|
|
}
|
|
|
|
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
|
{
|
|
// This is called when the application is done loading.
|
|
}
|
|
|
|
- (void)awakeFromCib
|
|
{
|
|
var dictionary = [CPDictionary dictionaryWithObjectsAndKeys:
|
|
@"867-5309", @"Phone Number", // Phone Number is in the Excluded List in the Xib
|
|
@"Blair", @"First Name",
|
|
@"Duncan", @"Last Name",
|
|
@"Toronto", @"City"];
|
|
[dictionaryController setContentDictionary:dictionary];
|
|
[tableView reloadData];
|
|
}
|
|
|
|
- (void)nextHighlightStyle:(id)sender
|
|
{
|
|
switch ([tableView selectionHighlightStyle])
|
|
{
|
|
case CPTableViewSelectionHighlightStyleNone :
|
|
[tableView setSelectionHighlightStyle:CPTableViewSelectionHighlightStyleSourceList];
|
|
[sender setTitle:"CPTableViewSelectionHighlightStyleSourceList"];
|
|
break;
|
|
|
|
case CPTableViewSelectionHighlightStyleSourceList :
|
|
[tableView setSelectionHighlightStyle:CPTableViewSelectionHighlightStyleRegular];
|
|
[sender setTitle:"CPTableViewSelectionHighlightStyleRegular"];
|
|
break;
|
|
|
|
default:
|
|
[tableView setSelectionHighlightStyle:CPTableViewSelectionHighlightStyleNone];
|
|
[sender setTitle:"CPTableViewSelectionHighlightStyleNone"];
|
|
}
|
|
|
|
[tableView setNeedsDisplay:YES];
|
|
}
|
|
|
|
- (BOOL)tableView:(CPTableView)tableView isGroupRow:(int)row
|
|
{
|
|
return (row > 2 && row < 5);
|
|
}
|
|
|
|
|
|
@end
|