h1(#wxsplitterwindow). Wx::SplitterWindow
SplitterWindow overviewwxsplitterwindowoverview
This class manages up to two subwindows. The current view can be
split into two programmatically (perhaps from a menu command), and unsplit
either programmatically or via the SplitterWindow user interface.
h2. Window styles
|@SP_3D@|Draws a 3D effect border and sash.|
|@SP_3DSASH@|Draws a 3D effect sash.|
|@SP_3DBORDER@|Synonym for SP_BORDER.|
|@SP_BORDER@|Draws a standard border.|
|@SP_NOBORDER@|No border (default).|
|@SP_NO_XP_THEME@|Under Windows XP, switches off the attempt to draw thesplitter using Windows XP theming, so the borders and sash will take on the pre-XP look.|
|@SP_PERMIT_UNSPLIT@|Always allow tounsplit, even with the minimum pane size other than zero.|
|@SP_LIVE_UPDATE@|Don't draw XOR line but resize the child windows immediately.|
See also "window styles overview":windowstyles.html.
h2. Derived from
"Window":window.html
"EvtHandler":evthandler.html
"Object":object.html
h2. Event handling
To process input from a splitter control, use the following event handler
macros to direct input to member functions that take a
"SplitterEvent":splitterevent.html argument.
|*evt_splitter_sash_pos_changing(id) { | event | ... }*|The sashposition is in the process of being changed. May be used to modify theposition of the tracking bar to properly reflect the position thatwould be set if the drag were to be completed at this point. Processesa EVT_COMMAND_SPLITTER_SASH_POS_CHANGING event.|
|*evt_splitter_sash_pos_changed(id) { | event | ... }*|The sashposition was changed. May be used to modify the sash position beforeit is set, or to prevent the change from taking place.Processes a EVT_COMMAND_SPLITTER_SASH_POS_CHANGED event.|
|*evt_splitter_unsplit(id) { | event | ... }*|The splitter has been justunsplit. Processes a EVT_COMMAND_SPLITTER_UNSPLIT event.|
|*evt_splitter_dclick(id) { | event | ... }*|The sash was doubleclicked. The default behaviour is to unsplit the window when this happens(unless the minimum pane size has been set to a value greater than zero).Processes a EVT_COMMAND_SPLITTER_DOUBLECLICKED event.|
h2. See also
"SplitterEvent":splitterevent.html
h2. Methods
* "SplitterWindow.new":#SplitterWindow_new
* "SplitterWindow#create":#SplitterWindow_create
* "SplitterWindow#get_minimum_pane_size":#SplitterWindow_getminimumpanesize
* "SplitterWindow#get_sash_gravity":#SplitterWindow_getsashgravity
* "SplitterWindow#get_sash_position":#SplitterWindow_getsashposition
* "SplitterWindow#get_split_mode":#SplitterWindow_getsplitmode
* "SplitterWindow#get_window_1":#SplitterWindow_getwindow1
* "SplitterWindow#get_window_2":#SplitterWindow_getwindow2
* "SplitterWindow#init":#SplitterWindow_init
* "SplitterWindow#is_split":#SplitterWindow_issplit
* "SplitterWindow#on_double_click_sash":#SplitterWindow_ondoubleclicksash
* "SplitterWindow#on_unsplit":#SplitterWindow_onunsplit
* "SplitterWindow#on_sash_position_change":#SplitterWindow_onsashpositionchange
* "SplitterWindow#replace_window":#SplitterWindow_replacewindow
* "SplitterWindow#set_sash_gravity":#SplitterWindow_setsashgravity
* "SplitterWindow#set_sash_position":#SplitterWindow_setsashposition
* "SplitterWindow#set_sash_size":#SplitterWindow_setsashsize
* "SplitterWindow#set_minimum_pane_size":#SplitterWindow_setminimumpanesize
* "SplitterWindow#set_split_mode":#SplitterWindow_setsplitmode
* "SplitterWindow#split_horizontally":#SplitterWindow_splithorizontally
* "SplitterWindow#split_vertically":#SplitterWindow_splitvertically
* "SplitterWindow#unsplit":#SplitterWindow_unsplit
* "SplitterWindow#update_size":#SplitterWindow_updatesize
h3(#SplitterWindow_new). SplitterWindow.new
*SplitterWindow.new*(%(arg-type)"Window":window.html% parent, %(arg-type)Integer% id,
%(arg-type)"Point":point.html% point = DEFAULT_POSITION,
%(arg-type)"Size":size.html% size = DEFAULT_SIZE,
%(arg-type)Integer% style=SP_3D,
%(arg-type)String% name = "splitterWindow")
Constructor for creating the window.
h4. Parameters
* _parent_ The parent of the splitter window.
* _id_ The window identifier.
* _pos_ The window position.
* _size_ The window size.
* _style_ The window style. See "SplitterWindow":splitterwindow.html.
* _name_ The window name.
h4. Remarks
After using this constructor, you must create either one or two subwindows
with the splitter window as parent, and then call one of "SplitterWindow#init":splitterwindow.html#SplitterWindow_init, "SplitterWindow#split_vertically":splitterwindow.html#SplitterWindow_splitvertically and "SplitterWindow#split_horizontally":splitterwindow.html#SplitterWindow_splithorizontally in
order to set the pane(s).
You can create two windows, with one hidden when not being shown; or you can
create and delete the second pane on demand.
h4. See also
"SplitterWindow#init":splitterwindow.html#SplitterWindow_init, "SplitterWindow#split_vertically":splitterwindow.html#SplitterWindow_splitvertically, "SplitterWindow#split_horizontally":splitterwindow.html#SplitterWindow_splithorizontally, "SplitterWindow#create":splitterwindow.html#SplitterWindow_create
*destructor*()
Destroys the SplitterWindow and its children.
h3(#SplitterWindow_create). SplitterWindow#create
Boolean *create*(%(arg-type)"Window":window.html% parent, %(arg-type)Integer% id,
%(arg-type)"Point":point.html% point = DEFAULT_POSITION,
%(arg-type)"Size":size.html% size = DEFAULT_SIZE,
%(arg-type)Integer% style=SP_3D,
%(arg-type)String% name = "splitterWindow")
Creation function, for two-step construction. See "SplitterWindow.new":splitterwindow.html#SplitterWindow_new for
details.
h3(#SplitterWindow_getminimumpanesize). SplitterWindow#get_minimum_pane_size
Integer *get_minimum_pane_size*()
Returns the current minimum pane size (defaults to zero).
h4. See also
"SplitterWindow#set_minimum_pane_size":splitterwindow.html#SplitterWindow_setminimumpanesize
h3(#SplitterWindow_getsashgravity). SplitterWindow#get_sash_gravity
double *get_sash_gravity*()
Returns the current sash gravity.
h4. See also
"SplitterWindow#set_sash_gravity":splitterwindow.html#SplitterWindow_setsashgravity
h3(#SplitterWindow_getsashposition). SplitterWindow#get_sash_position
Integer *get_sash_position*()
Returns the current sash position.
h4. See also
"SplitterWindow#set_sash_position":splitterwindow.html#SplitterWindow_setsashposition
h3(#SplitterWindow_getsplitmode). SplitterWindow#get_split_mode
Integer *get_split_mode*()
Gets the split mode.
h4. See also
"SplitterWindow#set_split_mode":splitterwindow.html#SplitterWindow_setsplitmode, "SplitterWindow#split_vertically":splitterwindow.html#SplitterWindow_splitvertically, "SplitterWindow#split_horizontally":splitterwindow.html#SplitterWindow_splithorizontally.
h3(#SplitterWindow_getwindow1). SplitterWindow#get_window_1
"Window":window.html *get_window_1*()
Returns the left/top or only pane.
h3(#SplitterWindow_getwindow2). SplitterWindow#get_window_2
"Window":window.html *get_window_2*()
Returns the right/bottom pane.
h3(#SplitterWindow_init). SplitterWindow#init
*init*(%(arg-type)"Window":window.html% window)
Initializes the splitter window to have one pane. The child window is
shown if it is currently hidden.
h4. Parameters
* _window_ The pane for the unsplit window.
h4. Remarks
This should be called if you wish to initially view only a single pane in the splitter window.
h4. See also
"SplitterWindow#split_vertically":splitterwindow.html#SplitterWindow_splitvertically, "SplitterWindow#split_horizontally":splitterwindow.html#SplitterWindow_splithorizontally
h3(#SplitterWindow_issplit). SplitterWindow#is_split
Boolean *is_split*()
Returns true if the window is split, false otherwise.
h3(#SplitterWindow_ondoubleclicksash). SplitterWindow#on_double_click_sash
*on_double_click_sash*(%(arg-type)Integer% x, %(arg-type)Integer% y)
Application-overridable function called when the sash is double-clicked with
the left mouse button.
h4. Parameters
* _x_ The x position of the mouse cursor.
* _y_ The y position of the mouse cursor.
h4. Remarks
The default implementation of this function calls "Unsplit":splitterwindowunsplit.html if
the minimum pane size is zero.
h4. See also
"SplitterWindow#unsplit":splitterwindow.html#SplitterWindow_unsplit
h3(#SplitterWindow_onunsplit). SplitterWindow#on_unsplit
*on_unsplit*(%(arg-type)"Window":window.html% removed)
Application-overridable function called when the window is unsplit, either
programmatically or using the SplitterWindow user interface.
h4. Parameters
* _removed_ The window being removed.
h4. Remarks
The default implementation of this function simply hides _removed_. You
may wish to delete the window.
h3(#SplitterWindow_onsashpositionchange). SplitterWindow#on_sash_position_change
Boolean *on_sash_position_change*(%(arg-type)Integer% newSashPosition)
Application-overridable function called when the sash position is changed by
user. It may return false to prevent the change or true to allow it.
h4. Parameters
* _newSashPosition_ The new sash position (always positive or zero)
h4. Remarks
The default implementation of this function verifies that the sizes of both
panes of the splitter are greater than minimum pane size.
h3(#SplitterWindow_replacewindow). SplitterWindow#replace_window
Boolean *replace_window*(%(arg-type)"Window":window.html% winOld, %(arg-type)"Window":window.html% winNew)
This function replaces one of the windows managed by the SplitterWindow with
another one. It is in general better to use it instead of calling Unsplit()
and then resplitting the window back because it will provoke much less flicker
(if any). It is valid to call this function whether the splitter has two
windows or only one.
Both parameters should be non-NULL and _winOld_ must specify one of the
windows managed by the splitter. If the parameters are incorrect or the window
couldn't be replaced, false is returned. Otherwise the function will return
true, but please notice that it will not delete the replaced window and you
may wish to do it yourself.
h4. See also
"SplitterWindow#get_minimum_pane_size":splitterwindow.html#SplitterWindow_getminimumpanesize
h4. See also
"SplitterWindow#unsplit":splitterwindow.html#SplitterWindow_unsplit
"SplitterWindow#split_vertically":splitterwindow.html#SplitterWindow_splitvertically
"SplitterWindow#split_horizontally":splitterwindow.html#SplitterWindow_splithorizontally
h3(#SplitterWindow_setsashgravity). SplitterWindow#set_sash_gravity
*set_sash_gravity*(%(arg-type)Float% gravity)
Sets the sash gravity.
h4. Parameters
* _gravity_ The sash gravity. Value between 0.0 and 1.0.
h4. Remarks
Gravity is real factor which controls position of sash while resizing SplitterWindow.
Gravity tells SplitterWindow how much will left/top window grow while resizing.
Example values:
0.0 - only the bottom/right window is automatically resized
0.5 - both windows grow by equal size
1.0 - only left/top window grows
Gravity should be a real value between 0.0 and 1.0.
Default value of sash gravity is 0.0. That value is compatible with previous
(before gravity was introduced) behaviour of SplitterWindow.
h4. See also
"SplitterWindow#get_sash_gravity":splitterwindow.html#SplitterWindow_getsashgravity
h3(#SplitterWindow_setsashposition). SplitterWindow#set_sash_position
*set_sash_position*(%(arg-type)Integer% position, %(arg-type)Boolean% redraw = true)
Sets the sash position.
h4. Parameters
* _position_ The sash position in pixels.
* _redraw_ If true, resizes the panes and redraws the sash and border.
h4. Remarks
Does not currently check for an out-of-range value.
h4. See also
"SplitterWindow#get_sash_position":splitterwindow.html#SplitterWindow_getsashposition
h3(#SplitterWindow_setsashsize). SplitterWindow#set_sash_size
*set_sash_size*(%(arg-type)Integer% size)
Sets the sash size. Normally, the sash size is determined according to the metrics
of each platform, but the application can override this, for example to show
a thin sash that the user is not expected to drag. If _size_ is more -1,
the custom sash size will be used.
h3(#SplitterWindow_setminimumpanesize). SplitterWindow#set_minimum_pane_size
*set_minimum_pane_size*(%(arg-type)Integer% paneSize)
Sets the minimum pane size.
h4. Parameters
* _paneSize_ Minimum pane size in pixels.
h4. Remarks
The default minimum pane size is zero, which means that either pane can be reduced to zero by dragging
the sash, thus removing one of the panes. To prevent this behaviour (and veto out-of-range sash dragging),
set a minimum size, for example 20 pixels. If the SP_PERMIT_UNSPLIT style
is used when a splitter window is created, the window may be unsplit even
if minimum size is non-zero.
h4. See also
"SplitterWindow#get_minimum_pane_size":splitterwindow.html#SplitterWindow_getminimumpanesize
h3(#SplitterWindow_setsplitmode). SplitterWindow#set_split_mode
*set_split_mode*(%(arg-type)Integer% mode)
Sets the split mode.
h4. Parameters
* _mode_ Can be SPLIT_VERTICAL or SPLIT_HORIZONTAL.
h4. Remarks
Only sets the internal variable; does not update the display.
h4. See also
"SplitterWindow#get_split_mode":splitterwindow.html#SplitterWindow_getsplitmode, "SplitterWindow#split_vertically":splitterwindow.html#SplitterWindow_splitvertically, "SplitterWindow#split_horizontally":splitterwindow.html#SplitterWindow_splithorizontally.
h3(#SplitterWindow_splithorizontally). SplitterWindow#split_horizontally
Boolean *split_horizontally*(%(arg-type)"Window":window.html% window1, %(arg-type)"Window":window.html% window2,
%(arg-type)Integer% sashPosition = 0)
Initializes the top and bottom panes of the splitter window. The
child windows are shown if they are currently hidden.
h4. Parameters
* _window1_ The top pane.
* _window2_ The bottom pane.
* _sashPosition_ The initial position of the sash. If this value is
positive, it specifies the size of the upper pane. If it is negative, its
absolute value gives the size of the lower pane. Finally, specify 0 (default)
to choose the default position (half of the total window height).
h4. Return value
true if successful, false otherwise (the window was already split).
h4. Remarks
This should be called if you wish to initially view two panes. It can also be
called at any subsequent time, but the application should check that the
window is not currently split using "is_split":#SplitterWindow_issplit.
h4. See also
"SplitterWindow#split_vertically":splitterwindow.html#SplitterWindow_splitvertically, "SplitterWindow#is_split":splitterwindow.html#SplitterWindow_issplit, "SplitterWindow#unsplit":splitterwindow.html#SplitterWindow_unsplit
h3(#SplitterWindow_splitvertically). SplitterWindow#split_vertically
Boolean *split_vertically*(%(arg-type)"Window":window.html% window1, %(arg-type)"Window":window.html% window2,
%(arg-type)Integer% sashPosition = 0)
Initializes the left and right panes of the splitter window. The
child windows are shown if they are currently hidden.
h4. Parameters
* _window1_ The left pane.
* _window2_ The right pane.
* _sashPosition_ The initial position of the sash. If this value is
positive, it specifies the size of the left pane. If it is negative, it is
absolute value gives the size of the right pane. Finally, specify 0 (default)
to choose the default position (half of the total window width).
h4. Return value
true if successful, false otherwise (the window was already split).
h4. Remarks
This should be called if you wish to initially view two panes. It can also be called at any subsequent time,
but the application should check that the window is not currently split using "is_split":#SplitterWindow_issplit.
h4. See also
"SplitterWindow#split_horizontally":splitterwindow.html#SplitterWindow_splithorizontally, "SplitterWindow#is_split":splitterwindow.html#SplitterWindow_issplit, "SplitterWindow#unsplit":splitterwindow.html#SplitterWindow_unsplit.
h3(#SplitterWindow_unsplit). SplitterWindow#unsplit
Boolean *unsplit*(%(arg-type)"Window":window.html% toRemove = nil)
Unsplits the window.
h4. Parameters
* _toRemove_ The pane to remove, or NULL to remove the right or bottom pane.
h4. Return value
true if successful, false otherwise (the window was not split).
h4. Remarks
This call will not actually delete the pane being removed; it calls "on_unsplit":#SplitterWindow_onunsplit which can be overridden for the desired behaviour. By default, the pane being removed is hidden.
h4. See also
"SplitterWindow#split_horizontally":splitterwindow.html#SplitterWindow_splithorizontally, "SplitterWindow#split_vertically":splitterwindow.html#SplitterWindow_splitvertically, "SplitterWindow#is_split":splitterwindow.html#SplitterWindow_issplit, "SplitterWindow#on_unsplit":splitterwindow.html#SplitterWindow_onunsplit
h3(#SplitterWindow_updatesize). SplitterWindow#update_size
*update_size*()
Causes any pending sizing of the sash and child panes to take place
immediately.
Such resizing normally takes place in idle time, in order
to wait for layout to be completed. However, this can cause
unacceptable flicker as the panes are resized after the window has been
shown. To work around this, you can perform window layout (for
example by sending a size event to the parent window), and then
call this function, before showing the top-level window.