1 /*
2    <title>NSToolbarFrameworkPrivate.h</title>
3 
4    <abstract>Private methods used throughout the toolbar classes.</abstract>
5 
6    Copyright (C) 2009 Free Software Foundation, Inc.
7 
8    Author: Fred Kiefer <fredkiefer@gmx.de>
9    Date: January 2009
10 
11    This file is part of the GNUstep GUI Library.
12 
13    This library is free software; you can redistribute it and/or
14    modify it under the terms of the GNU Lesser General Public
15    License as published by the Free Software Foundation; either
16    version 2 of the License, or (at your option) any later version.
17 
18    This library is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
21    Lesser General Public License for more details.
22 
23    You should have received a copy of the GNU Lesser General Public
24    License along with this library; see the file COPYING.LIB.
25    If not, see <http://www.gnu.org/licenses/> or write to the
26    Free Software Foundation, 51 Franklin Street, Fifth Floor,
27    Boston, MA 02110-1301, USA.
28 */
29 
30 #ifndef _NSToolbarFrameworkPrivate_h_INCLUDE
31 #define _NSToolbarFrameworkPrivate_h_INCLUDE
32 
33 #import "AppKit/NSMenuView.h"
34 #import "AppKit/NSToolbar.h"
35 #import "AppKit/NSToolbarItem.h"
36 #import "GNUstepGUI/GSToolbarView.h"
37 #import "GNUstepGUI/GSWindowDecorationView.h"
38 
39 @interface GSToolbarView (GNUstepPrivate)
40 - (void) _reload;
41 
42 // Accessors
43 - (float) _heightFromLayout;
44 - (NSArray *) _visibleBackViews;
45 
46 - (BOOL) _usesStandardBackgroundColor;
47 - (void) _setUsesStandardBackgroundColor: (BOOL)standard;
48 @end
49 
50 @interface NSToolbarItem (GNUstepPrivate)
51 - (void) _layout;
52 - (void) _computeFlags;
53 
54 // Accessors
55 - (NSView *) _backView;
56 - (NSMenuItem *) _defaultMenuFormRepresentation;
57 - (BOOL) _isModified;
58 - (BOOL) _isFlexibleSpace;
59 - (BOOL) _selectable;
60 - (void) _setSelectable: (BOOL)selectable;
61 - (BOOL) _selected;
62 - (void) _setSelected: (BOOL)selected;
63 - (void) _setToolbar: (NSToolbar *)toolbar;
64 @end
65 
66 @interface NSToolbar (GNUstepPrivate)
67 // Private class method
68 + (NSArray *) _toolbarsWithIdentifier: (NSString *)identifier;
69 
70 // Private methods with broadcast support
71 - (void) _insertItemWithItemIdentifier: (NSString *)itemIdentifier
72                                atIndex: (int)index
73                              broadcast: (BOOL)broadcast;
74 - (void) _removeItemAtIndex: (int)index broadcast: (BOOL)broadcast;
75 - (void) _setAllowsUserCustomization: (BOOL)flag broadcast: (BOOL)broadcast;
76 - (void) _setAutosavesConfiguration: (BOOL)flag broadcast: (BOOL)broadcast;
77 - (void) _setConfigurationFromDictionary: (NSDictionary *)configDict
78                                broadcast: (BOOL)broadcast;
79 - (void) _moveItemFromIndex: (int)index toIndex: (int)newIndex broadcast: (BOOL)broadcast;
80 - (void) _setDisplayMode: (NSToolbarDisplayMode)displayMode
81                broadcast: (BOOL)broadcast;
82 - (void) _setSizeMode: (NSToolbarSizeMode)sizeMode
83             broadcast: (BOOL)broadcast;
84 - (void) _setVisible: (BOOL)shown broadcast: (BOOL)broadcast;
85 
86 // Few other private methods
87 - (void) _build;
88 - (int) _indexOfItem: (NSToolbarItem *)item;
89 - (void) _concludeRemoveItem: (NSToolbarItem *)item
90          atIndex: (int)index
91          broadcast: (BOOL)broadcast;
92 - (void) _insertPassivelyItem: (NSToolbarItem *)item atIndex: (int)newIndex;
93 - (void) _performRemoveItem: (NSToolbarItem *)item; // Used by drag setup
94 - (NSToolbar *) _toolbarModel;
95 - (void) _validate: (NSWindow *)observedWindow;
96 - (void) _toolbarViewWillMoveToSuperview: (NSView *)newSuperview;
97 - (void) _saveConfig;
98 - (void) _resetConfig;
99 - (NSArray *) _itemsFromConfig;
100 - (BOOL) _containsItemWithIdentifier: (NSString *) identifier;
101 
102 // Accessors
103 - (void) _setCustomizationPaletteIsRunning: (BOOL)isRunning;
104 - (void) _setToolbarView: (GSToolbarView *)toolbarView;
105 - (GSToolbarView *) _toolbarView;
106 
107 // Deprecated
108 - (void) setUsesStandardBackgroundColor: (BOOL)standard;
109 - (BOOL) usesStandardBackgroundColor;
110 
111 // Delegate wrappers
112 - (NSArray *) _allowedItemIdentifiers;
113 - (NSArray *) _defaultItemIdentifiers;
114 - (NSArray *) _selectableItemIdentifiers;
115 - (NSToolbarItem *) _toolbarItemForIdentifier: (NSString *)itemIdent willBeInsertedIntoToolbar: (BOOL)insert;
116 
117 @end
118 
119 @interface GSWindowDecorationView (ToolbarPrivate)
120 - (void) addToolbarView: (GSToolbarView*)toolbarView;
121 - (void) removeToolbarView: (GSToolbarView *)toolbarView;
122 - (void) adjustToolbarView: (GSToolbarView *)toolbarView;
123 @end
124 @interface GSWindowDecorationView (Menu)
125 - (void) addMenuView: (NSMenuView*)menuView;
126 - (NSMenuView*) removeMenuView;
127 @end
128 
129 #endif // _NSToolbarFrameworkPrivate_h_INCLUDE
130