]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/splitter.tex
added wxMessageQueue class for inter-thread communications
[wxWidgets.git] / docs / latex / wx / splitter.tex
... / ...
CommitLineData
1\section{\class{wxSplitterWindow}}\label{wxsplitterwindow}
2
3\overview{wxSplitterWindow overview}{wxsplitterwindowoverview}
4
5This class manages up to two subwindows. The current view can be
6split into two programmatically (perhaps from a menu command), and unsplit
7either programmatically or via the wxSplitterWindow user interface.
8
9\wxheading{Window styles}
10
11\begin{twocollist}\itemsep=0pt
12\twocolitem{\windowstyle{wxSP\_3D}}{Draws a 3D effect border and sash.}
13\twocolitem{\windowstyle{wxSP\_3DSASH}}{Draws a 3D effect sash.}
14\twocolitem{\windowstyle{wxSP\_3DBORDER}}{Synonym for wxSP\_BORDER.}
15\twocolitem{\windowstyle{wxSP\_BORDER}}{Draws a standard border.}
16\twocolitem{\windowstyle{wxSP\_NOBORDER}}{No border (default).}
17\twocolitem{\windowstyle{wxSP\_NO\_XP\_THEME}}{Under Windows XP, switches off the attempt to draw the
18splitter using Windows XP theming, so the borders and sash will take on the pre-XP look.}
19\twocolitem{\windowstyle{wxSP\_PERMIT\_UNSPLIT}}{Always allow to
20unsplit, even with the minimum pane size other than zero.}
21\twocolitem{\windowstyle{wxSP\_LIVE\_UPDATE}}{Don't draw XOR line but resize the child windows immediately.}
22\end{twocollist}
23
24See also \helpref{window styles overview}{windowstyles}.
25
26\wxheading{Derived from}
27
28\helpref{wxWindow}{wxwindow}\\
29\helpref{wxEvtHandler}{wxevthandler}\\
30\helpref{wxObject}{wxobject}
31
32\wxheading{Include files}
33
34<wx/splitter.h>
35
36\wxheading{Library}
37
38\helpref{wxCore}{librarieslist}
39
40\wxheading{Event handling}
41
42To process input from a splitter control, use the following event handler
43macros to direct input to member functions that take a
44\helpref{wxSplitterEvent}{wxsplitterevent} argument.
45
46\twocolwidtha{10cm}
47\begin{twocollist}\itemsep=0pt
48\twocolitem{{\bf EVT\_SPLITTER\_SASH\_POS\_CHANGING(id, func)}}{The sash
49position is in the process of being changed. May be used to modify the
50position of the tracking bar to properly reflect the position that
51would be set if the drag were to be completed at this point. Processes
52a wxEVT\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGING event.}
53\twocolitem{{\bf EVT\_SPLITTER\_SASH\_POS\_CHANGED(id, func)}}{The sash
54position was changed. May be used to modify the sash position before
55it is set, or to prevent the change from taking place.
56Processes a wxEVT\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGED event.}
57\twocolitem{{\bf EVT\_SPLITTER\_UNSPLIT(id, func)}}{The splitter has been just
58unsplit. Processes a wxEVT\_COMMAND\_SPLITTER\_UNSPLIT event.}
59\twocolitem{{\bf EVT\_SPLITTER\_DCLICK(id, func)}}{The sash was double
60clicked. The default behaviour is to unsplit the window when this happens
61(unless the minimum pane size has been set to a value greater than zero).
62Processes a wxEVT\_COMMAND\_SPLITTER\_DOUBLECLICKED event.}
63\end{twocollist}%
64
65\wxheading{See also}
66
67\helpref{wxSplitterEvent}{wxsplitterevent}
68
69\latexignore{\rtfignore{\wxheading{Members}}}
70
71\membersection{wxSplitterWindow::wxSplitterWindow}\label{wxsplitterwindowctor}
72
73\func{}{wxSplitterWindow}{\void}
74
75Default constructor.
76
77\func{}{wxSplitterWindow}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
78\param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
79\param{long }{style=wxSP\_3D}, \param{const wxString\&}{ name = "splitterWindow"}}
80
81Constructor for creating the window.
82
83\wxheading{Parameters}
84
85\docparam{parent}{The parent of the splitter window.}
86
87\docparam{id}{The window identifier.}
88
89\docparam{pos}{The window position.}
90
91\docparam{size}{The window size.}
92
93\docparam{style}{The window style. See \helpref{wxSplitterWindow}{wxsplitterwindow}.}
94
95\docparam{name}{The window name.}
96
97\wxheading{Remarks}
98
99After using this constructor, you must create either one or two subwindows
100with the splitter window as parent, and then call one of \helpref{wxSplitterWindow::Initialize}{wxsplitterwindowinitialize},\rtfsp
101\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically} and \helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally} in
102order to set the pane(s).
103
104You can create two windows, with one hidden when not being shown; or you can
105create and delete the second pane on demand.
106
107\wxheading{See also}
108
109\helpref{wxSplitterWindow::Initialize}{wxsplitterwindowinitialize}, \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
110\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally},\rtfsp
111\helpref{wxSplitterWindow::Create}{wxsplitterwindowcreate}
112
113\membersection{wxSplitterWindow::\destruct{wxSplitterWindow}}\label{wxsplitterwindowdtor}
114
115\func{}{\destruct{wxSplitterWindow}}{\void}
116
117Destroys the wxSplitterWindow and its children.
118
119\membersection{wxSplitterWindow::Create}\label{wxsplitterwindowcreate}
120
121\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id}, \rtfsp
122\param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
123\param{long }{style=wxSP\_3D}, \param{const wxString\&}{ name = "splitterWindow"}}
124
125Creation function, for two-step construction. See \helpref{wxSplitterWindow::wxSplitterWindow}{wxsplitterwindowctor} for
126details.
127
128\membersection{wxSplitterWindow::GetMinimumPaneSize}\label{wxsplitterwindowgetminimumpanesize}
129
130\constfunc{int}{GetMinimumPaneSize}{\void}
131
132Returns the current minimum pane size (defaults to zero).
133
134\wxheading{See also}
135
136\helpref{wxSplitterWindow::SetMinimumPaneSize}{wxsplitterwindowsetminimumpanesize}
137
138\membersection{wxSplitterWindow::GetSashGravity}\label{wxsplitterwindowgetsashgravity}
139
140\func{double}{GetSashGravity}{\void}
141
142Returns the current sash gravity.
143
144\wxheading{See also}
145
146\helpref{wxSplitterWindow::SetSashGravity}{wxsplitterwindowsetsashgravity}
147
148\membersection{wxSplitterWindow::GetSashPosition}\label{wxsplitterwindowgetsashposition}
149
150\func{int}{GetSashPosition}{\void}
151
152Returns the current sash position.
153
154\wxheading{See also}
155
156\helpref{wxSplitterWindow::SetSashPosition}{wxsplitterwindowsetsashposition}
157
158\membersection{wxSplitterWindow::GetSplitMode}\label{wxsplitterwindowgetsplitmode}
159
160\constfunc{int}{GetSplitMode}{\void}
161
162Gets the split mode.
163
164\wxheading{See also}
165
166\helpref{wxSplitterWindow::SetSplitMode}{wxsplitterwindowsetsplitmode}, \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
167\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}.
168
169\membersection{wxSplitterWindow::GetWindow1}\label{wxsplitterwindowgetwindow1}
170
171\constfunc{wxWindow*}{GetWindow1}{\void}
172
173Returns the left/top or only pane.
174
175\membersection{wxSplitterWindow::GetWindow2}\label{wxsplitterwindowgetwindow2}
176
177\constfunc{wxWindow*}{GetWindow2}{\void}
178
179Returns the right/bottom pane.
180
181\membersection{wxSplitterWindow::Initialize}\label{wxsplitterwindowinitialize}
182
183\func{void}{Initialize}{\param{wxWindow* }{window}}
184
185Initializes the splitter window to have one pane. The child window is
186shown if it is currently hidden.
187
188\wxheading{Parameters}
189
190\docparam{window}{The pane for the unsplit window.}
191
192\wxheading{Remarks}
193
194This should be called if you wish to initially view only a single pane in the splitter window.
195
196\wxheading{See also}
197
198\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
199\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}
200
201\membersection{wxSplitterWindow::IsSplit}\label{wxsplitterwindowissplit}
202
203\constfunc{bool}{IsSplit}{\void}
204
205Returns true if the window is split, false otherwise.
206
207\membersection{wxSplitterWindow::OnDoubleClickSash}\label{wxsplitterwindowondoubleclicksash}
208
209\func{virtual void}{OnDoubleClickSash}{\param{int }{x}, \param{int }{y}}
210
211Application-overridable function called when the sash is double-clicked with
212the left mouse button.
213
214\wxheading{Parameters}
215
216\docparam{x}{The x position of the mouse cursor.}
217
218\docparam{y}{The y position of the mouse cursor.}
219
220\wxheading{Remarks}
221
222The default implementation of this function calls \helpref{Unsplit}{wxsplitterwindowunsplit} if
223the minimum pane size is zero.
224
225\wxheading{See also}
226
227\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}
228
229\membersection{wxSplitterWindow::OnUnsplit}\label{wxsplitterwindowonunsplit}
230
231\func{virtual void}{OnUnsplit}{\param{wxWindow* }{removed}}
232
233Application-overridable function called when the window is unsplit, either
234programmatically or using the wxSplitterWindow user interface.
235
236\wxheading{Parameters}
237
238\docparam{removed}{The window being removed.}
239
240\wxheading{Remarks}
241
242The default implementation of this function simply hides {\it removed}. You
243may wish to delete the window.
244
245\membersection{wxSplitterWindow::OnSashPositionChange}\label{wxsplitterwindowonsashpositionchange}
246
247\func{virtual bool}{OnSashPositionChange}{\param{int }{newSashPosition}}
248
249Application-overridable function called when the sash position is changed by
250user. It may return false to prevent the change or true to allow it.
251
252\wxheading{Parameters}
253
254\docparam{newSashPosition}{The new sash position (always positive or zero)}
255
256\wxheading{Remarks}
257
258The default implementation of this function verifies that the sizes of both
259panes of the splitter are greater than minimum pane size.
260
261\membersection{wxSplitterWindow::ReplaceWindow}\label{wxsplitterwindowreplacewindow}
262
263\func{bool}{ReplaceWindow}{\param{wxWindow * }{winOld}, \param{wxWindow * }{winNew}}
264
265This function replaces one of the windows managed by the wxSplitterWindow with
266another one. It is in general better to use it instead of calling Unsplit()
267and then resplitting the window back because it will provoke much less flicker
268(if any). It is valid to call this function whether the splitter has two
269windows or only one.
270
271Both parameters should be non-NULL and {\it winOld} must specify one of the
272windows managed by the splitter. If the parameters are incorrect or the window
273couldn't be replaced, false is returned. Otherwise the function will return
274true, but please notice that it will not delete the replaced window and you
275may wish to do it yourself.
276
277\wxheading{See also}
278
279\helpref{wxSplitterWindow::GetMinimumPaneSize}{wxsplitterwindowgetminimumpanesize}
280
281\wxheading{See also}
282
283\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}\\
284\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically}\\
285\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}
286
287\membersection{wxSplitterWindow::SetSashGravity}\label{wxsplitterwindowsetsashgravity}
288
289\func{void}{SetSashGravity}{\param{double }{gravity}}
290
291Sets the sash gravity.
292
293\wxheading{Parameters}
294
295\docparam{gravity}{The sash gravity. Value between 0.0 and 1.0.}
296
297
298\wxheading{Remarks}
299Gravity is real factor which controls position of sash while resizing wxSplitterWindow.
300Gravity tells wxSplitterWindow how much will left/top window grow while resizing.
301
302Example values:
303\begin{itemize}\itemsep=0pt
304\item{ 0.0 - only the bottom/right window is automatically resized}
305\item{ 0.5 - both windows grow by equal size}
306\item{ 1.0 - only left/top window grows}
307\end{itemize}
308
309Gravity should be a real value between 0.0 and 1.0.
310
311Default value of sash gravity is 0.0. That value is compatible with previous
312(before gravity was introduced) behaviour of wxSplitterWindow.
313
314\wxheading{See also}
315
316\helpref{wxSplitterWindow::GetSashGravity}{wxsplitterwindowgetsashgravity}
317
318\membersection{wxSplitterWindow::SetSashPosition}\label{wxsplitterwindowsetsashposition}
319
320\func{void}{SetSashPosition}{\param{int }{position}, \param{const bool}{ redraw = true}}
321
322Sets the sash position.
323
324\wxheading{Parameters}
325
326\docparam{position}{The sash position in pixels.}
327
328\docparam{redraw}{If true, resizes the panes and redraws the sash and border.}
329
330\wxheading{Remarks}
331
332Does not currently check for an out-of-range value.
333
334\wxheading{See also}
335
336\helpref{wxSplitterWindow::GetSashPosition}{wxsplitterwindowgetsashposition}
337
338\membersection{wxSplitterWindow::SetSashSize}\label{wxsplitterwindowsetsashsize}
339
340\func{void}{SetSashSize}{\param{int }{size}}
341
342Sets the sash size. Normally, the sash size is determined according to the metrics
343of each platform, but the application can override this, for example to show
344a thin sash that the user is not expected to drag. If {\it size} is more -1,
345the custom sash size will be used.
346
347\membersection{wxSplitterWindow::SetMinimumPaneSize}\label{wxsplitterwindowsetminimumpanesize}
348
349\func{void}{SetMinimumPaneSize}{\param{int }{paneSize}}
350
351Sets the minimum pane size.
352
353\wxheading{Parameters}
354
355\docparam{paneSize}{Minimum pane size in pixels.}
356
357\wxheading{Remarks}
358
359The default minimum pane size is zero, which means that either pane can be reduced to zero by dragging
360the sash, thus removing one of the panes. To prevent this behaviour (and veto out-of-range sash dragging),
361set a minimum size, for example 20 pixels. If the wxSP\_PERMIT\_UNSPLIT style
362is used when a splitter window is created, the window may be unsplit even
363if minimum size is non-zero.
364
365\wxheading{See also}
366
367\helpref{wxSplitterWindow::GetMinimumPaneSize}{wxsplitterwindowgetminimumpanesize}
368
369\membersection{wxSplitterWindow::SetSplitMode}\label{wxsplitterwindowsetsplitmode}
370
371\func{void}{SetSplitMode}{\param{int }{mode}}
372
373Sets the split mode.
374
375\wxheading{Parameters}
376
377\docparam{mode}{Can be wxSPLIT\_VERTICAL or wxSPLIT\_HORIZONTAL.}
378
379\wxheading{Remarks}
380
381Only sets the internal variable; does not update the display.
382
383\wxheading{See also}
384
385\helpref{wxSplitterWindow::GetSplitMode}{wxsplitterwindowgetsplitmode}, \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
386\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}.
387
388\membersection{wxSplitterWindow::SplitHorizontally}\label{wxsplitterwindowsplithorizontally}
389
390\func{bool}{SplitHorizontally}{\param{wxWindow* }{window1}, \param{wxWindow* }{window2},
391 \param{int}{ sashPosition = 0}}
392
393Initializes the top and bottom panes of the splitter window. The
394child windows are shown if they are currently hidden.
395
396\wxheading{Parameters}
397
398\docparam{window1}{The top pane.}
399
400\docparam{window2}{The bottom pane.}
401
402\docparam{sashPosition}{The initial position of the sash. If this value is
403positive, it specifies the size of the upper pane. If it is negative, its
404absolute value gives the size of the lower pane. Finally, specify 0 (default)
405to choose the default position (half of the total window height).}
406
407\wxheading{Return value}
408
409true if successful, false otherwise (the window was already split).
410
411\wxheading{Remarks}
412
413This should be called if you wish to initially view two panes. It can also be
414called at any subsequent time, but the application should check that the
415window is not currently split using \helpref{IsSplit}{wxsplitterwindowissplit}.
416
417\wxheading{See also}
418
419\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically}, \helpref{wxSplitterWindow::IsSplit}{wxsplitterwindowissplit},\rtfsp
420\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}
421
422\membersection{wxSplitterWindow::SplitVertically}\label{wxsplitterwindowsplitvertically}
423
424\func{bool}{SplitVertically}{\param{wxWindow* }{window1}, \param{wxWindow* }{window2},
425 \param{int}{ sashPosition = 0}}
426
427Initializes the left and right panes of the splitter window. The
428child windows are shown if they are currently hidden.
429
430\wxheading{Parameters}
431
432\docparam{window1}{The left pane.}
433
434\docparam{window2}{The right pane.}
435
436\docparam{sashPosition}{The initial position of the sash. If this value is
437positive, it specifies the size of the left pane. If it is negative, it is
438absolute value gives the size of the right pane. Finally, specify 0 (default)
439to choose the default position (half of the total window width).}
440
441\wxheading{Return value}
442
443true if successful, false otherwise (the window was already split).
444
445\wxheading{Remarks}
446
447This should be called if you wish to initially view two panes. It can also be called at any subsequent time,
448but the application should check that the window is not currently split using \helpref{IsSplit}{wxsplitterwindowissplit}.
449
450\wxheading{See also}
451
452\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}, \helpref{wxSplitterWindow::IsSplit}{wxsplitterwindowissplit},\rtfsp
453\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}.
454
455\membersection{wxSplitterWindow::Unsplit}\label{wxsplitterwindowunsplit}
456
457\func{bool}{Unsplit}{\param{wxWindow* }{toRemove = NULL}}
458
459Unsplits the window.
460
461\wxheading{Parameters}
462
463\docparam{toRemove}{The pane to remove, or NULL to remove the right or bottom pane.}
464
465\wxheading{Return value}
466
467true if successful, false otherwise (the window was not split).
468
469\wxheading{Remarks}
470
471This call will not actually delete the pane being removed; it calls \helpref{OnUnsplit}{wxsplitterwindowonunsplit}\rtfsp
472which can be overridden for the desired behaviour. By default, the pane being removed is hidden.
473
474\wxheading{See also}
475
476\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}, \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
477\helpref{wxSplitterWindow::IsSplit}{wxsplitterwindowissplit}, \helpref{wxSplitterWindow::OnUnsplit}{wxsplitterwindowonunsplit}
478
479\membersection{wxSplitterWindow::UpdateSize}\label{wxsplitterwindowupdatesize}
480
481\func{void}{UpdateSize}{\void}
482
483Causes any pending sizing of the sash and child panes to take place
484immediately.
485
486Such resizing normally takes place in idle time, in order
487to wait for layout to be completed. However, this can cause
488unacceptable flicker as the panes are resized after the window has been
489shown. To work around this, you can perform window layout (for
490example by sending a size event to the parent window), and then
491call this function, before showing the top-level window.
492