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