diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-06-11 11:32:43 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-06-11 11:32:43 +0000 |
commit | fb96c4b17accaab40f972bef05f421fe85cb1fdb (patch) | |
tree | 104f959d2b7aaae1637b962132bae0a8e68ef569 /Source | |
parent | a1cbe5771e4f0a2f71bfe0c909f59f8aa5337450 (diff) | |
download | sequelpro-fb96c4b17accaab40f972bef05f421fe85cb1fdb.tar.gz sequelpro-fb96c4b17accaab40f972bef05f421fe85cb1fdb.tar.bz2 sequelpro-fb96c4b17accaab40f972bef05f421fe85cb1fdb.zip |
• add to Main Menu > View > :
- Select Next Tab ^⇥
- Select Previous ^⇧⇥
and menu validation to be able to navigate through available tabs by using the keyboard.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPWindowController.h | 2 | ||||
-rw-r--r-- | Source/SPWindowController.m | 43 |
2 files changed, 45 insertions, 0 deletions
diff --git a/Source/SPWindowController.h b/Source/SPWindowController.h index d46deb19..49c85acc 100644 --- a/Source/SPWindowController.h +++ b/Source/SPWindowController.h @@ -41,6 +41,8 @@ - (SPDatabaseDocument *) selectedTableDocument; - (void) updateAllTabTitles:(id)sender; - (IBAction)closeTab:(id)sender; +- (IBAction)selectNextDocumentTab:(id)sender; +- (IBAction)selectPreviousDocumentTab:(id)sender; - (NSArray *)documents; @end diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m index c6400c96..b68a4668 100644 --- a/Source/SPWindowController.m +++ b/Source/SPWindowController.m @@ -152,6 +152,40 @@ } /** + * Select next tab. + */ +- (IBAction)selectNextDocumentTab:(id)sender +{ + [tabView selectNextTabViewItem:nil]; +} + +/** + * Select previous tab. + */ +- (IBAction)selectPreviousDocumentTab:(id)sender +{ + [tabView selectPreviousTabViewItem:nil]; +} + +/** + * Menu validation + */ +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem +{ + // Select Previous Tab + if ([menuItem action] == @selector(selectPreviousDocumentTab:)) { + return ([tabView numberOfTabViewItems] && [tabView indexOfTabViewItem:[tabView selectedTabViewItem]]); + } + + // Select Next Tab + if ([menuItem action] == @selector(selectNextDocumentTab:)) { + return ([tabView numberOfTabViewItems] && [tabView indexOfTabViewItem:[tabView selectedTabViewItem]]<[tabView numberOfTabViewItems]-1); + } + + return YES; +} + +/** * Retrieve the documents associated with this window. */ - (NSArray *)documents @@ -241,6 +275,15 @@ } } +/** + * Show tooltip for a tab view item. + */ +- (NSString *)tabView:(NSTabView *)aTabView toolTipForTabViewItem:(NSTabViewItem *)tabViewItem +{ + // Not yet implemented + return @""; +} + - (void)tabView:(NSTabView *)aTabView closeWindowForLastTabViewItem:(NSTabViewItem *)tabViewItem { [[aTabView window] close]; |