/* Copyright (C) 2002-2003, Jeffrey D. Argast. The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy. Permission is hereby granted to use, copy, modify, and distribute this software or portions thereof for any purpose, without fee, subject to these conditions: (1) If any part of the source code is distributed, then this statement must be included, with this copyright and no-warranty notice unaltered. (2) Permission for use of this software is granted only if the user accepts full responsibility for any undesirable consequences; the authors accept NO LIABILITY for damages of any kind. */ #import "TabViewDelegate.h" #import #import "TabViewProtocol.h" static NSString* kPendingTab = @"Pending"; static NSString* kSubmittedTab = @"Submitted"; static NSString* kBranchesTab = @"Branches"; static NSString* kLabelsTab = @"Labels"; static NSString* kClientsTab = @"Clients"; static NSString* kUsersTab = @"Users"; //static NSString* kJobsTab = @"Jobs"; @implementation TabViewDelegate /* - (void) awakeFromNib { NSRect bounds = [fTabView bounds]; bounds.size.height = 20; [fTabView addToolTipRect:bounds owner:self userData:nil]; } - (NSString*) view:(NSView*)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void*)data { NSLog (@"asking for tool tip"); return nil; } */ - (id) pendingTab { return fPending; } - (id) submittedTab { return fSubmitted; } - (id) branchesTab { return fBranches; } - (id) labelsTab { return fLabels; } - (id) clientsTab { return fClients; } - (id) usersTab { return fUsers; } - (id) jobsTab { return fJobs; } - (id) getController: (NSString*) labelName { if ( [labelName isEqualTo:kPendingTab] ) { return [self pendingTab]; } else if ( [labelName isEqualTo:kSubmittedTab] ) { return [self submittedTab]; } else if ( [labelName isEqualTo:kBranchesTab] ) { return [self branchesTab]; } else if ( [labelName isEqualTo:kLabelsTab] ) { return [self labelsTab]; } else if ( [labelName isEqualTo:kClientsTab] ) { return [self clientsTab]; } else if ( [labelName isEqualTo:kUsersTab] ) { return [self usersTab]; } return [self jobsTab]; } - (void) appFinishedLaunching { NSTabViewItem* selectedItem = [fTabView selectedTabViewItem]; NSString* tabLabel = [selectedItem label]; id viewController = [self getController:tabLabel]; [viewController comeForward]; } - (void) tabView: (NSTabView *) tabView didSelectTabViewItem: (NSTabViewItem *) tabViewItem { NSString* tabLabel = [tabViewItem label]; id viewController = [self getController:tabLabel]; [viewController comeForward]; } - (void) tabView: (NSTabView *) tabView willSelectTabViewItem: (NSTabViewItem *) tabViewItem { NSTabViewItem* selectedItem = [tabView selectedTabViewItem]; NSString* tabLabel = [selectedItem label]; id viewController = [self getController:tabLabel]; [viewController stepBack]; } @end