1 /* ============================================================================= 2 FILE: UKPrefsPanel.h 3 4 AUTHORS: M. Uli Kusterer (UK), (c) Copyright 2003, all rights reserved. 5 6 DIRECTIONS: 7 UKPrefsPanel is ridiculously easy to use: Create a tabless NSTabView, 8 where the name of each tab is the name for the toolbar item, and the 9 identifier of each tab is the identifier to be used for the toolbar 10 item to represent it. Then create image files with the identifier as 11 their names to be used as icons in the toolbar. 12 13 Finally, drag UKPrefsPanel.h into the NIB with the NSTabView, 14 instantiate a UKPrefsPanel and connect its tabView outlet to your 15 NSTabView. When you open the window, the UKPrefsPanel will 16 automatically add a toolbar to the window with all tabs represented by 17 a toolbar item, and clicking an item will switch between the tab view's 18 items. 19 20 21 REVISIONS: 22 2003-08-13 UK Added auto-save, fixed bug with empty window titles. 23 2003-07-22 UK Added Panther stuff, documented. 24 2003-06-30 UK Created. 25 ========================================================================== */ 26 27 /* ----------------------------------------------------------------------------- 28 Headers: 29 -------------------------------------------------------------------------- */ 30 31 #import <AppKit/AppKit.h> 32 33 34 /* ----------------------------------------------------------------------------- 35 Classes: 36 -------------------------------------------------------------------------- */ 37 38 @interface UKPrefsPanel : NSObject 39 { 40 IBOutlet NSTabView* tabView; // The tabless tab-view that we're a switcher for. 41 IBOutlet id windowController; 42 43 NSMutableDictionary* itemsList; // Auto-generated from tab view's items. 44 NSString* baseWindowName; // Auto-fetched at awakeFromNib time. We append a colon and the name of the current page to the actual window title. 45 NSString* autosaveName; // Identifier used for saving toolbar state and current selected page of prefs window. 46 } 47 48 // Accessors for specifying the tab view: (you should just hook these up in IB) 49 -(void) setTabView: (NSTabView*)tv; 50 -(NSTabView*) tabView; 51 52 -(void) setAutosaveName: (NSString*)name; 53 -(NSString*) autosaveName; 54 55 // Action for hooking up this object and the menu item: 56 -(IBAction) orderFrontPrefsPanel: (id)sender; 57 58 // You don't have to care about these: 59 -(void) mapTabsToToolbar; 60 -(IBAction) changePanes: (id)sender; 61 62 @end 63