]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/framemanager.tex
document what exactly SetAlignment() expects (bug 1232727) + other minor corrections
[wxWidgets.git] / docs / latex / wx / framemanager.tex
1 \section{\class{wxFrameManager}}\label{wxframemanager}
2
3 wxFrameManager is the central class of the wxAUI class framework.
4
5 See also \helpref{wxAUI overview}{wxauioverview}.
6
7 wxFrameManager manages the panes associated with it
8 for a particular wxFrame, using a pane's wxPaneInfo information to
9 determine each pane's docking and floating behavior. wxFrameManager
10 uses wxWidgets' sizer mechanism to plan the layout of each frame. It
11 uses a replaceable dock art class to do all drawing, so all drawing is
12 localized in one area, and may be customized depending on an
13 applications' specific needs.
14
15 wxFrameManager works as follows: The programmer adds panes to the class,
16 or makes changes to existing pane properties (dock position, floating
17 state, show state, etc.). To apply these changes, wxFrameManager's
18 Update() function is called. This batch processing can be used to avoid
19 flicker, by modifying more than one pane at a time, and then "committing"
20 all of the changes at once by calling Update().
21
22 Panes can be added quite easily:
23
24 \begin{verbatim}
25 wxTextCtrl* text1 = new wxTextCtrl(this, -1);
26 wxTextCtrl* text2 = new wxTextCtrl(this, -1);
27 m_mgr.AddPane(text1, wxLEFT, wxT("Pane Caption"));
28 m_mgr.AddPane(text2, wxBOTTOM, wxT("Pane Caption"));
29 m_mgr.Update();
30 \end{verbatim}
31
32 Later on, the positions can be modified easily. The following will float
33 an existing pane in a tool window:
34
35 \begin{verbatim}
36 m_mgr.GetPane(text1).Float();
37 \end{verbatim}
38
39 \wxheading{Layers, Rows and Directions, Positions}
40
41 Inside wxAUI, the docking layout is figured out by checking several
42 pane parameters. Four of these are important for determining where a
43 pane will end up:
44
45 {\bf Direction:}
46 Each docked pane has a direction, Top, Bottom, Left, Right, or
47 Center. This is fairly self-explanatory. The pane will be placed in the
48 location specified by this variable.
49
50 {\bf Position:}
51 More than one pane can be placed inside of a dock. Imagine to panes
52 being docked on the left side of a window. One pane can be placed over
53 another. In proportionally managed docks, the pane position indicates
54 it's sequential position, starting with zero. So, in our scenario with
55 two panes docked on the left side, the top pane in the dock would have
56 position 0, and the second one would occupy position 1.
57
58 {\bf Row:}
59 A row can allow for two docks to be placed next to each other. One of
60 the most common places for this to happen is in the toolbar. Multiple
61 toolbar rows are allowed, the first row being in row 0, and the second
62 in row 1. Rows can also be used on vertically docked panes.
63
64
65 {\bf Layer:}
66 A layer is akin to an onion. Layer 0 is the very center of the
67 managed pane. Thus, if a pane is in layer 0, it will be closest to the
68 center window (also sometimes known as the "content window").
69 Increasing layers "swallow up" all layers of a lower value. This can
70 look very similar to multiple rows, but is different because all panes
71 in a lower level yield to panes in higher levels. The best way to
72 understand layers is by running the wxAUI sample.
73
74 \wxheading{Derived from}
75
76 \helpref{wxEvent}{wxevent}
77
78 \wxheading{Include files}
79
80 <wx/aui/aui.h>
81
82 \wxheading{See also}
83
84 \helpref{wxPaneInfo}{wxpaneinfo}
85
86 \wxheading{Data structures}
87
88 \begin{verbatim}
89 enum wxFrameManagerDock
90 {
91 wxAUI_DOCK_NONE = 0,
92 wxAUI_DOCK_TOP = 1,
93 wxAUI_DOCK_RIGHT = 2,
94 wxAUI_DOCK_BOTTOM = 3,
95 wxAUI_DOCK_LEFT = 4,
96 wxAUI_DOCK_CENTER = 5,
97 wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER
98 }
99 \end{verbatim}
100
101 \begin{verbatim}
102 enum wxFrameManagerOption
103 {
104 wxAUI_MGR_ALLOW_FLOATING = 1 << 0,
105 wxAUI_MGR_ALLOW_ACTIVE_PANE = 1 << 1,
106 wxAUI_MGR_TRANSPARENT_DRAG = 1 << 2,
107 wxAUI_MGR_TRANSPARENT_HINT = 1 << 3,
108 wxAUI_MGR_TRANSPARENT_HINT_FADE = 1 << 4,
109 wxAUI_MGR_DISABLE_VENETIAN_BLINDS = 1 << 5,
110 wxAUI_MGR_DISABLE_VENETIAN_BLINDS_FADE = 1 << 6,
111
112 wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
113 wxAUI_MGR_TRANSPARENT_HINT |
114 wxAUI_MGR_TRANSPARENT_HINT_FADE |
115 wxAUI_MGR_DISABLE_VENETIAN_BLINDS_FADE
116 }
117 \end{verbatim}
118
119
120 \latexignore{\rtfignore{\wxheading{Members}}}
121
122
123 \membersection{wxFrameManager::wxFrameManager}\label{wxframemanagerwxframemanager}
124
125 \func{}{wxFrameManager}{\param{wxWindow* }{managed\_wnd = NULL}, \param{unsigned int }{flags = wxAUI\_MGR\_DEFAULT}}
126
127 Constructor. \arg{frame} specifies the wxFrame which should be managed.
128 \arg{flags} specifies options which allow the frame management behavior
129 to be modified.
130
131 \membersection{wxFrameManager::\destruct{wxFrameManager}}\label{wxframemanagerdtor}
132
133 \func{}{\destruct{wxFrameManager}}{\void}
134
135
136 \membersection{wxFrameManager::AddPane}\label{wxframemanageraddpane}
137
138 \func{bool}{AddPane}{\param{wxWindow* }{window}, \param{const wxPaneInfo\& }{pane\_info}}
139
140
141 \func{bool}{AddPane}{\param{wxWindow* }{window}, \param{const wxPaneInfo\& }{pane\_info}, \param{const wxPoint\& }{drop\_pos}}
142
143
144 \func{bool}{AddPane}{\param{wxWindow* }{window}, \param{int }{direction = wxLEFT}, \param{const wxString\& }{caption = wxEmptyString}}
145
146 Tells the frame manager to start managing a child window.
147
148 \membersection{wxFrameManager::DetachPane}\label{wxframemanagerdetachpane}
149
150 \func{bool}{DetachPane}{\param{wxWindow* }{window}}
151
152 Tells the wxFrameManager to stop managing the pane specified by window.
153 The window, if in a floated frame, is reparented to the frame managed
154 by wxFrameManager.
155
156 \membersection{wxFrameManager::DoDrop}\label{wxframemanagerdodrop}
157
158 \func{bool}{DoDrop}{\param{wxDockInfoArray\& }{docks}, \param{wxPaneInfoArray\& }{panes}, \param{wxPaneInfo\& }{drop}, \param{const wxPoint\& }{pt}, \param{const wxPoint\& }{action\_offset = wxPoint(0,0)}}
159
160
161 \membersection{wxFrameManager::DoFrameLayout}\label{wxframemanagerdoframelayout}
162
163 \func{void}{DoFrameLayout}{\void}
164
165
166 \membersection{wxFrameManager::DrawHintRect}\label{wxframemanagerdrawhintrect}
167
168 \func{void}{DrawHintRect}{\param{wxWindow* }{pane\_window}, \param{const wxPoint\& }{pt}, \param{const wxPoint\& }{offset}}
169
170
171 \membersection{wxFrameManager::GetAllPanes}\label{wxframemanagergetallpanes}
172
173 \func{wxPaneInfoArray\&}{GetAllPanes}{\void}
174
175 Returns an array of all panes managed by the frame manager.
176
177 \membersection{wxFrameManager::GetArtProvider}\label{wxframemanagergetartprovider}
178
179 \constfunc{wxDockArt*}{GetArtProvider}{\void}
180
181 Returns the current art provider being used.
182
183 \membersection{wxFrameManager::GetDockPixelOffset}\label{wxframemanagergetdockpixeloffset}
184
185 \func{int}{GetDockPixelOffset}{\param{wxPaneInfo\& }{test}}
186
187
188 \membersection{wxFrameManager::GetFlags}\label{wxframemanagergetflags}
189
190 \constfunc{unsigned int}{GetFlags}{\void}
191
192 Returns the current manager's flags.
193
194 \membersection{wxFrameManager::GetManagedWindow}\label{wxframemanagergetmanagedwindow}
195
196 \constfunc{wxWindow*}{GetManagedWindow}{\void}
197
198 Returns the frame currently being managed by wxFrameManager.
199
200 \membersection{wxFrameManager::GetPane}\label{wxframemanagergetpane}
201
202 \func{wxPaneInfo\&}{GetPane}{\param{wxWindow* }{window}}
203
204 {\it GetPanel} is used to lookup a wxPaneInfo object
205 either by window pointer or by pane name, which acts as a unique id for
206 a window pane. The returned wxPaneInfo object may then be modified to
207 change a pane's look, state or position. After one or more
208 modifications to wxPaneInfo, wxFrameManager::Update() should be called
209 to commit the changes to the user interface. If the lookup failed
210 (meaning the pane could not be found in the manager), a call to the
211 returned wxPaneInfo's IsOk() method will return false.
212
213 \func{wxPaneInfo\&}{GetPane}{\param{const wxString\& }{name}}
214
215
216 \membersection{wxFrameManager::GetPanePart}\label{wxframemanagergetpanepart}
217
218 \func{wxDockUIPart*}{GetPanePart}{\param{wxWindow* }{pane}}
219
220
221 \membersection{wxFrameManager::GetPanePositionsAndSizes}\label{wxframemanagergetpanepositionsandsizes}
222
223 \func{void}{GetPanePositionsAndSizes}{\param{wxDockInfo\& }{dock}, \param{wxArrayInt\& }{positions}, \param{wxArrayInt\& }{sizes}}
224
225
226 \membersection{wxFrameManager::HideHint}\label{wxframemanagerhidehint}
227
228 \func{void}{HideHint}{\void}
229
230
231 \membersection{wxFrameManager::HitTest}\label{wxframemanagerhittest}
232
233 \func{wxDockUIPart*}{HitTest}{\param{int }{x}, \param{int }{y}}
234
235
236 \membersection{wxFrameManager::InsertPane}\label{wxframemanagerinsertpane}
237
238 \func{bool}{InsertPane}{\param{wxWindow* }{window}, \param{const wxPaneInfo\& }{insert\_location}, \param{int }{insert\_level = wxAUI\_INSERT\_PANE}}
239
240 This method is used to insert either a previously unmanaged pane window
241 into the frame manager, or to insert a currently managed pane somewhere
242 else. {\it InsertPane} will push all panes, rows, or docks aside and
243 insert the window into the position specified by \arg{insert\_location}.
244 Because \arg{insert\_location} can specify either a pane, dock row, or dock
245 layer, the \arg{insert\_level} parameter is used to disambiguate this. The
246 parameter \arg{insert\_level} can take a value of wxAUI\_INSERT\_PANE, wxAUI\_INSERT\_ROW
247 or wxAUI\_INSERT\_DOCK.
248
249 \membersection{wxFrameManager::LayoutAddDock}\label{wxframemanagerlayoutadddock}
250
251 \func{void}{LayoutAddDock}{\param{wxSizer* }{container}, \param{wxDockInfo\& }{dock}, \param{wxDockUIPartArray\& }{uiparts}, \param{bool }{spacer\_only}}
252
253
254 \membersection{wxFrameManager::LayoutAddPane}\label{wxframemanagerlayoutaddpane}
255
256 \func{void}{LayoutAddPane}{\param{wxSizer* }{container}, \param{wxDockInfo\& }{dock}, \param{wxPaneInfo\& }{pane}, \param{wxDockUIPartArray\& }{uiparts}, \param{bool }{spacer\_only}}
257
258
259 \membersection{wxFrameManager::LayoutAll}\label{wxframemanagerlayoutall}
260
261 \func{wxSizer*}{LayoutAll}{\param{wxPaneInfoArray\& }{panes}, \param{wxDockInfoArray\& }{docks}, \param{wxDockUIPartArray\& }{uiparts}, \param{bool }{spacer\_only = false}}
262
263
264 \membersection{wxFrameManager::LoadPaneInfo}\label{wxframemanagerloadpaneinfo}
265
266 \func{void}{LoadPaneInfo}{\param{wxString }{pane\_part}, \param{wxPaneInfo\& }{pane}}
267
268
269 \membersection{wxFrameManager::LoadPerspective}\label{wxframemanagerloadperspective}
270
271 \func{bool}{LoadPerspective}{\param{const wxString\& }{perspective}, \param{bool }{update = true}}
272
273 Loads a saved perspective. If update is true, wxFrameManager::Update()
274 is automatically invoked, thus realizing the saved perspective on screen.
275
276 \membersection{wxFrameManager::LookupPane}\label{wxframemanagerlookuppane}
277
278 \func{wxPaneInfo\&}{LookupPane}{\param{wxWindow* }{window}}
279
280
281 \func{wxPaneInfo\&}{LookupPane}{\param{const wxString\& }{name}}
282
283
284 \membersection{wxFrameManager::ProcessDockResult}\label{wxframemanagerprocessdockresult}
285
286 \func{bool}{ProcessDockResult}{\param{wxPaneInfo\& }{target}, \param{const wxPaneInfo\& }{new\_pos}}
287
288
289 \membersection{wxFrameManager::ProcessMgrEvent}\label{wxframemanagerprocessmgrevent}
290
291 \func{void}{ProcessMgrEvent}{\param{wxFrameManagerEvent\& }{event}}
292
293
294 \membersection{wxFrameManager::Render}\label{wxframemanagerrender}
295
296 \func{void}{Render}{\param{wxDC* }{dc}}
297
298
299 \membersection{wxFrameManager::Repaint}\label{wxframemanagerrepaint}
300
301 \func{void}{Repaint}{\param{wxDC* }{dc = NULL}}
302
303
304 \membersection{wxFrameManager::SavePaneInfo}\label{wxframemanagersavepaneinfo}
305
306 \func{wxString}{SavePaneInfo}{\param{wxPaneInfo\& }{pane}}
307
308
309 \membersection{wxFrameManager::SavePerspective}\label{wxframemanagersaveperspective}
310
311 \func{wxString}{SavePerspective}{\void}
312
313 Saves the entire user interface layout into an encoded wxString, which
314 can then be stored by the application (probably using wxConfig). When
315 a perspective is restored using LoadPerspective(), the entire user
316 interface will return to the state it was when the perspective was saved.
317
318 \membersection{wxFrameManager::SetArtProvider}\label{wxframemanagersetartprovider}
319
320 \func{void}{SetArtProvider}{\param{wxDockArt* }{art\_provider}}
321
322 Instructs wxFrameManager to use art provider specified by parameter
323 \arg{art\_provider} for all drawing calls. This allows plugable
324 look-and-feel features. The previous art provider object, if any,
325 will be deleted by wxFrameManager.
326
327 \membersection{wxFrameManager::SetFlags}\label{wxframemanagersetflags}
328
329 \func{void}{SetFlags}{\param{unsigned int }{flags}}
330
331 This method is used to specify wxFrameManager's settings flags. \arg{flags}
332 specifies options which allow the frame management behavior to be modified.
333
334 \membersection{wxFrameManager::SetManagedWindow}\label{wxframemanagersetmanagedwindow}
335
336 \func{void}{SetManagedWindow}{\param{wxWindow* }{managed\_wnd}}
337
338 Called to specify the frame which is to be managed by wxFrameManager.
339
340 \membersection{wxFrameManager::ShowHint}\label{wxframemanagershowhint}
341
342 \func{void}{ShowHint}{\param{const wxRect\& }{rect}}
343
344
345 \membersection{wxFrameManager::UnInit}\label{wxframemanageruninit}
346
347 \func{void}{UnInit}{\void}
348
349 Uninitializes the framework and should be called before a frame is
350 destroyed. UnInit() is usually called in the managed wxFrame's destructor.
351
352 \membersection{wxFrameManager::Update}\label{wxframemanagerupdate}
353
354 \func{void}{Update}{\void}
355
356 This method is called after any number of changes are
357 made to any of the managed panes. Update() must be invoked after
358 AddPane() or InsertPane() are called in order to "realize" or "commit"
359 the changes. In addition, any number of changes may be made to
360 wxPaneInfo structures (retrieved with wxFrameManager::GetPane), but to
361 realize the changes, Update() must be called. This construction allows
362 pane flicker to be avoided by updating the whole layout at one time.
363
364 \membersection{wxFrameManager::UpdateButtonOnScreen}\label{wxframemanagerupdatebuttononscreen}
365
366 \func{void}{UpdateButtonOnScreen}{\param{wxDockUIPart* }{button\_ui\_part}, \param{const wxMouseEvent\& }{event}}
367
368
369 \membersection{wxFrameManager::wxDEPRECATED}\label{wxframemanagerwxdeprecated}
370
371 \func{}{wxDEPRECATED}{\param{void }{SetFrame(wxFrame* frame)}}
372
373 deprecated -- please use SetManagedWindow() and
374 and GetManagedWindow() instead
375
376
377 \func{}{wxDEPRECATED}{\param{wxFrame* GetFrame() }{const}}
378