]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/splitter.tex
documented wxCONFIG_USE_RELATIVE_PATH
[wxWidgets.git] / docs / latex / wx / splitter.tex
CommitLineData
a660d684
KB
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
9Appropriate 3D shading for the Windows 95 user interface is an option.
10
11\wxheading{Window styles}
12
13\begin{twocollist}\itemsep=0pt
14\twocolitem{\windowstyle{wxSP\_3D}}{Draws a 3D effect border and sash.}
15\twocolitem{\windowstyle{wxSP\_BORDER}}{Draws a thin black border around the window, and a black sash.}
16\twocolitem{\windowstyle{wxSP\_NOBORDER}}{No border, and a black sash.}
17\end{twocollist}
18
19See also \helpref{window styles overview}{windowstyles}.
20
21\wxheading{Derived from}
22
23\helpref{wxWindow}{wxwindow}\\
24\helpref{wxEvtHandler}{wxevthandler}\\
25\helpref{wxObject}{wxobject}
26
954b8ae6
JS
27\wxheading{Include files}
28
29<wx/splitter.h>
30
42e69d6b
VZ
31\wxheading{Event handling}
32
33To process input from a splitter control, use the following event handler
34macros to direct input to member functions that take a
35\helpref{wxSplitterEvent}{wxsplitterevent} argument.
36
65e78240 37\twocolwidtha{10cm}
42e69d6b 38\begin{twocollist}\itemsep=0pt
65e78240
VZ
39\twocolitem{{\bf EVT\_SPLITTER\_SASH\_POS\_CHANGED(id, func)}}{The sash
40position was changed. May be used to prevent the change from taking place.
41Processes wxEVT\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGED event.}
42\twocolitem{{\bf EVT\_SPLITTER\_UNSPLIT(id, func)}}{The splitter has been just
43unsplit. Processes wxEVT\_COMMAND\_SPLITTER\_UNSPLIT event.}
44\twocolitem{{\bf EVT\_SPLITTER\_DOUBLECLICKED(id, func)}}{The sash was double
45clicked. The default behaviour is to unsplit the window when this happens
46(unless the minimum pane size has been set to a value greater than zero).
47Processes wxEVT\_COMMAND\_SPLITTER\_DOUBLECLICKED event}
42e69d6b
VZ
48\end{twocollist}%
49
50\wxheading{See also}
51
52\helpref{wxSplitterEvent}{wxsplitterevent}
53
a660d684
KB
54\latexignore{\rtfignore{\wxheading{Members}}}
55
56\membersection{wxSplitterWindow::wxSplitterWindow}\label{wxsplitterwindowconstr}
57
58\func{}{wxSplitterWindow}{\void}
59
60Default constructor.
61
eaaa6a06 62\func{}{wxSplitterWindow}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id}, \param{int }{x},\rtfsp
a660d684 63\param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 64\param{long }{style=wxSP\_3D}, \param{const wxString\&}{ name = "splitterWindow"}}
a660d684
KB
65
66Constructor for creating the window.
67
68\wxheading{Parameters}
69
70\docparam{parent}{The parent of the splitter window.}
71
72\docparam{id}{The window identifier.}
73
74\docparam{pos}{The window position.}
75
76\docparam{size}{The window size.}
77
78\docparam{style}{The window style. See \helpref{wxSplitterWindow}{wxsplitterwindow}.}
79
80\docparam{name}{The window name.}
81
82\wxheading{Remarks}
83
84After using this constructor, you must create either one or two subwindows
85with the splitter window as parent, and then call one of \helpref{wxSplitterWindow::Initialize}{wxsplitterwindowinitialize},\rtfsp
86\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically} and \helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally} in
87order to set the pane(s).
88
89You can create two windows, with one hidden when not being shown; or you can
90create and delete the second pane on demand.
91
92\wxheading{See also}
93
94\helpref{wxSplitterWindow::Initialize}{wxsplitterwindowinitialize}, \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
95\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally},\rtfsp
96\helpref{wxSplitterWindow::Create}{wxsplitterwindowcreate}
97
98\membersection{wxSplitterWindow::\destruct{wxSplitterWindow}}
99
100\func{}{\destruct{wxSplitterWindow}}{\void}
101
102Destroys the wxSplitterWindow and its children.
103
104\membersection{wxSplitterWindow::Create}\label{wxsplitterwindowcreate}
105
eaaa6a06 106\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id}, \param{int }{x},\rtfsp
a660d684 107\param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 108\param{long }{style=wxSP\_3D}, \param{const wxString\&}{ name = "splitterWindow"}}
a660d684
KB
109
110Creation function, for two-step construction. See \helpref{wxSplitterWindow::wxSplitterWindow}{wxsplitterwindowconstr} for
111details.
112
113\membersection{wxSplitterWindow::GetMinimumPaneSize}\label{wxsplitterwindowgetminimumpanesize}
114
115\constfunc{int}{GetMinimumPaneSize}{\void}
116
117Returns the current minimum pane size (defaults to zero).
118
119\wxheading{See also}
120
121\helpref{wxSplitterWindow::SetMinimumPaneSize}{wxsplitterwindowsetminimumpanesize}
122
123\membersection{wxSplitterWindow::GetSashPosition}\label{wxsplitterwindowgetsashposition}
124
125\func{int}{GetSashPosition}{\void}
126
127Returns the current sash position.
128
129\wxheading{See also}
130
131\helpref{wxSplitterWindow::SetSashPosition}{wxsplitterwindowsetsashposition}
132
133\membersection{wxSplitterWindow::GetSplitMode}\label{wxsplitterwindowgetsplitmode}
134
135\constfunc{int}{GetSplitMode}{\void}
136
137Gets the split mode.
138
139\wxheading{See also}
140
141\helpref{wxSplitterWindow::SetSplitMode}{wxsplitterwindowsetsplitmode}, \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
142\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}.
143
144\membersection{wxSplitterWindow::GetWindow1}\label{wxsplitterwindowgetwindow1}
145
146\constfunc{wxWindow*}{GetWindow1}{\void}
147
148Returns the left/top or only pane.
149
150\membersection{wxSplitterWindow::GetWindow2}\label{wxsplitterwindowgetwindow2}
151
152\constfunc{wxWindow*}{GetWindow2}{\void}
153
154Returns the right/bottom pane.
155
156\membersection{wxSplitterWindow::Initialize}\label{wxsplitterwindowinitialize}
157
158\func{void}{Initialize}{\param{wxWindow* }{window}}
159
160Initializes the splitter window to have one pane.
161
162\wxheading{Parameters}
163
164\docparam{window}{The pane for the unsplit window.}
165
166\wxheading{Remarks}
167
168This should be called if you wish to initially view only a single pane in the splitter window.
169
170\wxheading{See also}
171
172\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
4b5f3fe6 173\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}
a660d684
KB
174
175\membersection{wxSplitterWindow::IsSplit}\label{wxsplitterwindowissplit}
176
177\constfunc{bool}{IsSplit}{\void}
178
179Returns TRUE if the window is split, FALSE otherwise.
180
181\membersection{wxSplitterWindow::OnDoubleClickSash}\label{wxsplitterwindowondoubleclicksash}
182
183\func{virtual void}{OnDoubleClickSash}{\param{int }{x}, \param{int }{y}}
184
185Application-overridable function called when the sash is double-clicked with
186the left mouse button.
187
188\wxheading{Parameters}
189
190\docparam{x}{The x position of the mouse cursor.}
191
192\docparam{y}{The y position of the mouse cursor.}
193
194\wxheading{Remarks}
195
196The default implementation of this function calls \helpref{Unsplit}{wxsplitterwindowunsplit} if
197the minimum pane size is zero.
198
199\wxheading{See also}
200
201\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}
202
203\membersection{wxSplitterWindow::OnUnsplit}\label{wxsplitterwindowonunsplit}
204
205\func{virtual void}{OnUnsplit}{\param{wxWindow* }{removed}}
206
207Application-overridable function called when the window is unsplit, either
208programmatically or using the wxSplitterWindow user interface.
209
210\wxheading{Parameters}
211
212\docparam{removed}{The window being removed.}
213
214\wxheading{Remarks}
215
216The default implementation of this function simply hides {\it removed}. You
217may wish to delete the window.
218
0d559d69
VZ
219\membersection{wxSplitterWindow::OnSashPositionChange}\label{wxsplitterwindowonsashpositionchange}
220
4b5f3fe6 221\func{virtual bool}{OnSashPositionChange}{\param{int }{newSashPosition}}
0d559d69
VZ
222
223Application-overridable function called when the sash position is changed by
224user. It may return FALSE to prevent the change or TRUE to allow it.
225
226\wxheading{Parameters}
227
228\docparam{newSashPosition}{The new sash position (always positive or zero)}
229
230\wxheading{Remarks}
231
232The default implementation of this function verifies that the sizes of both
233panes of the splitter are greater than minimum pane size.
234
3ad5e06b
VZ
235\membersection{wxSplitterWindow::ReplaceWindow}\label{wxsplitterwindowreplacewindow}
236
237\func{bool}{ReplaceWindow}{\param{wxWindow * }{winOld}, \param{wxWindow * }{winNew}}
238
239This function replaces one of the windows managed by the wxSplitterWindow with
240another one. It is in general better to use it instead of calling Unsplit()
241and then resplitting the window back because it will provoke much less flicker
242(if any). It is valid to call this function whether the splitter has two
243windows or only one.
244
245Both parameters should be non NULL and {\it winOld} must specify one of the
246windows managed by the splitter. If the parameters are incorrect or the window
247couldn't be replaced, FALSE is returned. Otherwise the function will return
248TRUE, but please notice that it will not delete the replaced window and you
249may wish to do it yourself.
250
a660d684
KB
251\wxheading{See also}
252
0d559d69 253\helpref{wxSplitterWindow::GetMinimumPaneSize}{wxsplitterwindowgetminimumpanesize}
a660d684 254
3ad5e06b
VZ
255\wxheading{See also}
256
257\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}\\
258\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically}\\
259\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}
260
a660d684
KB
261\membersection{wxSplitterWindow::SetSashPosition}\label{wxsplitterwindowsetsashposition}
262
eaaa6a06 263\func{void}{SetSashPosition}{\param{int }{position}, \param{const bool}{ redraw = TRUE}}
a660d684
KB
264
265Sets the sash position.
266
267\wxheading{Parameters}
268
269\docparam{position}{The sash position in pixels.}
270
271\docparam{redraw}{If TRUE, resizes the panes and redraws the sash and border.}
272
273\wxheading{Remarks}
274
275Does not currently check for an out-of-range value.
276
277\wxheading{See also}
278
279\helpref{wxSplitterWindow::GetSashPosition}{wxsplitterwindowgetsashposition}
280
281\membersection{wxSplitterWindow::SetMinimumPaneSize}\label{wxsplitterwindowsetminimumpanesize}
282
eaaa6a06 283\func{void}{SetMinimumPaneSize}{\param{int }{paneSize}}
a660d684
KB
284
285Sets the minimum pane size.
286
287\wxheading{Parameters}
288
289\docparam{paneSize}{Minimum pane size in pixels.}
290
291\wxheading{Remarks}
292
293The default minimum pane size is zero, which means that either pane can be reduced to zero by dragging
294the sash, thus removing one of the panes. To prevent this behaviour (and veto out-of-range sash dragging),
295set a minimum size, for example 20 pixels.
296
297\wxheading{See also}
298
299\helpref{wxSplitterWindow::GetMinimumPaneSize}{wxsplitterwindowgetminimumpanesize}
300
301\membersection{wxSplitterWindow::SetSplitMode}\label{wxsplitterwindowsetsplitmode}
302
eaaa6a06 303\func{void}{SetSplitMode}{\param{int }{mode}}
a660d684
KB
304
305Sets the split mode.
306
307\wxheading{Parameters}
308
309\docparam{mode}{Can be wxSPLIT\_VERTICAL or wxSPLIT\_HORIZONTAL.}
310
311\wxheading{Remarks}
312
313Only sets the internal variable; does not update the display.
314
315\wxheading{See also}
316
317\helpref{wxSplitterWindow::GetSplitMode}{wxsplitterwindowgetsplitmode}, \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
318\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}.
319
320\membersection{wxSplitterWindow::SplitHorizontally}\label{wxsplitterwindowsplithorizontally}
321
322\func{bool}{SplitHorizontally}{\param{wxWindow* }{window1}, \param{wxWindow* }{window2},
0d559d69 323 \param{int}{ sashPosition = 0}}
a660d684
KB
324
325Initializes the top and bottom panes of the splitter window.
326
327\wxheading{Parameters}
328
329\docparam{window1}{The top pane.}
330
331\docparam{window2}{The bottom pane.}
332
0d559d69
VZ
333\docparam{sashPosition}{The initial position of the sash. If this value is
334positive, it specifies the size of the upper pane. If it's negative, it's
335absolute value gives the size of the lower pane. Finally, specify 0 (default)
336to choose the default position (half of the total window height).}
a660d684
KB
337
338\wxheading{Return value}
339
340TRUE if successful, FALSE otherwise (the window was already split).
341
342\wxheading{Remarks}
343
0d559d69
VZ
344This should be called if you wish to initially view two panes. It can also be
345called at any subsequent time, but the application should check that the
346window is not currently split using \helpref{IsSplit}{wxsplitterwindowissplit}.
a660d684
KB
347
348\wxheading{See also}
349
350\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically}, \helpref{wxSplitterWindow::IsSplit}{wxsplitterwindowissplit},\rtfsp
4b5f3fe6 351\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}
a660d684
KB
352
353\membersection{wxSplitterWindow::SplitVertically}\label{wxsplitterwindowsplitvertically}
354
355\func{bool}{SplitVertically}{\param{wxWindow* }{window1}, \param{wxWindow* }{window2},
0d559d69 356 \param{int}{ sashPosition = 0}}
a660d684
KB
357
358Initializes the left and right panes of the splitter window.
359
360\wxheading{Parameters}
361
362\docparam{window1}{The left pane.}
363
364\docparam{window2}{The right pane.}
365
0d559d69
VZ
366\docparam{sashPosition}{The initial position of the sash. If this value is
367positive, it specifies the size of the left pane. If it's negative, it's
368absolute value gives the size of the right pane. Finally, specify 0 (default)
369to choose the default position (half of the total window width).}
a660d684
KB
370
371\wxheading{Return value}
372
373TRUE if successful, FALSE otherwise (the window was already split).
374
375\wxheading{Remarks}
376
377This should be called if you wish to initially view two panes. It can also be called at any subsequent time,
378but the application should check that the window is not currently split using \helpref{IsSplit}{wxsplitterwindowissplit}.
379
380\wxheading{See also}
381
382\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}, \helpref{wxSplitterWindow::IsSplit}{wxsplitterwindowissplit},\rtfsp
383\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}.
384
385\membersection{wxSplitterWindow::Unsplit}\label{wxsplitterwindowunsplit}
386
387\func{bool}{Unsplit}{\param{wxWindow* }{toRemove = NULL}}
388
389Unsplits the window.
390
391\wxheading{Parameters}
392
393\docparam{toRemove}{The pane to remove, or NULL to remove the right or bottom pane.}
394
395\wxheading{Return value}
396
397TRUE if successful, FALSE otherwise (the window was not split).
398
399\wxheading{Remarks}
400
401This call will not actually delete the pane being removed; it calls \helpref{OnUnsplit}{wxsplitterwindowonunsplit}\rtfsp
402which can be overridden for the desired behaviour. By default, the pane being removed is hidden.
403
404\wxheading{See also}
405
406\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}, \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
407\helpref{wxSplitterWindow::IsSplit}{wxsplitterwindowissplit}, \helpref{wxSplitterWindow::OnUnsplit}{wxsplitterwindowonunsplit}
408
409
410