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