]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/framemanager.tex
Always draw the selection of selected items, not just when they have
[wxWidgets.git] / docs / latex / wx / framemanager.tex
CommitLineData
6ff9dc03
RR
1\section{\class{wxFrameManager}}\label{wxframemanager}
2
3wxFrameManager is the central class of the wxAUI class framework.
4
5See also \helpref{wxAUI overview}{wxauioverview}.
6
7wxFrameManager manages the panes associated with it
8for a particular wxFrame, using a pane's wxPaneInfo information to
9determine each pane's docking and floating behavior. wxFrameManager
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
13applications' specific needs.
14
15wxFrameManager works as follows: The programmer adds panes to the class,
16or makes changes to existing pane properties (dock position, floating
17state, show state, etc.). To apply these changes, wxFrameManager'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:}
51More than one pane can be placed inside of a dock. Imagine to panes
52being docked on the left side of a window. One pane can be placed over
53another. In proportionally managed docks, the pane position indicates
54it's sequential position, starting with zero. So, in our scenario with
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
61toolbar rows are allowed, the first row being in row 0, and the second
62in row 1. Rows can also be used on vertically docked panes.
63
64
65{\bf Layer:}
66A layer is akin to an onion. Layer 0 is the very center of the
67managed pane. Thus, if a pane is in layer 0, it will be closest to the
68center window (also sometimes known as the "content window").
69Increasing layers "swallow up" all layers of a lower value. This can
70look very similar to multiple rows, but is different because all panes
71in a lower level yield to panes in higher levels. The best way to
72understand 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}
89enum 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}
102enum wxFrameManagerOption
103{
2cb1b0a8
BW
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,
6ff9dc03
RR
112
113 wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
114 wxAUI_MGR_TRANSPARENT_HINT |
2cb1b0a8
BW
115 wxAUI_MGR_HINT_FADE |
116 wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
6ff9dc03
RR
117}
118\end{verbatim}
119
120
121\latexignore{\rtfignore{\wxheading{Members}}}
122
123
124\membersection{wxFrameManager::wxFrameManager}\label{wxframemanagerwxframemanager}
125
126\func{}{wxFrameManager}{\param{wxWindow* }{managed\_wnd = NULL}, \param{unsigned int }{flags = wxAUI\_MGR\_DEFAULT}}
127
418ab1e7
VZ
128Constructor. \arg{frame} specifies the wxFrame which should be managed.
129\arg{flags} specifies options which allow the frame management behavior
6ff9dc03
RR
130to be modified.
131
132\membersection{wxFrameManager::\destruct{wxFrameManager}}\label{wxframemanagerdtor}
133
134\func{}{\destruct{wxFrameManager}}{\void}
135
6ff9dc03
RR
136\membersection{wxFrameManager::AddPane}\label{wxframemanageraddpane}
137
138\func{bool}{AddPane}{\param{wxWindow* }{window}, \param{const wxPaneInfo\& }{pane\_info}}
139
2906e7ae 140\func{bool}{AddPane}{\param{wxWindow* }{window}, \param{int }{direction = wxLEFT}, \param{const wxString\& }{caption = wxEmptyString}}
6ff9dc03
RR
141
142\func{bool}{AddPane}{\param{wxWindow* }{window}, \param{const wxPaneInfo\& }{pane\_info}, \param{const wxPoint\& }{drop\_pos}}
143
144
2906e7ae 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.
6ff9dc03
RR
146
147\membersection{wxFrameManager::DetachPane}\label{wxframemanagerdetachpane}
148
149\func{bool}{DetachPane}{\param{wxWindow* }{window}}
150
151Tells the wxFrameManager to stop managing the pane specified by window.
152The window, if in a floated frame, is reparented to the frame managed
153by wxFrameManager.
154
6ff9dc03
RR
155\membersection{wxFrameManager::GetAllPanes}\label{wxframemanagergetallpanes}
156
157\func{wxPaneInfoArray\&}{GetAllPanes}{\void}
158
159Returns an array of all panes managed by the frame manager.
160
161\membersection{wxFrameManager::GetArtProvider}\label{wxframemanagergetartprovider}
162
163\constfunc{wxDockArt*}{GetArtProvider}{\void}
164
165Returns the current art provider being used.
166
6ff9dc03
RR
167\membersection{wxFrameManager::GetFlags}\label{wxframemanagergetflags}
168
169\constfunc{unsigned int}{GetFlags}{\void}
170
171Returns the current manager's flags.
172
173\membersection{wxFrameManager::GetManagedWindow}\label{wxframemanagergetmanagedwindow}
174
175\constfunc{wxWindow*}{GetManagedWindow}{\void}
176
177Returns the frame currently being managed by wxFrameManager.
178
179\membersection{wxFrameManager::GetPane}\label{wxframemanagergetpane}
180
181\func{wxPaneInfo\&}{GetPane}{\param{wxWindow* }{window}}
182
2906e7ae
BW
183\func{wxPaneInfo\&}{GetPane}{\param{const wxString\& }{name}}
184
185{\it GetPane} is used to lookup a wxPaneInfo object
6ff9dc03
RR
186either by window pointer or by pane name, which acts as a unique id for
187a window pane. The returned wxPaneInfo object may then be modified to
188change a pane's look, state or position. After one or more
189modifications to wxPaneInfo, wxFrameManager::Update() should be called
190to commit the changes to the user interface. If the lookup failed
191(meaning the pane could not be found in the manager), a call to the
192returned wxPaneInfo's IsOk() method will return false.
193
6ff9dc03
RR
194\membersection{wxFrameManager::HideHint}\label{wxframemanagerhidehint}
195
196\func{void}{HideHint}{\void}
197
2906e7ae 198HideHint() hides any docking hint that may be visible.
6ff9dc03
RR
199
200\membersection{wxFrameManager::InsertPane}\label{wxframemanagerinsertpane}
201
202\func{bool}{InsertPane}{\param{wxWindow* }{window}, \param{const wxPaneInfo\& }{insert\_location}, \param{int }{insert\_level = wxAUI\_INSERT\_PANE}}
203
204This method is used to insert either a previously unmanaged pane window
205into the frame manager, or to insert a currently managed pane somewhere
206else. {\it InsertPane} will push all panes, rows, or docks aside and
418ab1e7
VZ
207insert the window into the position specified by \arg{insert\_location}.
208Because \arg{insert\_location} can specify either a pane, dock row, or dock
209layer, the \arg{insert\_level} parameter is used to disambiguate this. The
210parameter \arg{insert\_level} can take a value of wxAUI\_INSERT\_PANE, wxAUI\_INSERT\_ROW
6ff9dc03
RR
211or wxAUI\_INSERT\_DOCK.
212
6ff9dc03
RR
213\membersection{wxFrameManager::LoadPaneInfo}\label{wxframemanagerloadpaneinfo}
214
215\func{void}{LoadPaneInfo}{\param{wxString }{pane\_part}, \param{wxPaneInfo\& }{pane}}
216
2906e7ae 217LoadPaneInfo() is similar to to LoadPerspective, with the exception that it only loads information about a single pane. It is used in combination with SavePaneInfo().
6ff9dc03
RR
218
219\membersection{wxFrameManager::LoadPerspective}\label{wxframemanagerloadperspective}
220
221\func{bool}{LoadPerspective}{\param{const wxString\& }{perspective}, \param{bool }{update = true}}
222
223Loads a saved perspective. If update is true, wxFrameManager::Update()
224is automatically invoked, thus realizing the saved perspective on screen.
225
6ff9dc03
RR
226\membersection{wxFrameManager::ProcessDockResult}\label{wxframemanagerprocessdockresult}
227
228\func{bool}{ProcessDockResult}{\param{wxPaneInfo\& }{target}, \param{const wxPaneInfo\& }{new\_pos}}
229
2906e7ae 230ProcessDockResult() is a protected member of the wxAUI layout manager. It can be overridden by derived classes to provide custom docking calculations.
6ff9dc03
RR
231
232\membersection{wxFrameManager::SavePaneInfo}\label{wxframemanagersavepaneinfo}
233
234\func{wxString}{SavePaneInfo}{\param{wxPaneInfo\& }{pane}}
235
2906e7ae 236SavePaneInfo() is similar to SavePerspective, with the exception that it only saves information about a single pane. It is used in combination with LoadPaneInfo().
6ff9dc03
RR
237
238\membersection{wxFrameManager::SavePerspective}\label{wxframemanagersaveperspective}
239
240\func{wxString}{SavePerspective}{\void}
241
242Saves the entire user interface layout into an encoded wxString, which
243can then be stored by the application (probably using wxConfig). When
244a perspective is restored using LoadPerspective(), the entire user
245interface will return to the state it was when the perspective was saved.
246
247\membersection{wxFrameManager::SetArtProvider}\label{wxframemanagersetartprovider}
248
249\func{void}{SetArtProvider}{\param{wxDockArt* }{art\_provider}}
250
251Instructs wxFrameManager to use art provider specified by parameter
418ab1e7 252\arg{art\_provider} for all drawing calls. This allows plugable
6ff9dc03
RR
253look-and-feel features. The previous art provider object, if any,
254will be deleted by wxFrameManager.
255
256\membersection{wxFrameManager::SetFlags}\label{wxframemanagersetflags}
257
258\func{void}{SetFlags}{\param{unsigned int }{flags}}
259
418ab1e7 260This method is used to specify wxFrameManager's settings flags. \arg{flags}
6ff9dc03
RR
261specifies options which allow the frame management behavior to be modified.
262
263\membersection{wxFrameManager::SetManagedWindow}\label{wxframemanagersetmanagedwindow}
264
265\func{void}{SetManagedWindow}{\param{wxWindow* }{managed\_wnd}}
266
2906e7ae 267Called to specify the frame or window which is to be managed by wxFrameManager. Frame management is not restricted to just frames. Child windows or custom controls are also allowed.
6ff9dc03
RR
268
269\membersection{wxFrameManager::ShowHint}\label{wxframemanagershowhint}
270
271\func{void}{ShowHint}{\param{const wxRect\& }{rect}}
272
2906e7ae 273This 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.
6ff9dc03
RR
274
275\membersection{wxFrameManager::UnInit}\label{wxframemanageruninit}
276
277\func{void}{UnInit}{\void}
278
2906e7ae 279Uninitializes 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.
6ff9dc03
RR
280
281\membersection{wxFrameManager::Update}\label{wxframemanagerupdate}
282
283\func{void}{Update}{\void}
284
285This method is called after any number of changes are
286made to any of the managed panes. Update() must be invoked after
287AddPane() or InsertPane() are called in order to "realize" or "commit"
288the changes. In addition, any number of changes may be made to
289wxPaneInfo structures (retrieved with wxFrameManager::GetPane), but to
290realize the changes, Update() must be called. This construction allows
291pane flicker to be avoided by updating the whole layout at one time.
22653452 292