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.
12 \wxheading{Window styles
}
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.
}
23 See also
\helpref{window styles overview
}{windowstyles
}.
25 \wxheading{Derived from
}
27 \helpref{wxWindow
}{wxwindow
}\\
28 \helpref{wxEvtHandler
}{wxevthandler
}\\
29 \helpref{wxObject
}{wxobject
}
31 \wxheading{Include files
}
35 \wxheading{Event handling
}
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.
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.
}
62 \helpref{wxSplitterEvent
}{wxsplitterevent
}
64 \latexignore{\rtfignore{\wxheading{Members
}}}
66 \membersection{wxSplitterWindow::wxSplitterWindow
}\label{wxsplitterwindowconstr
}
68 \func{}{wxSplitterWindow
}{\void}
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"
}}
76 Constructor for creating the window.
78 \wxheading{Parameters
}
80 \docparam{parent
}{The parent of the splitter window.
}
82 \docparam{id
}{The window identifier.
}
84 \docparam{pos
}{The window position.
}
86 \docparam{size
}{The window size.
}
88 \docparam{style
}{The window style. See
\helpref{wxSplitterWindow
}{wxsplitterwindow
}.
}
90 \docparam{name
}{The window name.
}
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).
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.
104 \helpref{wxSplitterWindow::Initialize
}{wxsplitterwindowinitialize
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
105 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\rtfsp
106 \helpref{wxSplitterWindow::Create
}{wxsplitterwindowcreate
}
108 \membersection{wxSplitterWindow::
\destruct{wxSplitterWindow
}}
110 \func{}{\destruct{wxSplitterWindow
}}{\void}
112 Destroys the wxSplitterWindow and its children.
114 \membersection{wxSplitterWindow::Create
}\label{wxsplitterwindowcreate
}
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"
}}
120 Creation function, for two-step construction. See
\helpref{wxSplitterWindow::wxSplitterWindow
}{wxsplitterwindowconstr
} for
123 \membersection{wxSplitterWindow::GetMinimumPaneSize
}\label{wxsplitterwindowgetminimumpanesize
}
125 \constfunc{int
}{GetMinimumPaneSize
}{\void}
127 Returns the current minimum pane size (defaults to zero).
131 \helpref{wxSplitterWindow::SetMinimumPaneSize
}{wxsplitterwindowsetminimumpanesize
}
133 \membersection{wxSplitterWindow::GetSashPosition
}\label{wxsplitterwindowgetsashposition
}
135 \func{int
}{GetSashPosition
}{\void}
137 Returns the current sash position.
141 \helpref{wxSplitterWindow::SetSashPosition
}{wxsplitterwindowsetsashposition
}
143 \membersection{wxSplitterWindow::GetSplitMode
}\label{wxsplitterwindowgetsplitmode
}
145 \constfunc{int
}{GetSplitMode
}{\void}
151 \helpref{wxSplitterWindow::SetSplitMode
}{wxsplitterwindowsetsplitmode
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
152 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}.
154 \membersection{wxSplitterWindow::GetWindow1
}\label{wxsplitterwindowgetwindow1
}
156 \constfunc{wxWindow*
}{GetWindow1
}{\void}
158 Returns the left/top or only pane.
160 \membersection{wxSplitterWindow::GetWindow2
}\label{wxsplitterwindowgetwindow2
}
162 \constfunc{wxWindow*
}{GetWindow2
}{\void}
164 Returns the right/bottom pane.
166 \membersection{wxSplitterWindow::Initialize
}\label{wxsplitterwindowinitialize
}
168 \func{void
}{Initialize
}{\param{wxWindow*
}{window
}}
170 Initializes the splitter window to have one pane.
172 \wxheading{Parameters
}
174 \docparam{window
}{The pane for the unsplit window.
}
178 This should be called if you wish to initially view only a single pane in the splitter window.
182 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
183 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}
185 \membersection{wxSplitterWindow::IsSplit
}\label{wxsplitterwindowissplit
}
187 \constfunc{bool
}{IsSplit
}{\void}
189 Returns TRUE if the window is split, FALSE otherwise.
191 \membersection{wxSplitterWindow::OnDoubleClickSash
}\label{wxsplitterwindowondoubleclicksash
}
193 \func{virtual void
}{OnDoubleClickSash
}{\param{int
}{x
},
\param{int
}{y
}}
195 Application-overridable function called when the sash is double-clicked with
196 the left mouse button.
198 \wxheading{Parameters
}
200 \docparam{x
}{The x position of the mouse cursor.
}
202 \docparam{y
}{The y position of the mouse cursor.
}
206 The default implementation of this function calls
\helpref{Unsplit
}{wxsplitterwindowunsplit
} if
207 the minimum pane size is zero.
211 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}
213 \membersection{wxSplitterWindow::OnUnsplit
}\label{wxsplitterwindowonunsplit
}
215 \func{virtual void
}{OnUnsplit
}{\param{wxWindow*
}{removed
}}
217 Application-overridable function called when the window is unsplit, either
218 programmatically or using the wxSplitterWindow user interface.
220 \wxheading{Parameters
}
222 \docparam{removed
}{The window being removed.
}
226 The default implementation of this function simply hides
{\it removed
}. You
227 may wish to delete the window.
229 \membersection{wxSplitterWindow::OnSashPositionChange
}\label{wxsplitterwindowonsashpositionchange
}
231 \func{virtual bool
}{OnSashPositionChange
}{\param{int
}{newSashPosition
}}
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.
236 \wxheading{Parameters
}
238 \docparam{newSashPosition
}{The new sash position (always positive or zero)
}
242 The default implementation of this function verifies that the sizes of both
243 panes of the splitter are greater than minimum pane size.
245 \membersection{wxSplitterWindow::ReplaceWindow
}\label{wxsplitterwindowreplacewindow
}
247 \func{bool
}{ReplaceWindow
}{\param{wxWindow *
}{winOld
},
\param{wxWindow *
}{winNew
}}
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
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.
263 \helpref{wxSplitterWindow::GetMinimumPaneSize
}{wxsplitterwindowgetminimumpanesize
}
267 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}\\
268 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
}\\
269 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}
271 \membersection{wxSplitterWindow::SetSashPosition
}\label{wxsplitterwindowsetsashposition
}
273 \func{void
}{SetSashPosition
}{\param{int
}{position
},
\param{const bool
}{ redraw = TRUE
}}
275 Sets the sash position.
277 \wxheading{Parameters
}
279 \docparam{position
}{The sash position in pixels.
}
281 \docparam{redraw
}{If TRUE, resizes the panes and redraws the sash and border.
}
285 Does not currently check for an out-of-range value.
289 \helpref{wxSplitterWindow::GetSashPosition
}{wxsplitterwindowgetsashposition
}
291 \membersection{wxSplitterWindow::SetMinimumPaneSize
}\label{wxsplitterwindowsetminimumpanesize
}
293 \func{void
}{SetMinimumPaneSize
}{\param{int
}{paneSize
}}
295 Sets the minimum pane size.
297 \wxheading{Parameters
}
299 \docparam{paneSize
}{Minimum pane size in pixels.
}
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.
311 \helpref{wxSplitterWindow::GetMinimumPaneSize
}{wxsplitterwindowgetminimumpanesize
}
313 \membersection{wxSplitterWindow::SetSplitMode
}\label{wxsplitterwindowsetsplitmode
}
315 \func{void
}{SetSplitMode
}{\param{int
}{mode
}}
319 \wxheading{Parameters
}
321 \docparam{mode
}{Can be wxSPLIT
\_VERTICAL or wxSPLIT
\_HORIZONTAL.
}
325 Only sets the internal variable; does not update the display.
329 \helpref{wxSplitterWindow::GetSplitMode
}{wxsplitterwindowgetsplitmode
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
330 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
}.
332 \membersection{wxSplitterWindow::SplitHorizontally
}\label{wxsplitterwindowsplithorizontally
}
334 \func{bool
}{SplitHorizontally
}{\param{wxWindow*
}{window1
},
\param{wxWindow*
}{window2
},
335 \param{int
}{ sashPosition =
0}}
337 Initializes the top and bottom panes of the splitter window.
339 \wxheading{Parameters
}
341 \docparam{window1
}{The top pane.
}
343 \docparam{window2
}{The bottom pane.
}
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).
}
350 \wxheading{Return value
}
352 TRUE if successful, FALSE otherwise (the window was already split).
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
}.
362 \helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\rtfsp
363 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}
365 \membersection{wxSplitterWindow::SplitVertically
}\label{wxsplitterwindowsplitvertically
}
367 \func{bool
}{SplitVertically
}{\param{wxWindow*
}{window1
},
\param{wxWindow*
}{window2
},
368 \param{int
}{ sashPosition =
0}}
370 Initializes the left and right panes of the splitter window.
372 \wxheading{Parameters
}
374 \docparam{window1
}{The left pane.
}
376 \docparam{window2
}{The right pane.
}
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).
}
383 \wxheading{Return value
}
385 TRUE if successful, FALSE otherwise (the window was already split).
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
}.
394 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\rtfsp
395 \helpref{wxSplitterWindow::Unsplit
}{wxsplitterwindowunsplit
}.
397 \membersection{wxSplitterWindow::Unsplit
}\label{wxsplitterwindowunsplit
}
399 \func{bool
}{Unsplit
}{\param{wxWindow*
}{toRemove = NULL
}}
403 \wxheading{Parameters
}
405 \docparam{toRemove
}{The pane to remove, or NULL to remove the right or bottom pane.
}
407 \wxheading{Return value
}
409 TRUE if successful, FALSE otherwise (the window was not split).
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.
418 \helpref{wxSplitterWindow::SplitHorizontally
}{wxsplitterwindowsplithorizontally
},
\helpref{wxSplitterWindow::SplitVertically
}{wxsplitterwindowsplitvertically
},
\rtfsp
419 \helpref{wxSplitterWindow::IsSplit
}{wxsplitterwindowissplit
},
\helpref{wxSplitterWindow::OnUnsplit
}{wxsplitterwindowonunsplit
}