mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-29 09:52:03 +00:00
Tests/Manual/People: Add a Test menu to switch the column autoresizing style of the content table
This commit is contained in:
1 parent
0a669c840b
commit
0f5f8c0232
4 files changed
+45
-7
No files matched your search
@@ -140,6 +140,28 @@
|
||||
[self _addItem:@"Hide Menu Bar" action:@selector(toggleMenuBar:) key:@"m" modifiers:CPCommandKeyMask | CPControlKeyMask to:viewMenu];
|
||||
[viewMenu addItem:[CPMenuItem separatorItem]];
|
||||
[self _addItem:@"Show All People" action:@selector(showAllPeople:) key:@"1" modifiers:0 to:viewMenu];
|
||||
|
||||
/*
|
||||
The Test menu holds switches for testing only, kept out of the user-facing menus.
|
||||
Column Sizing has one item for each column autoresizing style of the people table. The
|
||||
item's tag is the style, and menu validation checks the current one.
|
||||
*/
|
||||
var testMenu = [self _addSubmenu:@"Test" to:mainMenu],
|
||||
columnSizingItem = [testMenu addItemWithTitle:@"Column Sizing" action:nil keyEquivalent:@""],
|
||||
columnSizingMenu = [[CPMenu alloc] initWithTitle:@"Column Sizing"],
|
||||
styles = [
|
||||
[@"No Autoresizing", CPTableViewNoColumnAutoresizing],
|
||||
[@"Uniform", CPTableViewUniformColumnAutoresizingStyle],
|
||||
[@"Sequential", CPTableViewSequentialColumnAutoresizingStyle],
|
||||
[@"Reverse Sequential", CPTableViewReverseSequentialColumnAutoresizingStyle],
|
||||
[@"Last Column Only", CPTableViewLastColumnOnlyAutoresizingStyle],
|
||||
[@"First Column Only", CPTableViewFirstColumnOnlyAutoresizingStyle]
|
||||
];
|
||||
|
||||
[testMenu setSubmenu:columnSizingMenu forItem:columnSizingItem];
|
||||
|
||||
for (var i = 0; i < styles.length; i++)
|
||||
[[self _addItem:styles[i][0] action:@selector(setColumnSizingStyle:) key:nil modifiers:0 to:columnSizingMenu] setTag:styles[i][1]];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -328,12 +328,14 @@ var NotesMask = "url('data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4
|
||||
}
|
||||
|
||||
/*
|
||||
Returns the columns to the order and widths they are built with. The table's autosave then
|
||||
Returns the columns to the order and widths they are built with, and the table to its
|
||||
column autoresizing style, which Test ▸ Column Sizing can change. The table's autosave then
|
||||
stores that layout. Reset Application uses it.
|
||||
*/
|
||||
- (void)restoreDefaultColumns
|
||||
{
|
||||
[self view];
|
||||
[_tableView setColumnAutoresizingStyle:CPTableViewLastColumnOnlyAutoresizingStyle];
|
||||
|
||||
for (var i = 0, count = [_defaultColumnLayout count]; i < count; i++)
|
||||
{
|
||||
|
||||
@@ -536,6 +536,16 @@ var ToolbarSidebarIdentifier = @"SidebarItem",
|
||||
[[CPUserDefaults standardUserDefaults] setBool:shouldHide forKey:MenuBarHiddenKey];
|
||||
}
|
||||
|
||||
/*
|
||||
Test ▸ Column Sizing: sets the column autoresizing style of the people table to the tag of
|
||||
the chosen item. As in AppKit, the style applies to the next change of the table's width,
|
||||
so the columns move when the window or a divider is resized.
|
||||
*/
|
||||
- (void)setColumnSizingStyle:(id)sender
|
||||
{
|
||||
[[_peopleController tableView] setColumnAutoresizingStyle:[sender tag]];
|
||||
}
|
||||
|
||||
- (void)showAllPeople:(id)sender
|
||||
{
|
||||
[self _selectSourceItem:[_library allPeopleItem]];
|
||||
@@ -669,6 +679,10 @@ var ToolbarSidebarIdentifier = @"SidebarItem",
|
||||
case @selector(toggleMenuBar:):
|
||||
[anItem setTitle:[CPMenu menuBarVisible] ? @"Hide Menu Bar" : @"Show Menu Bar"];
|
||||
break;
|
||||
|
||||
case @selector(setColumnSizingStyle:):
|
||||
[anItem setState:[anItem tag] === [[_peopleController tableView] columnAutoresizingStyle] ? CPOnState : CPOffState];
|
||||
break;
|
||||
}
|
||||
|
||||
return [self validateUserInterfaceItem:anItem];
|
||||
|
||||
@@ -133,7 +133,7 @@ and `tableView:didDragTableColumn:`.
|
||||
|
||||
8. In edit mode, Hide Details is disabled everywhere: menu, toolbar and button bar.
|
||||
9. The navigation button bar has an ellipsis button on its right side. It pops up a copy of
|
||||
each menu of the main menu: People, File, Edit and View. The items are validated as in the
|
||||
each menu of the main menu: People, File, Edit, View and Test. The items are validated as in the
|
||||
menu bar, so while the menu bar is hidden, View ▸ Show Menu Bar shows it again. The button
|
||||
replaces the former action (gear) pop-up, whose items were all in the File menu.
|
||||
While the sidebar is collapsed, by any means including a drag of the divider, the same
|
||||
@@ -152,12 +152,12 @@ and `tableView:didDragTableColumn:`.
|
||||
item is Test ▸ Column Sizing, a submenu with one radio-style item for each column
|
||||
autoresizing style of the people table: No Autoresizing, Uniform, Sequential, Reverse
|
||||
Sequential, Last Column Only and First Column Only.
|
||||
- Choosing an item sets the table's column autoresizing style and lays out the columns
|
||||
again, so the effect shows at once and whenever the window or a divider is resized.
|
||||
- Choosing an item sets the table's column autoresizing style. As in AppKit, the style
|
||||
applies to the next change of the table's width, so the columns move when the window or
|
||||
a divider is resized, not when the item is chosen.
|
||||
- The current style is checked, through menu validation. The copies in the main menu
|
||||
button show the same check.
|
||||
- The fixed-width columns, Notes and Is Manager, show how each style treats columns that
|
||||
cannot resize. The saved column widths and Reset Application must work with every style.
|
||||
- The choice is not saved: the application starts with its normal style.
|
||||
- Priority: before quick look (item 6) and the edit history (items 1 and 5), which are
|
||||
pending.
|
||||
- The choice is not saved: the application starts with Last Column Only, and Reset
|
||||
Application returns to it.
|
||||
Reference in new issue
Block a user