| 1 | // |
---|
| 2 | // AIToolbarTabView.h |
---|
| 3 | // Adium |
---|
| 4 | // |
---|
| 5 | // Created by Adam Iser on Sat May 22 2004. |
---|
| 6 | // Copyright (c) 2004-2005 The Adium Team. All rights reserved. |
---|
| 7 | // |
---|
| 8 | |
---|
| 9 | /*! |
---|
| 10 | * @class AIToolbarTabView |
---|
| 11 | * @brief <tt>NSTabView</tt> subclass for creating preference-type windows |
---|
| 12 | * |
---|
| 13 | * <p>This is a special <tt>NSTabView</tt> subclass which is useful when creating preference-type windows. The tabview will automatically create a window toolbar and add an toolbar item for each tab it contains. The tabview delegate will be asked for the toolbar images.</p> |
---|
| 14 | * <p>This class also contains methods for auto-sizing the parent window based on the selected tab. The delegate is asked for the window size, and this tabview takes care of the animation.</p> |
---|
| 15 | * @see <tt><a href="category_n_s_object(_a_i_toolbar_tab_view_delegate).html" target="_top">NSObject(AIToolbarTabViewDelegate)</a></tt> |
---|
| 16 | */ |
---|
| 17 | @interface AIToolbarTabView : NSTabView { |
---|
| 18 | NSMutableDictionary *toolbarItems; |
---|
| 19 | int oldHeight; |
---|
| 20 | |
---|
| 21 | IBOutlet NSTabViewItem *tabViewItem_loading; |
---|
| 22 | IBOutlet NSProgressIndicator *progressIndicator_loading; |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | @end |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | /*! |
---|
| 29 | * @category NSObject(AIToolbarTabViewDelegate) |
---|
| 30 | * @brief Methods which may optionally be implemented by an <tt>AIToolbarTabView</tt>'s delegate |
---|
| 31 | * |
---|
| 32 | * These methods allow the delegate greater control over the tab view. |
---|
| 33 | */ |
---|
| 34 | @interface NSObject (AIToolbarTabViewDelegate) |
---|
| 35 | /*! |
---|
| 36 | * @brief Allows automatic creation of toolbar items for each <tt>NSTabViewItem</tt> the <tt>AIToolbarTabView</tt> contains. |
---|
| 37 | * |
---|
| 38 | * If this method is implemented by the delegate, the delegate will be queried for an image for each <tt>NSTabViewItem</tt>. These images will be used to automatically populate the window's toolbar with toolbar items. |
---|
| 39 | * @param tabView The <tt>NSTabView</tt> sending the message |
---|
| 40 | * @param tabViewItem The <tt>NSTabViewItem</tt> for which an image is requested |
---|
| 41 | * @result An <tt>NSImage</tt> to use for a toolbar item associated with <b>tabViewItem</b>. |
---|
| 42 | */ |
---|
| 43 | - (NSImage *)tabView:(NSTabView *)tabView imageForTabViewItem:(NSTabViewItem *)tabViewItem; |
---|
| 44 | |
---|
| 45 | /*! |
---|
| 46 | * @brief Allows automatic resizing of the window when the toolbar is used to switch to an <tt>NSTabViewItem</tt>. |
---|
| 47 | * |
---|
| 48 | * If this method is implemented by the delegate, the delegate will be queried for a desired height when the user clicks the toolbar button associated with an <tt>NSTabViewItem</tt> (the toolbar item is created by implementation of tabView:imageForTabViewItem: by the delegate -- see its description.). |
---|
| 49 | * @param tabView The <tt>NSTabView</tt> sending the message |
---|
| 50 | * @param tabViewItem The <tt>NSTabViewItem</tt> for a height is requested |
---|
| 51 | * @result The height needed to display <b>tabViewItem</b>. The window will be smoothly resized to this height. |
---|
| 52 | */ |
---|
| 53 | - (int)tabView:(NSTabView *)tabView heightForTabViewItem:(NSTabViewItem *)tabViewItem; |
---|
| 54 | |
---|
| 55 | /*! |
---|
| 56 | * @brief Label for the passed tab view item |
---|
| 57 | * |
---|
| 58 | * If this method is implemented, the delegate is queried for the label to show for each tab view item. |
---|
| 59 | * @result The label to use. If nil or unimplemented, [tabViewItem label] will be used. |
---|
| 60 | */ |
---|
| 61 | - (NSString *)tabView:(NSTabView *)tabView labelForTabViewItem:(NSTabViewItem *)tabViewItem; |
---|
| 62 | /* |
---|
| 63 | * @brief Should the loading indicator be shown immediately until a tab view item is selected? |
---|
| 64 | * |
---|
| 65 | * If this method is implemented and returns YES, the loading pane will immediately be shown with its spinning progress |
---|
| 66 | * indicator animating. If this method is not implemented or returns NO, the load pane will not be shown until the run |
---|
| 67 | * loop after the user's click. YES is appropriate if loading may take an appreciable amount of time; NO looks better |
---|
| 68 | * if the loading process is near-instanteous. |
---|
| 69 | * |
---|
| 70 | * For example, in Adium, the first time a preferences tab is selected, this method returns YES. |
---|
| 71 | * For subsequent displays, when information is already cached and ready, the method returns NO. |
---|
| 72 | */ |
---|
| 73 | - (BOOL)immediatelyShowLoadingIndicatorForTabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem; |
---|
| 74 | |
---|
| 75 | @end |
---|
| 76 | |
---|