diff options
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]; |