]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/auimanager.tex
removed empty and unused CalculateScrollbar() method
[wxWidgets.git] / docs / latex / wx / auimanager.tex
CommitLineData
e67635d4
RR
1\section{\class{wxAuiManager}}\label{wxauimanager}
2
3wxAuiManager is the central class of the wxAUI class framework.
4
5See also \helpref{wxAUI overview}{wxauioverview}.
6
7wxAuiManager manages the panes associated with it
8for a particular wxFrame, using a pane's wxAuiPaneInfo information to
9determine each pane's docking and floating behavior. wxAuiManager
10uses wxWidgets' sizer mechanism to plan the layout of each frame. It
11uses a replaceable dock art class to do all drawing, so all drawing is
12localized in one area, and may be customized depending on an
7f28a656 13application's specific needs.
e67635d4 14
7f28a656 15wxAuiManager works as follows: the programmer adds panes to the class,
e67635d4
RR
16or makes changes to existing pane properties (dock position, floating
17state, show state, etc.). To apply these changes, wxAuiManager's
18Update() function is called. This batch processing can be used to avoid
19flicker, by modifying more than one pane at a time, and then "committing"
20all of the changes at once by calling Update().
21
22Panes can be added quite easily:
23
24\begin{verbatim}
25wxTextCtrl* text1 = new wxTextCtrl(this, -1);
26wxTextCtrl* text2 = new wxTextCtrl(this, -1);
27m_mgr.AddPane(text1, wxLEFT, wxT("Pane Caption"));
28m_mgr.AddPane(text2, wxBOTTOM, wxT("Pane Caption"));
29m_mgr.Update();
30\end{verbatim}
31
32Later on, the positions can be modified easily. The following will float
33an existing pane in a tool window:
34
35\begin{verbatim}
36m_mgr.GetPane(text1).Float();
37\end{verbatim}
38
39\wxheading{Layers, Rows and Directions, Positions}
40
41Inside wxAUI, the docking layout is figured out by checking several
42pane parameters. Four of these are important for determining where a
43pane will end up:
44
45{\bf Direction:}
46Each docked pane has a direction, Top, Bottom, Left, Right, or
47Center. This is fairly self-explanatory. The pane will be placed in the
48location specified by this variable.
49
50{\bf Position:}
7f28a656 51More than one pane can be placed inside of a dock. Imagine two panes
e67635d4
RR
52being docked on the left side of a window. One pane can be placed over
53another. In proportionally managed docks, the pane position indicates
7f28a656 54its sequential position, starting with zero. So, in our scenario with
e67635d4
RR
55two panes docked on the left side, the top pane in the dock would have
56position 0, and the second one would occupy position 1.
57
58{\bf Row:}
59A row can allow for two docks to be placed next to each other. One of
60the most common places for this to happen is in the toolbar. Multiple
7f28a656
JS
61toolbar rows are allowed, the first row being row 0, and the second
62row 1. Rows can also be used on vertically docked panes.
e67635d4
RR
63
64{\bf Layer:}
65A layer is akin to an onion. Layer 0 is the very center of the
66managed pane. Thus, if a pane is in layer 0, it will be closest to the
67center window (also sometimes known as the "content window").
68Increasing layers "swallow up" all layers of a lower value. This can
69look very similar to multiple rows, but is different because all panes
70in a lower level yield to panes in higher levels. The best way to
71understand layers is by running the wxAUI sample.
72
73\wxheading{Derived from}
74
7f28a656 75\helpref{wxEvtHandler}{wxevthandler}
e67635d4
RR
76
77\wxheading{Include files}
78
79<wx/aui/aui.h>
80
81\wxheading{See also}
82
83\helpref{wxAuiPaneInfo}{wxauipaneinfo},
84\helpref{wxAuiDockArt}{wxauidockart}
85
86\wxheading{Data structures}
87
88\begin{verbatim}
89enum wxAuiManagerDock
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}
102enum wxAuiManagerOption
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_VENETIAN_BLINDS_HINT = 1 << 4,
109 wxAUI_MGR_RECTANGLE_HINT = 1 << 5,
110 wxAUI_MGR_HINT_FADE = 1 << 6,
111 wxAUI_MGR_NO_VENETIAN_BLINDS_FADE = 1 << 7,
112
113 wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
114 wxAUI_MGR_TRANSPARENT_HINT |
115 wxAUI_MGR_HINT_FADE |
116 wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
117}
118\end{verbatim}
119
120
121\latexignore{\rtfignore{\wxheading{Members}}}
122
123
124\membersection{wxAuiManager::wxAuiManager}\label{wxauimanagerwxauimanager}
125
126\func{}{wxAuiManager}{\param{wxWindow* }{managed\_wnd = NULL}, \param{unsigned int }{flags = wxAUI\_MGR\_DEFAULT}}
127
128Constructor. \arg{frame} specifies the wxFrame which should be managed.
129\arg{flags} specifies options which allow the frame management behavior
130to be modified.
131
132\membersection{wxAuiManager::\destruct{wxAuiManager}}\label{wxauimanagerdtor}
133
134\func{}{\destruct{wxAuiManager}}{\void}
135
136\membersection{wxAuiManager::AddPane}\label{wxauimanageraddpane}
137
138\func{bool}{AddPane}{\param{wxWindow* }{window}, \param{const wxAuiPaneInfo\& }{pane\_info}}
139
140\func{bool}{AddPane}{\param{wxWindow* }{window}, \param{int }{direction = wxLEFT}, \param{const wxString\& }{caption = wxEmptyString}}
141
142\func{bool}{AddPane}{\param{wxWindow* }{window}, \param{const wxAuiPaneInfo\& }{pane\_info}, \param{const wxPoint\& }{drop\_pos}}
143
144
145AddPane() tells the frame manager to start managing a child window. There are several versions of this function. The first version allows the full spectrum of pane parameter possibilities. The second version is used for simpler user interfaces which do not require as much configuration. The last version allows a drop position to be specified, which will determine where the pane will be added.
146
147\membersection{wxAuiManager::DetachPane}\label{wxauimanagerdetachpane}
148
149\func{bool}{DetachPane}{\param{wxWindow* }{window}}
150
151Tells the wxAuiManager to stop managing the pane specified by window.
152The window, if in a floated frame, is reparented to the frame managed
153by wxAuiManager.
154
155\membersection{wxAuiManager::GetAllPanes}\label{wxauimanagergetallpanes}
156
157\func{wxAuiPaneInfoArray\&}{GetAllPanes}{\void}
158
159Returns an array of all panes managed by the frame manager.
160
161\membersection{wxAuiManager::GetArtProvider}\label{wxauimanagergetartprovider}
162
163\constfunc{wxAuiDockArt*}{GetArtProvider}{\void}
164
165Returns the current art provider being used.
166
167See also: \helpref{wxAuiDockArt}{wxauidockart}.
168
e2622169 169\func{void}{GetDockSizeConstraint}{\param{double* }{widthpct}, \param{double* }{heightpct}}
9670b83c
VZ
170
171Returns the current dock constraint values. See SetDockSizeConstraint() for more information.
172
e67635d4
RR
173\membersection{wxAuiManager::GetFlags}\label{wxauimanagergetflags}
174
175\constfunc{unsigned int}{GetFlags}{\void}
176
177Returns the current manager's flags.
178
179\membersection{wxAuiManager::GetManagedWindow}\label{wxauimanagergetmanagedwindow}
180
181\constfunc{wxWindow*}{GetManagedWindow}{\void}
182
183Returns the frame currently being managed by wxAuiManager.
184
a95dd1d8
BW
185\func{static wxAuiManager*}{GetManager}{\param{wxWindow* }{window}}
186
187Calling this method will return the wxAuiManager for a given window. The \arg{window} parameter should
188specify any child window or sub-child window of the frame or window managed by wxAuiManager.
189The \arg{window} parameter need not be managed by the manager itself, nor does it even need to be a child
190or sub-child of a managed window. It must however be inside the window hierarchy underneath the managed
191window.
192
e67635d4
RR
193\membersection{wxAuiManager::GetPane}\label{wxauimanagergetpane}
194
195\func{wxAuiPaneInfo\&}{GetPane}{\param{wxWindow* }{window}}
196
197\func{wxAuiPaneInfo\&}{GetPane}{\param{const wxString\& }{name}}
198
199{\it GetPane} is used to lookup a wxAuiPaneInfo object
200either by window pointer or by pane name, which acts as a unique id for
201a window pane. The returned wxAuiPaneInfo object may then be modified to
202change a pane's look, state or position. After one or more
203modifications to wxAuiPaneInfo, wxAuiManager::Update() should be called
204to commit the changes to the user interface. If the lookup failed
205(meaning the pane could not be found in the manager), a call to the
206returned wxAuiPaneInfo's IsOk() method will return false.
207
208\membersection{wxAuiManager::HideHint}\label{wxauimanagerhidehint}
209
210\func{void}{HideHint}{\void}
211
212HideHint() hides any docking hint that may be visible.
213
214\membersection{wxAuiManager::InsertPane}\label{wxauimanagerinsertpane}
215
216\func{bool}{InsertPane}{\param{wxWindow* }{window}, \param{const wxAuiPaneInfo\& }{insert\_location}, \param{int }{insert\_level = wxAUI\_INSERT\_PANE}}
217
218This method is used to insert either a previously unmanaged pane window
219into the frame manager, or to insert a currently managed pane somewhere
220else. {\it InsertPane} will push all panes, rows, or docks aside and
221insert the window into the position specified by \arg{insert\_location}.
222Because \arg{insert\_location} can specify either a pane, dock row, or dock
223layer, the \arg{insert\_level} parameter is used to disambiguate this. The
224parameter \arg{insert\_level} can take a value of wxAUI\_INSERT\_PANE, wxAUI\_INSERT\_ROW
225or wxAUI\_INSERT\_DOCK.
226
227\membersection{wxAuiManager::LoadPaneInfo}\label{wxauimanagerloadpaneinfo}
228
229\func{void}{LoadPaneInfo}{\param{wxString }{pane\_part}, \param{wxAuiPaneInfo\& }{pane}}
230
231LoadPaneInfo() is similar to to LoadPerspective, with the exception that it only loads information about a single pane. It is used in combination with SavePaneInfo().
232
233\membersection{wxAuiManager::LoadPerspective}\label{wxauimanagerloadperspective}
234
235\func{bool}{LoadPerspective}{\param{const wxString\& }{perspective}, \param{bool }{update = true}}
236
237Loads a saved perspective. If update is true, wxAuiManager::Update()
238is automatically invoked, thus realizing the saved perspective on screen.
239
240\membersection{wxAuiManager::ProcessDockResult}\label{wxauimanagerprocessdockresult}
241
242\func{bool}{ProcessDockResult}{\param{wxAuiPaneInfo\& }{target}, \param{const wxAuiPaneInfo\& }{new\_pos}}
243
244ProcessDockResult() is a protected member of the wxAUI layout manager. It can be overridden by derived classes to provide custom docking calculations.
245
246\membersection{wxAuiManager::SavePaneInfo}\label{wxauimanagersavepaneinfo}
247
248\func{wxString}{SavePaneInfo}{\param{wxAuiPaneInfo\& }{pane}}
249
250SavePaneInfo() is similar to SavePerspective, with the exception that it only saves information about a single pane. It is used in combination with LoadPaneInfo().
251
252\membersection{wxAuiManager::SavePerspective}\label{wxauimanagersaveperspective}
253
254\func{wxString}{SavePerspective}{\void}
255
256Saves the entire user interface layout into an encoded wxString, which
257can then be stored by the application (probably using wxConfig). When
258a perspective is restored using LoadPerspective(), the entire user
259interface will return to the state it was when the perspective was saved.
260
261\membersection{wxAuiManager::SetArtProvider}\label{wxauimanagersetartprovider}
262
263\func{void}{SetArtProvider}{\param{wxAuiDockArt* }{art\_provider}}
264
265Instructs wxAuiManager to use art provider specified by parameter
266\arg{art\_provider} for all drawing calls. This allows plugable
267look-and-feel features. The previous art provider object, if any,
268will be deleted by wxAuiManager.
269
270See also: \helpref{wxAuiDockArt}{wxauidockart}.
271
e2622169 272\func{void}{SetDockSizeConstraint}{\param{double }{widthpct}, \param{double }{heightpct}}
9670b83c
VZ
273
274When a user creates a new dock by dragging a window into a docked position, often times the large size of the
275window will create a dock that is unwieldly large. wxAuiManager by default limits the size of any
276new dock to 1/3 of the window size. For horizontal docks, this would be 1/3 of the window height. For
277vertical docks, 1/3 of the width. Calling this function will adjust this constraint value. The numbers
278must be between 0.0 and 1.0. For instance, calling SetDockSizeContraint with 0.5, 0.5 will cause new
279docks to be limited to half of the size of the entire managed window.
280
e67635d4
RR
281\membersection{wxAuiManager::SetFlags}\label{wxauimanagersetflags}
282
283\func{void}{SetFlags}{\param{unsigned int }{flags}}
284
285This method is used to specify wxAuiManager's settings flags. \arg{flags}
286specifies options which allow the frame management behavior to be modified.
287
288\membersection{wxAuiManager::SetManagedWindow}\label{wxauimanagersetmanagedwindow}
289
290\func{void}{SetManagedWindow}{\param{wxWindow* }{managed\_wnd}}
291
292Called to specify the frame or window which is to be managed by wxAuiManager. Frame management is not restricted to just frames. Child windows or custom controls are also allowed.
293
294\membersection{wxAuiManager::ShowHint}\label{wxauimanagershowhint}
295
296\func{void}{ShowHint}{\param{const wxRect\& }{rect}}
297
298This function is used by controls to explicitly show a hint window at the specified rectangle. It is rarely called, and is mostly used by controls implementing custom pane drag/drop behaviour. The specified rectangle should be in screen coordinates.
299
300\membersection{wxAuiManager::UnInit}\label{wxauimanageruninit}
301
302\func{void}{UnInit}{\void}
303
304Uninitializes the framework and should be called before a managed frame or window is destroyed. UnInit() is usually called in the managed wxFrame's destructor. It is necessary to call this function before the managed frame or window is destroyed, otherwise the manager cannot remove its custom event handlers from a window.
305
306\membersection{wxAuiManager::Update}\label{wxauimanagerupdate}
307
308\func{void}{Update}{\void}
309
310This method is called after any number of changes are
311made to any of the managed panes. Update() must be invoked after
312AddPane() or InsertPane() are called in order to "realize" or "commit"
313the changes. In addition, any number of changes may be made to
314wxAuiPaneInfo structures (retrieved with wxAuiManager::GetPane), but to
315realize the changes, Update() must be called. This construction allows
316pane flicker to be avoided by updating the whole layout at one time.
317