1 \section{\class{wxSplitterWindow
}}\label{wxsplitterwindow
}
3 \overview{wxSplitterWindow overview
}{wxsplitterwindowoverview
}
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.
9 \wxheading{Window styles
}
11 \begin{twocollist
}\itemsep=
0pt
12 \twocolitem{\windowstyle{wxSP
\_3D}}{Draws a
3D effect border and sash.
}
13 \twocolitem{\windowstyle{wxSP
\_3DSASH}}{Draws a
3D effect sash.
}
14 \twocolitem{\windowstyle{wxSP
\_3DBORDER}}{Synonym for wxSP
\_BORDER.
}
15 \twocolitem{\windowstyle{wxSP
\_BORDER}}{Draws a standard border.
}
16 \twocolitem{\windowstyle{wxSP
\_NOBORDER}}{No border (default).
}
17 \twocolitem{\windowstyle{wxSP
\_NO\_XP\_THEME}}{Under Windows XP, switches off the attempt to draw the
18 splitter using Windows XP theming, so the borders and sash will take on the pre-XP look.
}
19 \twocolitem{\windowstyle{wxSP
\_PERMIT\_UNSPLIT}}{Always allow to
20 unsplit, even with the minimum pane size other than zero.
}
21 \twocolitem{\windowstyle{wxSP
\_LIVE\_UPDATE}}{Don't draw XOR line but resize the child windows immediately.
}
24 See also
\helpref{window styles overview
}{windowstyles
}.
26 \wxheading{Derived from
}
28 \helpref{wxWindow
}{wxwindow
}\\
29 \helpref{wxEvtHandler
}{wxevthandler
}\\
30 \helpref{wxObject
}{wxobject
}
32 \wxheading{Include files
}
38 \helpref{wxCore
}{librarieslist
}
40 \wxheading{Event handling
}
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.
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\_DCLICK(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.
}
67 \helpref{wxSplitterEvent
}{wxsplitterevent
}
69 \latexignore{\rtfignore{\wxheading{Members
}}}
71 \membersection{wxSplitterWindow::wxSplitterWindow
}\label{wxsplitterwindowctor
}
73 \func{}{wxSplitterWindow
}{\void}
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"
}}
81 Constructor for creating the window.
83 \wxheading{Parameters
}
85 \docparam{parent
}{The parent of the splitter window.
}
87 \docparam{id
}{The window identifier.
}
89 \docparam{pos
}{The window position.
}
91 \docparam{size
}{The window size.
}
93 \docparam{style
}{The window style. See
\helpref{wxSplitterWindow
}{wxsplitterwindow
}.
}
95 \docparam{name
}{The window name.
}
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).
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.
109 \helpref{wxSplitterWindow::Initialize
}{wxsplitterwindowinitialize
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
110 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\rtfsp
111 \helpref{wxSplitterWindow::Create
}{wxsplitterwindowcreate
}
113 \membersection{wxSplitterWindow::
\destruct{wxSplitterWindow
}}\label{wxsplitterwindowdtor
}
115 \func{}{\destruct{wxSplitterWindow
}}{\void}
117 Destroys the wxSplitterWindow and its children.
119 \membersection{wxSplitterWindow::Create
}\label{wxsplitterwindowcreate
}
121 \func{bool
}{Create
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{ id
},
\rtfsp
122 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
123 \param{long
}{style=wxSP
\_3D},
\param{const wxString\&
}{ name = "splitterWindow"
}}
125 Creation function, for two-step construction. See
\helpref{wxSplitterWindow::wxSplitterWindow
}{wxsplitterwindowctor
} for
128 \membersection{wxSplitterWindow::GetMinimumPaneSize
}\label{wxsplitterwindowgetminimumpanesize
}
130 \constfunc{int
}{GetMinimumPaneSize
}{\void}
132 Returns the current minimum pane size (defaults to zero).
136 \helpref{wxSplitterWindow::SetMinimumPaneSize
}{wxsplitterwindowsetminimumpanesize
}
138 \membersection{wxSplitterWindow::GetSashGravity
}\label{wxsplitterwindowgetsashgravity
}
140 \func{double
}{GetSashGravity
}{\void}
142 Returns the current sash gravity.
146 \helpref{wxSplitterWindow::SetSashGravity
}{wxsplitterwindowsetsashgravity
}
148 \membersection{wxSplitterWindow::GetSashPosition
}\label{wxsplitterwindowgetsashposition
}
150 \func{int
}{GetSashPosition
}{\void}
152 Returns the current sash position.
156 \helpref{wxSplitterWindow::SetSashPosition
}{wxsplitterwindowsetsashposition
}
158 \membersection{wxSplitterWindow::GetSplitMode
}\label{wxsplitterwindowgetsplitmode
}
160 \constfunc{int
}{GetSplitMode
}{\void}
166 \helpref{wxSplitterWindow::SetSplitMode
}{wxsplitterwindowsetsplitmode
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
167 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}.
169 \membersection{wxSplitterWindow::GetWindow1
}\label{wxsplitterwindowgetwindow1
}
171 \constfunc{wxWindow*
}{GetWindow1
}{\void}
173 Returns the left/top or only pane.
175 \membersection{wxSplitterWindow::GetWindow2
}\label{wxsplitterwindowgetwindow2
}
177 \constfunc{wxWindow*
}{GetWindow2
}{\void}
179 Returns the right/bottom pane.
181 \membersection{wxSplitterWindow::Initialize
}\label{wxsplitterwindowinitialize
}
183 \func{void
}{Initialize
}{\param{wxWindow*
}{window
}}
185 Initializes the splitter window to have one pane. The child window is
186 shown if it is currently hidden.
188 \wxheading{Parameters
}
190 \docparam{window
}{The pane for the unsplit window.
}
194 This should be called if you wish to initially view only a single pane in the splitter window.
198 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
199 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}
201 \membersection{wxSplitterWindow::IsSplit
}\label{wxsplitterwindowissplit
}
203 \constfunc{bool
}{IsSplit
}{\void}
205 Returns true if the window is split, false otherwise.
207 \membersection{wxSplitterWindow::OnDoubleClickSash
}\label{wxsplitterwindowondoubleclicksash
}
209 \func{virtual void
}{OnDoubleClickSash
}{\param{int
}{x
},
\param{int
}{y
}}
211 Application-overridable function called when the sash is double-clicked with
212 the left mouse button.
214 \wxheading{Parameters
}
216 \docparam{x
}{The x position of the mouse cursor.
}
218 \docparam{y
}{The y position of the mouse cursor.
}
222 The default implementation of this function calls
\helpref{Unsplit
}{wxsplitterwindowunsplit
} if
223 the minimum pane size is zero.
227 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}
229 \membersection{wxSplitterWindow::OnUnsplit
}\label{wxsplitterwindowonunsplit
}
231 \func{virtual void
}{OnUnsplit
}{\param{wxWindow*
}{removed
}}
233 Application-overridable function called when the window is unsplit, either
234 programmatically or using the wxSplitterWindow user interface.
236 \wxheading{Parameters
}
238 \docparam{removed
}{The window being removed.
}
242 The default implementation of this function simply hides
{\it removed
}. You
243 may wish to delete the window.
245 \membersection{wxSplitterWindow::OnSashPositionChange
}\label{wxsplitterwindowonsashpositionchange
}
247 \func{virtual bool
}{OnSashPositionChange
}{\param{int
}{newSashPosition
}}
249 Application-overridable function called when the sash position is changed by
250 user. It may return false to prevent the change or true to allow it.
252 \wxheading{Parameters
}
254 \docparam{newSashPosition
}{The new sash position (always positive or zero)
}
258 The default implementation of this function verifies that the sizes of both
259 panes of the splitter are greater than minimum pane size.
261 \membersection{wxSplitterWindow::ReplaceWindow
}\label{wxsplitterwindowreplacewindow
}
263 \func{bool
}{ReplaceWindow
}{\param{wxWindow *
}{winOld
},
\param{wxWindow *
}{winNew
}}
265 This function replaces one of the windows managed by the wxSplitterWindow with
266 another one. It is in general better to use it instead of calling Unsplit()
267 and then resplitting the window back because it will provoke much less flicker
268 (if any). It is valid to call this function whether the splitter has two
271 Both parameters should be non-NULL and
{\it winOld
} must specify one of the
272 windows managed by the splitter. If the parameters are incorrect or the window
273 couldn't be replaced, false is returned. Otherwise the function will return
274 true, but please notice that it will not delete the replaced window and you
275 may wish to do it yourself.
279 \helpref{wxSplitterWindow::GetMinimumPaneSize
}{wxsplitterwindowgetminimumpanesize
}
283 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}\\
284 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
}\\
285 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}
287 \membersection{wxSplitterWindow::SetSashGravity
}\label{wxsplitterwindowsetsashgravity
}
289 \func{void
}{SetSashGravity
}{\param{double
}{gravity
}}
291 Sets the sash gravity.
293 \wxheading{Parameters
}
295 \docparam{gravity
}{The sash gravity. Value between
0.0 and
1.0.
}
299 Gravity is real factor which controls position of sash while resizing wxSplitterWindow.
300 Gravity tells wxSplitterWindow how much will left/top window grow while resizing.
303 \begin{itemize
}\itemsep=
0pt
304 \item{ 0.0 - only the bottom/right window is automatically resized
}
305 \item{ 0.5 - both windows grow by equal size
}
306 \item{ 1.0 - only left/top window grows
}
309 Gravity should be a real value between
0.0 and
1.0.
311 Default value of sash gravity is
0.0. That value is compatible with previous
312 (before gravity was introduced) behaviour of wxSplitterWindow.
316 \helpref{wxSplitterWindow::GetSashGravity
}{wxsplitterwindowgetsashgravity
}
318 \membersection{wxSplitterWindow::SetSashPosition
}\label{wxsplitterwindowsetsashposition
}
320 \func{void
}{SetSashPosition
}{\param{int
}{position
},
\param{const bool
}{ redraw = true
}}
322 Sets the sash position.
324 \wxheading{Parameters
}
326 \docparam{position
}{The sash position in pixels.
}
328 \docparam{redraw
}{If true, resizes the panes and redraws the sash and border.
}
332 Does not currently check for an out-of-range value.
336 \helpref{wxSplitterWindow::GetSashPosition
}{wxsplitterwindowgetsashposition
}
338 \membersection{wxSplitterWindow::SetSashSize
}\label{wxsplitterwindowsetsashsize
}
340 \func{void
}{SetSashSize
}{\param{int
}{size
}}
342 Sets the sash size. Normally, the sash size is determined according to the metrics
343 of each platform, but the application can override this, for example to show
344 a thin sash that the user is not expected to drag. If
{\it size
} is more -
1,
345 the custom sash size will be used.
347 \membersection{wxSplitterWindow::SetMinimumPaneSize
}\label{wxsplitterwindowsetminimumpanesize
}
349 \func{void
}{SetMinimumPaneSize
}{\param{int
}{paneSize
}}
351 Sets the minimum pane size.
353 \wxheading{Parameters
}
355 \docparam{paneSize
}{Minimum pane size in pixels.
}
359 The default minimum pane size is zero, which means that either pane can be reduced to zero by dragging
360 the sash, thus removing one of the panes. To prevent this behaviour (and veto out-of-range sash dragging),
361 set a minimum size, for example
20 pixels. If the wxSP
\_PERMIT\_UNSPLIT style
362 is used when a splitter window is created, the window may be unsplit even
363 if minimum size is non-zero.
367 \helpref{wxSplitterWindow::GetMinimumPaneSize
}{wxsplitterwindowgetminimumpanesize
}
369 \membersection{wxSplitterWindow::SetSplitMode
}\label{wxsplitterwindowsetsplitmode
}
371 \func{void
}{SetSplitMode
}{\param{int
}{mode
}}
375 \wxheading{Parameters
}
377 \docparam{mode
}{Can be wxSPLIT
\_VERTICAL or wxSPLIT
\_HORIZONTAL.
}
381 Only sets the internal variable; does not update the display.
385 \helpref{wxSplitterWindow::GetSplitMode
}{wxsplitterwindowgetsplitmode
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
386 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}.
388 \membersection{wxSplitterWindow::SplitHorizontally
}\label{wxsplitterwindowsplithorizontally
}
390 \func{bool
}{SplitHorizontally
}{\param{wxWindow*
}{window1
},
\param{wxWindow*
}{window2
},
391 \param{int
}{ sashPosition =
0}}
393 Initializes the top and bottom panes of the splitter window. The
394 child windows are shown if they are currently hidden.
396 \wxheading{Parameters
}
398 \docparam{window1
}{The top pane.
}
400 \docparam{window2
}{The bottom pane.
}
402 \docparam{sashPosition
}{The initial position of the sash. If this value is
403 positive, it specifies the size of the upper pane. If it is negative, its
404 absolute value gives the size of the lower pane. Finally, specify
0 (default)
405 to choose the default position (half of the total window height).
}
407 \wxheading{Return value
}
409 true if successful, false otherwise (the window was already split).
413 This should be called if you wish to initially view two panes. It can also be
414 called at any subsequent time, but the application should check that the
415 window is not currently split using
\helpref{IsSplit
}{wxsplitterwindowissplit
}.
419 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\rtfsp
420 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}
422 \membersection{wxSplitterWindow::SplitVertically
}\label{wxsplitterwindowsplitvertically
}
424 \func{bool
}{SplitVertically
}{\param{wxWindow*
}{window1
},
\param{wxWindow*
}{window2
},
425 \param{int
}{ sashPosition =
0}}
427 Initializes the left and right panes of the splitter window. The
428 child windows are shown if they are currently hidden.
430 \wxheading{Parameters
}
432 \docparam{window1
}{The left pane.
}
434 \docparam{window2
}{The right pane.
}
436 \docparam{sashPosition
}{The initial position of the sash. If this value is
437 positive, it specifies the size of the left pane. If it is negative, it is
438 absolute value gives the size of the right pane. Finally, specify
0 (default)
439 to choose the default position (half of the total window width).
}
441 \wxheading{Return value
}
443 true if successful, false otherwise (the window was already split).
447 This should be called if you wish to initially view two panes. It can also be called at any subsequent time,
448 but the application should check that the window is not currently split using
\helpref{IsSplit
}{wxsplitterwindowissplit
}.
452 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\rtfsp
453 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}.
455 \membersection{wxSplitterWindow::Unsplit
}\label{wxsplitterwindowunsplit
}
457 \func{bool
}{Unsplit
}{\param{wxWindow*
}{toRemove = NULL
}}
461 \wxheading{Parameters
}
463 \docparam{toRemove
}{The pane to remove, or NULL to remove the right or bottom pane.
}
465 \wxheading{Return value
}
467 true if successful, false otherwise (the window was not split).
471 This call will not actually delete the pane being removed; it calls
\helpref{OnUnsplit
}{wxsplitterwindowonunsplit
}\rtfsp
472 which can be overridden for the desired behaviour. By default, the pane being removed is hidden.
476 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
477 \helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\helpref{wxSplitterWindow::OnUnsplit
}{wxsplitterwindowonunsplit
}
479 \membersection{wxSplitterWindow::UpdateSize
}\label{wxsplitterwindowupdatesize
}
481 \func{void
}{UpdateSize
}{\void}
483 Causes any pending sizing of the sash and child panes to take place
486 Such resizing normally takes place in idle time, in order
487 to wait for layout to be completed. However, this can cause
488 unacceptable flicker as the panes are resized after the window has been
489 shown. To work around this, you can perform window layout (for
490 example by sending a size event to the parent window), and then
491 call this function, before showing the top-level window.