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 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.
13 \wxheading{Window styles
}
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}}{Synonym for wxSP
\_BORDER.
}
19 \twocolitem{\windowstyle{wxSP
\_BORDER}}{Draws a standard border.
}
20 \twocolitem{\windowstyle{wxSP
\_NOBORDER}}{No border (default).
}
21 \twocolitem{\windowstyle{wxSP
\_PERMIT\_UNSPLIT}}{Always allow to
22 unsplit, even with the minimum pane size other than zero.
}
23 \twocolitem{\windowstyle{wxSP
\_LIVE\_UPDATE}}{Don't draw XOR line but resize the child windows immediately.
}
26 See also
\helpref{window styles overview
}{windowstyles
}.
28 \wxheading{Derived from
}
30 \helpref{wxWindow
}{wxwindow
}\\
31 \helpref{wxEvtHandler
}{wxevthandler
}\\
32 \helpref{wxObject
}{wxobject
}
34 \wxheading{Include files
}
38 \wxheading{Event handling
}
40 To process input from a splitter control, use the following event handler
41 macros to direct input to member functions that take a
42 \helpref{wxSplitterEvent
}{wxsplitterevent
} argument.
45 \begin{twocollist
}\itemsep=
0pt
46 \twocolitem{{\bf EVT
\_SPLITTER\_SASH\_POS\_CHANGING(id, func)
}}{The sash
47 position is in the process of being changed. May be used to modify the
48 position of the tracking bar to properly reflect the position that
49 would be set if the drag were to be completed at this point. Processes
50 a wxEVT
\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGING event.
}
51 \twocolitem{{\bf EVT
\_SPLITTER\_SASH\_POS\_CHANGED(id, func)
}}{The sash
52 position was changed. May be used to modify the sash position before
53 it is set, or to prevent the change from taking place.
54 Processes a wxEVT
\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGED event.
}
55 \twocolitem{{\bf EVT
\_SPLITTER\_UNSPLIT(id, func)
}}{The splitter has been just
56 unsplit. Processes a wxEVT
\_COMMAND\_SPLITTER\_UNSPLIT event.
}
57 \twocolitem{{\bf EVT
\_SPLITTER\_DCLICK(id, func)
}}{The sash was double
58 clicked. The default behaviour is to unsplit the window when this happens
59 (unless the minimum pane size has been set to a value greater than zero).
60 Processes a wxEVT
\_COMMAND\_SPLITTER\_DOUBLECLICKED event.
}
65 \helpref{wxSplitterEvent
}{wxsplitterevent
}
67 \latexignore{\rtfignore{\wxheading{Members
}}}
69 \membersection{wxSplitterWindow::wxSplitterWindow
}\label{wxsplitterwindowconstr
}
71 \func{}{wxSplitterWindow
}{\void}
75 \func{}{wxSplitterWindow
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{ id
},
\rtfsp
76 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
77 \param{long
}{style=wxSP
\_3D},
\param{const wxString\&
}{ name = "splitterWindow"
}}
79 Constructor for creating the window.
81 \wxheading{Parameters
}
83 \docparam{parent
}{The parent of the splitter window.
}
85 \docparam{id
}{The window identifier.
}
87 \docparam{pos
}{The window position.
}
89 \docparam{size
}{The window size.
}
91 \docparam{style
}{The window style. See
\helpref{wxSplitterWindow
}{wxsplitterwindow
}.
}
93 \docparam{name
}{The window name.
}
97 After using this constructor, you must create either one or two subwindows
98 with the splitter window as parent, and then call one of
\helpref{wxSplitterWindow::Initialize
}{wxsplitterwindowinitialize
},
\rtfsp
99 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
} and
\helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
} in
100 order to set the pane(s).
102 You can create two windows, with one hidden when not being shown; or you can
103 create and delete the second pane on demand.
107 \helpref{wxSplitterWindow::Initialize
}{wxsplitterwindowinitialize
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
108 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\rtfsp
109 \helpref{wxSplitterWindow::Create
}{wxsplitterwindowcreate
}
111 \membersection{wxSplitterWindow::
\destruct{wxSplitterWindow
}}
113 \func{}{\destruct{wxSplitterWindow
}}{\void}
115 Destroys the wxSplitterWindow and its children.
117 \membersection{wxSplitterWindow::Create
}\label{wxsplitterwindowcreate
}
119 \func{bool
}{Create
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{ id
},
\param{int
}{x
},
\rtfsp
120 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
121 \param{long
}{style=wxSP
\_3D},
\param{const wxString\&
}{ name = "splitterWindow"
}}
123 Creation function, for two-step construction. See
\helpref{wxSplitterWindow::wxSplitterWindow
}{wxsplitterwindowconstr
} for
126 \membersection{wxSplitterWindow::GetMinimumPaneSize
}\label{wxsplitterwindowgetminimumpanesize
}
128 \constfunc{int
}{GetMinimumPaneSize
}{\void}
130 Returns the current minimum pane size (defaults to zero).
134 \helpref{wxSplitterWindow::SetMinimumPaneSize
}{wxsplitterwindowsetminimumpanesize
}
136 \membersection{wxSplitterWindow::GetSashPosition
}\label{wxsplitterwindowgetsashposition
}
138 \func{int
}{GetSashPosition
}{\void}
140 Returns the current sash position.
144 \helpref{wxSplitterWindow::SetSashPosition
}{wxsplitterwindowsetsashposition
}
146 \membersection{wxSplitterWindow::GetSplitMode
}\label{wxsplitterwindowgetsplitmode
}
148 \constfunc{int
}{GetSplitMode
}{\void}
154 \helpref{wxSplitterWindow::SetSplitMode
}{wxsplitterwindowsetsplitmode
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
155 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}.
157 \membersection{wxSplitterWindow::GetWindow1
}\label{wxsplitterwindowgetwindow1
}
159 \constfunc{wxWindow*
}{GetWindow1
}{\void}
161 Returns the left/top or only pane.
163 \membersection{wxSplitterWindow::GetWindow2
}\label{wxsplitterwindowgetwindow2
}
165 \constfunc{wxWindow*
}{GetWindow2
}{\void}
167 Returns the right/bottom pane.
169 \membersection{wxSplitterWindow::Initialize
}\label{wxsplitterwindowinitialize
}
171 \func{void
}{Initialize
}{\param{wxWindow*
}{window
}}
173 Initializes the splitter window to have one pane.
175 \wxheading{Parameters
}
177 \docparam{window
}{The pane for the unsplit window.
}
181 This should be called if you wish to initially view only a single pane in the splitter window.
185 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
186 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}
188 \membersection{wxSplitterWindow::IsSplit
}\label{wxsplitterwindowissplit
}
190 \constfunc{bool
}{IsSplit
}{\void}
192 Returns true if the window is split, false otherwise.
194 \membersection{wxSplitterWindow::OnDoubleClickSash
}\label{wxsplitterwindowondoubleclicksash
}
196 \func{virtual void
}{OnDoubleClickSash
}{\param{int
}{x
},
\param{int
}{y
}}
198 Application-overridable function called when the sash is double-clicked with
199 the left mouse button.
201 \wxheading{Parameters
}
203 \docparam{x
}{The x position of the mouse cursor.
}
205 \docparam{y
}{The y position of the mouse cursor.
}
209 The default implementation of this function calls
\helpref{Unsplit
}{wxsplitterwindowunsplit
} if
210 the minimum pane size is zero.
214 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}
216 \membersection{wxSplitterWindow::OnUnsplit
}\label{wxsplitterwindowonunsplit
}
218 \func{virtual void
}{OnUnsplit
}{\param{wxWindow*
}{removed
}}
220 Application-overridable function called when the window is unsplit, either
221 programmatically or using the wxSplitterWindow user interface.
223 \wxheading{Parameters
}
225 \docparam{removed
}{The window being removed.
}
229 The default implementation of this function simply hides
{\it removed
}. You
230 may wish to delete the window.
232 \membersection{wxSplitterWindow::OnSashPositionChange
}\label{wxsplitterwindowonsashpositionchange
}
234 \func{virtual bool
}{OnSashPositionChange
}{\param{int
}{newSashPosition
}}
236 Application-overridable function called when the sash position is changed by
237 user. It may return false to prevent the change or true to allow it.
239 \wxheading{Parameters
}
241 \docparam{newSashPosition
}{The new sash position (always positive or zero)
}
245 The default implementation of this function verifies that the sizes of both
246 panes of the splitter are greater than minimum pane size.
248 \membersection{wxSplitterWindow::ReplaceWindow
}\label{wxsplitterwindowreplacewindow
}
250 \func{bool
}{ReplaceWindow
}{\param{wxWindow *
}{winOld
},
\param{wxWindow *
}{winNew
}}
252 This function replaces one of the windows managed by the wxSplitterWindow with
253 another one. It is in general better to use it instead of calling Unsplit()
254 and then resplitting the window back because it will provoke much less flicker
255 (if any). It is valid to call this function whether the splitter has two
258 Both parameters should be non-NULL and
{\it winOld
} must specify one of the
259 windows managed by the splitter. If the parameters are incorrect or the window
260 couldn't be replaced, false is returned. Otherwise the function will return
261 true, but please notice that it will not delete the replaced window and you
262 may wish to do it yourself.
266 \helpref{wxSplitterWindow::GetMinimumPaneSize
}{wxsplitterwindowgetminimumpanesize
}
270 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}\\
271 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
}\\
272 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}
274 \membersection{wxSplitterWindow::SetSashPosition
}\label{wxsplitterwindowsetsashposition
}
276 \func{void
}{SetSashPosition
}{\param{int
}{position
},
\param{const bool
}{ redraw = true
}}
278 Sets the sash position.
280 \wxheading{Parameters
}
282 \docparam{position
}{The sash position in pixels.
}
284 \docparam{redraw
}{If true, resizes the panes and redraws the sash and border.
}
288 Does not currently check for an out-of-range value.
292 \helpref{wxSplitterWindow::GetSashPosition
}{wxsplitterwindowgetsashposition
}
294 \membersection{wxSplitterWindow::SetMinimumPaneSize
}\label{wxsplitterwindowsetminimumpanesize
}
296 \func{void
}{SetMinimumPaneSize
}{\param{int
}{paneSize
}}
298 Sets the minimum pane size.
300 \wxheading{Parameters
}
302 \docparam{paneSize
}{Minimum pane size in pixels.
}
306 The default minimum pane size is zero, which means that either pane can be reduced to zero by dragging
307 the sash, thus removing one of the panes. To prevent this behaviour (and veto out-of-range sash dragging),
308 set a minimum size, for example
20 pixels. If the wxSP
\_PERMIT\_UNSPLIT style
309 is used when a splitter window is created, the window may be unsplit even
310 if minimum size is non-zero.
314 \helpref{wxSplitterWindow::GetMinimumPaneSize
}{wxsplitterwindowgetminimumpanesize
}
316 \membersection{wxSplitterWindow::SetSplitMode
}\label{wxsplitterwindowsetsplitmode
}
318 \func{void
}{SetSplitMode
}{\param{int
}{mode
}}
322 \wxheading{Parameters
}
324 \docparam{mode
}{Can be wxSPLIT
\_VERTICAL or wxSPLIT
\_HORIZONTAL.
}
328 Only sets the internal variable; does not update the display.
332 \helpref{wxSplitterWindow::GetSplitMode
}{wxsplitterwindowgetsplitmode
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
333 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}.
335 \membersection{wxSplitterWindow::SplitHorizontally
}\label{wxsplitterwindowsplithorizontally
}
337 \func{bool
}{SplitHorizontally
}{\param{wxWindow*
}{window1
},
\param{wxWindow*
}{window2
},
338 \param{int
}{ sashPosition =
0}}
340 Initializes the top and bottom panes of the splitter window.
342 \wxheading{Parameters
}
344 \docparam{window1
}{The top pane.
}
346 \docparam{window2
}{The bottom pane.
}
348 \docparam{sashPosition
}{The initial position of the sash. If this value is
349 positive, it specifies the size of the upper pane. If it is negative, it is
350 absolute value gives the size of the lower pane. Finally, specify
0 (default)
351 to choose the default position (half of the total window height).
}
353 \wxheading{Return value
}
355 true if successful, false otherwise (the window was already split).
359 This should be called if you wish to initially view two panes. It can also be
360 called at any subsequent time, but the application should check that the
361 window is not currently split using
\helpref{IsSplit
}{wxsplitterwindowissplit
}.
365 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\rtfsp
366 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}
368 \membersection{wxSplitterWindow::SplitVertically
}\label{wxsplitterwindowsplitvertically
}
370 \func{bool
}{SplitVertically
}{\param{wxWindow*
}{window1
},
\param{wxWindow*
}{window2
},
371 \param{int
}{ sashPosition =
0}}
373 Initializes the left and right panes of the splitter window.
375 \wxheading{Parameters
}
377 \docparam{window1
}{The left pane.
}
379 \docparam{window2
}{The right pane.
}
381 \docparam{sashPosition
}{The initial position of the sash. If this value is
382 positive, it specifies the size of the left pane. If it is negative, it is
383 absolute value gives the size of the right pane. Finally, specify
0 (default)
384 to choose the default position (half of the total window width).
}
386 \wxheading{Return value
}
388 true if successful, false otherwise (the window was already split).
392 This should be called if you wish to initially view two panes. It can also be called at any subsequent time,
393 but the application should check that the window is not currently split using
\helpref{IsSplit
}{wxsplitterwindowissplit
}.
397 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\rtfsp
398 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}.
400 \membersection{wxSplitterWindow::Unsplit
}\label{wxsplitterwindowunsplit
}
402 \func{bool
}{Unsplit
}{\param{wxWindow*
}{toRemove = NULL
}}
406 \wxheading{Parameters
}
408 \docparam{toRemove
}{The pane to remove, or NULL to remove the right or bottom pane.
}
410 \wxheading{Return value
}
412 true if successful, false otherwise (the window was not split).
416 This call will not actually delete the pane being removed; it calls
\helpref{OnUnsplit
}{wxsplitterwindowonunsplit
}\rtfsp
417 which can be overridden for the desired behaviour. By default, the pane being removed is hidden.
421 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
422 \helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\helpref{wxSplitterWindow::OnUnsplit
}{wxsplitterwindowonunsplit
}