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.
11 \wxheading{Window styles
}
13 \begin{twocollist
}\itemsep=
0pt
14 \twocolitem{\windowstyle{wxSP
\_3D}}{Draws a
3D effect border and sash.
}
15 \twocolitem{\windowstyle{wxSP
\_BORDER}}{Draws a thin black border around the window, and a black sash.
}
16 \twocolitem{\windowstyle{wxSP
\_NOBORDER}}{No border, and a black sash.
}
19 See also
\helpref{window styles overview
}{windowstyles
}.
21 \wxheading{Derived from
}
23 \helpref{wxWindow
}{wxwindow
}\\
24 \helpref{wxEvtHandler
}{wxevthandler
}\\
25 \helpref{wxObject
}{wxobject
}
27 \wxheading{Include files
}
31 \wxheading{Event handling
}
33 To process input from a splitter control, use the following event handler
34 macros to direct input to member functions that take a
35 \helpref{wxSplitterEvent
}{wxsplitterevent
} argument.
38 \begin{twocollist
}\itemsep=
0pt
39 \twocolitem{{\bf EVT
\_SPLITTER\_SASH\_POS\_CHANGED(id, func)
}
40 {The sash position was changed. May be used to prevent the change from
41 taking place. Processes wxEVT
\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGED event.
}
42 \twocolitem{{\bf EVT
\_SPLITTER\_UNSPLIT(id, func)
}}
43 {The splitter has been just unsplit. Processes wxEVT
\_COMMAND\_SPLITTER\_UNSPLIT
45 \twocolitem{{\bf EVT
\_SPLITTER\_DOUBLECLICKED(id, func)
}}
46 {The sash was double clicked. The default behaviour is to unsplit the
47 window when this happens (unless the minimum pane size has been set to a
48 value greater than zero). Processes wxEVT
\_COMMAND\_SPLITTER\_DOUBLECLICKED
54 \helpref{wxSplitterEvent
}{wxsplitterevent
}
56 \latexignore{\rtfignore{\wxheading{Members
}}}
58 \membersection{wxSplitterWindow::wxSplitterWindow
}\label{wxsplitterwindowconstr
}
60 \func{}{wxSplitterWindow
}{\void}
64 \func{}{wxSplitterWindow
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{ id
},
\param{int
}{x
},
\rtfsp
65 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
66 \param{long
}{style=wxSP
\_3D},
\param{const wxString\&
}{ name = "splitterWindow"
}}
68 Constructor for creating the window.
70 \wxheading{Parameters
}
72 \docparam{parent
}{The parent of the splitter window.
}
74 \docparam{id
}{The window identifier.
}
76 \docparam{pos
}{The window position.
}
78 \docparam{size
}{The window size.
}
80 \docparam{style
}{The window style. See
\helpref{wxSplitterWindow
}{wxsplitterwindow
}.
}
82 \docparam{name
}{The window name.
}
86 After using this constructor, you must create either one or two subwindows
87 with the splitter window as parent, and then call one of
\helpref{wxSplitterWindow::Initialize
}{wxsplitterwindowinitialize
},
\rtfsp
88 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
} and
\helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
} in
89 order to set the pane(s).
91 You can create two windows, with one hidden when not being shown; or you can
92 create and delete the second pane on demand.
96 \helpref{wxSplitterWindow::Initialize
}{wxsplitterwindowinitialize
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
97 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\rtfsp
98 \helpref{wxSplitterWindow::Create
}{wxsplitterwindowcreate
}
100 \membersection{wxSplitterWindow::
\destruct{wxSplitterWindow
}}
102 \func{}{\destruct{wxSplitterWindow
}}{\void}
104 Destroys the wxSplitterWindow and its children.
106 \membersection{wxSplitterWindow::Create
}\label{wxsplitterwindowcreate
}
108 \func{bool
}{Create
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{ id
},
\param{int
}{x
},
\rtfsp
109 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
110 \param{long
}{style=wxSP
\_3D},
\param{const wxString\&
}{ name = "splitterWindow"
}}
112 Creation function, for two-step construction. See
\helpref{wxSplitterWindow::wxSplitterWindow
}{wxsplitterwindowconstr
} for
115 \membersection{wxSplitterWindow::GetMinimumPaneSize
}\label{wxsplitterwindowgetminimumpanesize
}
117 \constfunc{int
}{GetMinimumPaneSize
}{\void}
119 Returns the current minimum pane size (defaults to zero).
123 \helpref{wxSplitterWindow::SetMinimumPaneSize
}{wxsplitterwindowsetminimumpanesize
}
125 \membersection{wxSplitterWindow::GetSashPosition
}\label{wxsplitterwindowgetsashposition
}
127 \func{int
}{GetSashPosition
}{\void}
129 Returns the current sash position.
133 \helpref{wxSplitterWindow::SetSashPosition
}{wxsplitterwindowsetsashposition
}
135 \membersection{wxSplitterWindow::GetSplitMode
}\label{wxsplitterwindowgetsplitmode
}
137 \constfunc{int
}{GetSplitMode
}{\void}
143 \helpref{wxSplitterWindow::SetSplitMode
}{wxsplitterwindowsetsplitmode
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
144 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}.
146 \membersection{wxSplitterWindow::GetWindow1
}\label{wxsplitterwindowgetwindow1
}
148 \constfunc{wxWindow*
}{GetWindow1
}{\void}
150 Returns the left/top or only pane.
152 \membersection{wxSplitterWindow::GetWindow2
}\label{wxsplitterwindowgetwindow2
}
154 \constfunc{wxWindow*
}{GetWindow2
}{\void}
156 Returns the right/bottom pane.
158 \membersection{wxSplitterWindow::Initialize
}\label{wxsplitterwindowinitialize
}
160 \func{void
}{Initialize
}{\param{wxWindow*
}{window
}}
162 Initializes the splitter window to have one pane.
164 \wxheading{Parameters
}
166 \docparam{window
}{The pane for the unsplit window.
}
170 This should be called if you wish to initially view only a single pane in the splitter window.
174 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
175 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}
177 \membersection{wxSplitterWindow::IsSplit
}\label{wxsplitterwindowissplit
}
179 \constfunc{bool
}{IsSplit
}{\void}
181 Returns TRUE if the window is split, FALSE otherwise.
183 \membersection{wxSplitterWindow::OnDoubleClickSash
}\label{wxsplitterwindowondoubleclicksash
}
185 \func{virtual void
}{OnDoubleClickSash
}{\param{int
}{x
},
\param{int
}{y
}}
187 Application-overridable function called when the sash is double-clicked with
188 the left mouse button.
190 \wxheading{Parameters
}
192 \docparam{x
}{The x position of the mouse cursor.
}
194 \docparam{y
}{The y position of the mouse cursor.
}
198 The default implementation of this function calls
\helpref{Unsplit
}{wxsplitterwindowunsplit
} if
199 the minimum pane size is zero.
203 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}
205 \membersection{wxSplitterWindow::OnUnsplit
}\label{wxsplitterwindowonunsplit
}
207 \func{virtual void
}{OnUnsplit
}{\param{wxWindow*
}{removed
}}
209 Application-overridable function called when the window is unsplit, either
210 programmatically or using the wxSplitterWindow user interface.
212 \wxheading{Parameters
}
214 \docparam{removed
}{The window being removed.
}
218 The default implementation of this function simply hides
{\it removed
}. You
219 may wish to delete the window.
221 \membersection{wxSplitterWindow::OnSashPositionChange
}\label{wxsplitterwindowonsashpositionchange
}
223 \func{virtual bool
}{OnSashPositionChange
}{\param{int
}{newSashPosition
}}
225 Application-overridable function called when the sash position is changed by
226 user. It may return FALSE to prevent the change or TRUE to allow it.
228 \wxheading{Parameters
}
230 \docparam{newSashPosition
}{The new sash position (always positive or zero)
}
234 The default implementation of this function verifies that the sizes of both
235 panes of the splitter are greater than minimum pane size.
237 \membersection{wxSplitterWindow::ReplaceWindow
}\label{wxsplitterwindowreplacewindow
}
239 \func{bool
}{ReplaceWindow
}{\param{wxWindow *
}{winOld
},
\param{wxWindow *
}{winNew
}}
241 This function replaces one of the windows managed by the wxSplitterWindow with
242 another one. It is in general better to use it instead of calling Unsplit()
243 and then resplitting the window back because it will provoke much less flicker
244 (if any). It is valid to call this function whether the splitter has two
247 Both parameters should be non NULL and
{\it winOld
} must specify one of the
248 windows managed by the splitter. If the parameters are incorrect or the window
249 couldn't be replaced, FALSE is returned. Otherwise the function will return
250 TRUE, but please notice that it will not delete the replaced window and you
251 may wish to do it yourself.
255 \helpref{wxSplitterWindow::GetMinimumPaneSize
}{wxsplitterwindowgetminimumpanesize
}
259 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}\\
260 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
}\\
261 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}
263 \membersection{wxSplitterWindow::SetSashPosition
}\label{wxsplitterwindowsetsashposition
}
265 \func{void
}{SetSashPosition
}{\param{int
}{position
},
\param{const bool
}{ redraw = TRUE
}}
267 Sets the sash position.
269 \wxheading{Parameters
}
271 \docparam{position
}{The sash position in pixels.
}
273 \docparam{redraw
}{If TRUE, resizes the panes and redraws the sash and border.
}
277 Does not currently check for an out-of-range value.
281 \helpref{wxSplitterWindow::GetSashPosition
}{wxsplitterwindowgetsashposition
}
283 \membersection{wxSplitterWindow::SetMinimumPaneSize
}\label{wxsplitterwindowsetminimumpanesize
}
285 \func{void
}{SetMinimumPaneSize
}{\param{int
}{paneSize
}}
287 Sets the minimum pane size.
289 \wxheading{Parameters
}
291 \docparam{paneSize
}{Minimum pane size in pixels.
}
295 The default minimum pane size is zero, which means that either pane can be reduced to zero by dragging
296 the sash, thus removing one of the panes. To prevent this behaviour (and veto out-of-range sash dragging),
297 set a minimum size, for example
20 pixels.
301 \helpref{wxSplitterWindow::GetMinimumPaneSize
}{wxsplitterwindowgetminimumpanesize
}
303 \membersection{wxSplitterWindow::SetSplitMode
}\label{wxsplitterwindowsetsplitmode
}
305 \func{void
}{SetSplitMode
}{\param{int
}{mode
}}
309 \wxheading{Parameters
}
311 \docparam{mode
}{Can be wxSPLIT
\_VERTICAL or wxSPLIT
\_HORIZONTAL.
}
315 Only sets the internal variable; does not update the display.
319 \helpref{wxSplitterWindow::GetSplitMode
}{wxsplitterwindowgetsplitmode
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
320 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}.
322 \membersection{wxSplitterWindow::SplitHorizontally
}\label{wxsplitterwindowsplithorizontally
}
324 \func{bool
}{SplitHorizontally
}{\param{wxWindow*
}{window1
},
\param{wxWindow*
}{window2
},
325 \param{int
}{ sashPosition =
0}}
327 Initializes the top and bottom panes of the splitter window.
329 \wxheading{Parameters
}
331 \docparam{window1
}{The top pane.
}
333 \docparam{window2
}{The bottom pane.
}
335 \docparam{sashPosition
}{The initial position of the sash. If this value is
336 positive, it specifies the size of the upper pane. If it's negative, it's
337 absolute value gives the size of the lower pane. Finally, specify
0 (default)
338 to choose the default position (half of the total window height).
}
340 \wxheading{Return value
}
342 TRUE if successful, FALSE otherwise (the window was already split).
346 This should be called if you wish to initially view two panes. It can also be
347 called at any subsequent time, but the application should check that the
348 window is not currently split using
\helpref{IsSplit
}{wxsplitterwindowissplit
}.
352 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\rtfsp
353 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}
355 \membersection{wxSplitterWindow::SplitVertically
}\label{wxsplitterwindowsplitvertically
}
357 \func{bool
}{SplitVertically
}{\param{wxWindow*
}{window1
},
\param{wxWindow*
}{window2
},
358 \param{int
}{ sashPosition =
0}}
360 Initializes the left and right panes of the splitter window.
362 \wxheading{Parameters
}
364 \docparam{window1
}{The left pane.
}
366 \docparam{window2
}{The right pane.
}
368 \docparam{sashPosition
}{The initial position of the sash. If this value is
369 positive, it specifies the size of the left pane. If it's negative, it's
370 absolute value gives the size of the right pane. Finally, specify
0 (default)
371 to choose the default position (half of the total window width).
}
373 \wxheading{Return value
}
375 TRUE if successful, FALSE otherwise (the window was already split).
379 This should be called if you wish to initially view two panes. It can also be called at any subsequent time,
380 but the application should check that the window is not currently split using
\helpref{IsSplit
}{wxsplitterwindowissplit
}.
384 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\rtfsp
385 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}.
387 \membersection{wxSplitterWindow::Unsplit
}\label{wxsplitterwindowunsplit
}
389 \func{bool
}{Unsplit
}{\param{wxWindow*
}{toRemove = NULL
}}
393 \wxheading{Parameters
}
395 \docparam{toRemove
}{The pane to remove, or NULL to remove the right or bottom pane.
}
397 \wxheading{Return value
}
399 TRUE if successful, FALSE otherwise (the window was not split).
403 This call will not actually delete the pane being removed; it calls
\helpref{OnUnsplit
}{wxsplitterwindowonunsplit
}\rtfsp
404 which can be overridden for the desired behaviour. By default, the pane being removed is hidden.
408 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
409 \helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\helpref{wxSplitterWindow::OnUnsplit
}{wxsplitterwindowonunsplit
}