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