]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/splitter.tex
RemoveAt() added to array classes
[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.
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.}
18 \twocolitem{\windowstyle{wxSP\_PERMIT\_UNSPLIT}}{Always allow to
19 unsplit, 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.}
21 \end{twocollist}
22
23 See 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
31 \wxheading{Include files}
32
33 <wx/splitter.h>
34
35 \wxheading{Event handling}
36
37 To process input from a splitter control, use the following event handler
38 macros to direct input to member functions that take a
39 \helpref{wxSplitterEvent}{wxsplitterevent} argument.
40
41 \twocolwidtha{10cm}
42 \begin{twocollist}\itemsep=0pt
43 \twocolitem{{\bf EVT\_SPLITTER\_SASH\_POS\_CHANGING(id, func)}}{The sash
44 position is in the process of being changed. May be used to modify the
45 position of the tracking bar to properly reflect the position that
46 would be set if the drag were to be completed at this point. Processes
47 a wxEVT\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGING event.}
48 \twocolitem{{\bf EVT\_SPLITTER\_SASH\_POS\_CHANGED(id, func)}}{The sash
49 position was changed. May be used to modify the sash position before
50 it is set, or to prevent the change from taking place.
51 Processes a wxEVT\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGED event.}
52 \twocolitem{{\bf EVT\_SPLITTER\_UNSPLIT(id, func)}}{The splitter has been just
53 unsplit. Processes a wxEVT\_COMMAND\_SPLITTER\_UNSPLIT event.}
54 \twocolitem{{\bf EVT\_SPLITTER\_DOUBLECLICKED(id, func)}}{The sash was double
55 clicked. 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).
57 Processes a wxEVT\_COMMAND\_SPLITTER\_DOUBLECLICKED event.}
58 \end{twocollist}%
59
60 \wxheading{See also}
61
62 \helpref{wxSplitterEvent}{wxsplitterevent}
63
64 \latexignore{\rtfignore{\wxheading{Members}}}
65
66 \membersection{wxSplitterWindow::wxSplitterWindow}\label{wxsplitterwindowconstr}
67
68 \func{}{wxSplitterWindow}{\void}
69
70 Default constructor.
71
72 \func{}{wxSplitterWindow}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
73 \param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
74 \param{long }{style=wxSP\_3D}, \param{const wxString\&}{ name = "splitterWindow"}}
75
76 Constructor 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
94 After using this constructor, you must create either one or two subwindows
95 with 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
97 order to set the pane(s).
98
99 You can create two windows, with one hidden when not being shown; or you can
100 create 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
112 Destroys the wxSplitterWindow and its children.
113
114 \membersection{wxSplitterWindow::Create}\label{wxsplitterwindowcreate}
115
116 \func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id}, \param{int }{x},\rtfsp
117 \param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
118 \param{long }{style=wxSP\_3D}, \param{const wxString\&}{ name = "splitterWindow"}}
119
120 Creation function, for two-step construction. See \helpref{wxSplitterWindow::wxSplitterWindow}{wxsplitterwindowconstr} for
121 details.
122
123 \membersection{wxSplitterWindow::GetMinimumPaneSize}\label{wxsplitterwindowgetminimumpanesize}
124
125 \constfunc{int}{GetMinimumPaneSize}{\void}
126
127 Returns 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
137 Returns 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
147 Gets 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
158 Returns the left/top or only pane.
159
160 \membersection{wxSplitterWindow::GetWindow2}\label{wxsplitterwindowgetwindow2}
161
162 \constfunc{wxWindow*}{GetWindow2}{\void}
163
164 Returns the right/bottom pane.
165
166 \membersection{wxSplitterWindow::Initialize}\label{wxsplitterwindowinitialize}
167
168 \func{void}{Initialize}{\param{wxWindow* }{window}}
169
170 Initializes 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
178 This 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
183 \helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}
184
185 \membersection{wxSplitterWindow::IsSplit}\label{wxsplitterwindowissplit}
186
187 \constfunc{bool}{IsSplit}{\void}
188
189 Returns 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
195 Application-overridable function called when the sash is double-clicked with
196 the 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
206 The default implementation of this function calls \helpref{Unsplit}{wxsplitterwindowunsplit} if
207 the 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
217 Application-overridable function called when the window is unsplit, either
218 programmatically or using the wxSplitterWindow user interface.
219
220 \wxheading{Parameters}
221
222 \docparam{removed}{The window being removed.}
223
224 \wxheading{Remarks}
225
226 The default implementation of this function simply hides {\it removed}. You
227 may wish to delete the window.
228
229 \membersection{wxSplitterWindow::OnSashPositionChange}\label{wxsplitterwindowonsashpositionchange}
230
231 \func{virtual bool}{OnSashPositionChange}{\param{int }{newSashPosition}}
232
233 Application-overridable function called when the sash position is changed by
234 user. 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
242 The default implementation of this function verifies that the sizes of both
243 panes of the splitter are greater than minimum pane size.
244
245 \membersection{wxSplitterWindow::ReplaceWindow}\label{wxsplitterwindowreplacewindow}
246
247 \func{bool}{ReplaceWindow}{\param{wxWindow * }{winOld}, \param{wxWindow * }{winNew}}
248
249 This function replaces one of the windows managed by the wxSplitterWindow with
250 another one. It is in general better to use it instead of calling Unsplit()
251 and 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
253 windows or only one.
254
255 Both parameters should be non NULL and {\it winOld} must specify one of the
256 windows managed by the splitter. If the parameters are incorrect or the window
257 couldn't be replaced, FALSE is returned. Otherwise the function will return
258 TRUE, but please notice that it will not delete the replaced window and you
259 may wish to do it yourself.
260
261 \wxheading{See also}
262
263 \helpref{wxSplitterWindow::GetMinimumPaneSize}{wxsplitterwindowgetminimumpanesize}
264
265 \wxheading{See also}
266
267 \helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}\\
268 \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically}\\
269 \helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}
270
271 \membersection{wxSplitterWindow::SetSashPosition}\label{wxsplitterwindowsetsashposition}
272
273 \func{void}{SetSashPosition}{\param{int }{position}, \param{const bool}{ redraw = TRUE}}
274
275 Sets 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
285 Does 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
293 \func{void}{SetMinimumPaneSize}{\param{int }{paneSize}}
294
295 Sets the minimum pane size.
296
297 \wxheading{Parameters}
298
299 \docparam{paneSize}{Minimum pane size in pixels.}
300
301 \wxheading{Remarks}
302
303 The default minimum pane size is zero, which means that either pane can be reduced to zero by dragging
304 the sash, thus removing one of the panes. To prevent this behaviour (and veto out-of-range sash dragging),
305 set a minimum size, for example 20 pixels. If the wxSP\_PERMIT\_UNSPLIT style
306 is used when a splitter window is created, the window may be unsplit even
307 if minimum size is non-zero.
308
309 \wxheading{See also}
310
311 \helpref{wxSplitterWindow::GetMinimumPaneSize}{wxsplitterwindowgetminimumpanesize}
312
313 \membersection{wxSplitterWindow::SetSplitMode}\label{wxsplitterwindowsetsplitmode}
314
315 \func{void}{SetSplitMode}{\param{int }{mode}}
316
317 Sets the split mode.
318
319 \wxheading{Parameters}
320
321 \docparam{mode}{Can be wxSPLIT\_VERTICAL or wxSPLIT\_HORIZONTAL.}
322
323 \wxheading{Remarks}
324
325 Only 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},
335 \param{int}{ sashPosition = 0}}
336
337 Initializes 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
345 \docparam{sashPosition}{The initial position of the sash. If this value is
346 positive, it specifies the size of the upper pane. If it's negative, it's
347 absolute value gives the size of the lower pane. Finally, specify 0 (default)
348 to choose the default position (half of the total window height).}
349
350 \wxheading{Return value}
351
352 TRUE if successful, FALSE otherwise (the window was already split).
353
354 \wxheading{Remarks}
355
356 This should be called if you wish to initially view two panes. It can also be
357 called at any subsequent time, but the application should check that the
358 window is not currently split using \helpref{IsSplit}{wxsplitterwindowissplit}.
359
360 \wxheading{See also}
361
362 \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically}, \helpref{wxSplitterWindow::IsSplit}{wxsplitterwindowissplit},\rtfsp
363 \helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}
364
365 \membersection{wxSplitterWindow::SplitVertically}\label{wxsplitterwindowsplitvertically}
366
367 \func{bool}{SplitVertically}{\param{wxWindow* }{window1}, \param{wxWindow* }{window2},
368 \param{int}{ sashPosition = 0}}
369
370 Initializes 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
378 \docparam{sashPosition}{The initial position of the sash. If this value is
379 positive, it specifies the size of the left pane. If it's negative, it's
380 absolute value gives the size of the right pane. Finally, specify 0 (default)
381 to choose the default position (half of the total window width).}
382
383 \wxheading{Return value}
384
385 TRUE if successful, FALSE otherwise (the window was already split).
386
387 \wxheading{Remarks}
388
389 This should be called if you wish to initially view two panes. It can also be called at any subsequent time,
390 but 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
401 Unsplits 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
409 TRUE if successful, FALSE otherwise (the window was not split).
410
411 \wxheading{Remarks}
412
413 This call will not actually delete the pane being removed; it calls \helpref{OnUnsplit}{wxsplitterwindowonunsplit}\rtfsp
414 which 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