root/Trunk/AIUtilities.framework/Versions/A/Headers/AIToolbarUtilities.h @ 2

Revision 2, 4.5 KB (checked in by jon, 16 years ago)

Initial commit of skeletal project.

Line 
1/*-------------------------------------------------------------------------------------------------------*\
2| Adium, Copyright (C) 2001-2005, Adam Iser  (adamiser@mac.com | http://www.adiumx.com)                   |
3\---------------------------------------------------------------------------------------------------------/
4 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU
5 | General Public License as published by the Free Software Foundation; either version 2 of the License,
6 | or (at your option) any later version.
7 |
8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9 | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
10 | Public License for more details.
11 |
12 | You should have received a copy of the GNU General Public License along with this program; if not,
13 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
14 \------------------------------------------------------------------------------------------------------ */
15
16
17/*!     @class AIToolbarUtilities <AIToolbarUtilities.h> <AIUtilities/AIToolbarUtilities.h>
18 *      @brief Helpful methods for creating window toolbar items.
19 *
20 *      Methods for conveniently creating, storing, and retrieivng \c NSToolbarItem objects.
21 */
22@interface AIToolbarUtilities : NSObject {
23
24}
25
26/*!     @brief Create an \c NSToolbarItem and add it to an \c NSDictionary
27 *
28*       Calls <code>+toolbarItemWithIdentifier:label:paletteLabel:toolTip:target:settingSelector:itemContent:action:menu:</code> and adds the result to a dictionary (\a theDict).
29 *
30 *      @param theDict A dictionary in which to store the \c NSToolbarItem.
31 *      @param identifier
32 *      @param label
33 *      @param paletteLabel
34 *      @param toolTip
35 *      @param target
36 *      @param action
37 *      @param settingSelector Selector to call on the \c NSToolbarItem after it is created.  It should take a single object, which will be \a itemContent.  May be \c nil.
38 *      @param itemContent Object for \c settingSelector.  May be \c nil.
39 *      @param menu     A menu to set on the \c NSToolbarItem.  It will be automatically encapsulated by an \c NSMenuItem as \c NSToolbarItem requires.
40 */
41+ (void)addToolbarItemToDictionary:(NSMutableDictionary *)theDict
42                                        withIdentifier:(NSString *)identifier
43                                                         label:(NSString *)label
44                                          paletteLabel:(NSString *)paletteLabel
45                                                   toolTip:(NSString *)toolTip
46                                                        target:(id)target
47                                   settingSelector:(SEL)settingSelector
48                                           itemContent:(id)itemContent
49                                                        action:(SEL)action
50                                                          menu:(NSMenu *)menu;
51
52/*!     @brief Convenience method for creating an \c NSToolbarItem
53 *
54 *      Parameters not discussed below are simply set using the \c NSToolbarItem setters; see its documentation for details.
55 *      @param identifier
56 *      @param label
57 *      @param paletteLabel
58 *      @param toolTip
59 *      @param target
60 *      @param action
61 *      @param settingSelector Selector to call on the \c NSToolbarItem after it is created.  It should take a single object, which will be \a itemContent.  May be \c nil.
62 *      @param itemContent Object for \c settingSelector.  May be \c nil.
63 *      @param menu     A menu to set on the \c NSToolbarItem.  It will be automatically encapsulated by an \c NSMenuItem as \c NSToolbarItem requires.
64 */
65+ (NSToolbarItem *)toolbarItemWithIdentifier:(NSString *)identifier
66                                                                           label:(NSString *)label
67                                                                paletteLabel:(NSString *)paletteLabel
68                                                                         toolTip:(NSString *)toolTip
69                                                                          target:(id)target
70                                                         settingSelector:(SEL)settingSelector
71                                                                 itemContent:(id)itemContent
72                                                                          action:(SEL)action
73                                                                                menu:(NSMenu *)menu;
74
75/*!     @brief Retrieve a new \c NSToolbarItem instance based on a dictionary's entry
76 *
77 *      Retrieves a new copy of the \c NSToolbarItem stored in \c theDict with the \c itemIdentifier identifier.  This should be used rather than simply copying the existing \c NSToolbarItem so custom copying behaviors to maintain custom view, image, and menu settings are utilized.
78 *      @param theDict The source \c NSDictionary.
79 *      @param itemIdentifier The identifier of the \c NSToolbarItem previous stored with <code>+addToolbarItemToDictionary:withIdentifier:label:paletteLabel:toolTip:target:settingSelector:itemContent:action:menu:</code>.
80 *      @return The retrieved \c NSToolbarItem.
81 */
82+ (NSToolbarItem *)toolbarItemFromDictionary:(NSDictionary *)theDict withIdentifier:(NSString *)itemIdentifier;
83
84@end
85
86@interface NSObject (AIToolbarUtilitiesAdditions)
87- (void)setToolbarItem:(NSToolbarItem *)item;
88@end
89
Note: See TracBrowser for help on using the browser.