wxRuby Documentation Home

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.

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.

Derived from

Window

EvtHandler

Object

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 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.

See also

SplitterEvent

Methods

SplitterWindow.new

SplitterWindow.new(Window parent,  Integer id, 
                   Point point = DEFAULT_POSITION, 
                   Size size = DEFAULT_SIZE, 
                   Integer style=SP_3D, 
                   String name = "splitterWindow")

Constructor for creating the window.

Parameters

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#split_vertically and SplitterWindow#split_horizontally 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.

See also

SplitterWindow#init, SplitterWindow#split_vertically, SplitterWindow#split_horizontally, SplitterWindow#create

destructor()

Destroys the SplitterWindow and its children.

SplitterWindow#create

Boolean create(Window parent,  Integer id, 
                Point point = DEFAULT_POSITION, 
               Size size = DEFAULT_SIZE, 
               Integer style=SP_3D, 
               String name = "splitterWindow")

Creation function, for two-step construction. See SplitterWindow.new for details.

SplitterWindow#get_minimum_pane_size

Integer get_minimum_pane_size()

Returns the current minimum pane size (defaults to zero).

See also

SplitterWindow#set_minimum_pane_size

SplitterWindow#get_sash_gravity

double get_sash_gravity()

Returns the current sash gravity.

See also

SplitterWindow#set_sash_gravity

SplitterWindow#get_sash_position

Integer get_sash_position()

Returns the current sash position.

See also

SplitterWindow#set_sash_position

SplitterWindow#get_split_mode

Integer get_split_mode()

Gets the split mode.

See also

SplitterWindow#set_split_mode, SplitterWindow#split_vertically, SplitterWindow#split_horizontally.

SplitterWindow#get_window_1

Window get_window_1()

Returns the left/top or only pane.

SplitterWindow#get_window_2

Window get_window_2()

Returns the right/bottom pane.

SplitterWindow#init

init(Window window)

Initializes the splitter window to have one pane. The child window is shown if it is currently hidden.

Parameters

Remarks

This should be called if you wish to initially view only a single pane in the splitter window.

See also

SplitterWindow#split_vertically, SplitterWindow#split_horizontally

SplitterWindow#is_split

Boolean is_split()

Returns true if the window is split, false otherwise.

SplitterWindow#on_double_click_sash

on_double_click_sash(Integer x,  Integer y)

Application-overridable function called when the sash is double-clicked with the left mouse button.

Parameters

Remarks

The default implementation of this function calls Unsplit if the minimum pane size is zero.

See also

SplitterWindow#unsplit

SplitterWindow#on_unsplit

on_unsplit(Window removed)

Application-overridable function called when the window is unsplit, either programmatically or using the SplitterWindow user interface.

Parameters

Remarks

The default implementation of this function simply hides removed. You may wish to delete the window.

SplitterWindow#on_sash_position_change

Boolean on_sash_position_change(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.

Parameters

Remarks

The default implementation of this function verifies that the sizes of both panes of the splitter are greater than minimum pane size.

SplitterWindow#replace_window

Boolean replace_window(Window winOld,  Window 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.

See also

SplitterWindow#get_minimum_pane_size

See also

SplitterWindow#unsplit

SplitterWindow#split_vertically

SplitterWindow#split_horizontally

SplitterWindow#set_sash_gravity

set_sash_gravity(Float gravity)

Sets the sash gravity.

Parameters

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.

See also

SplitterWindow#get_sash_gravity

SplitterWindow#set_sash_position

set_sash_position(Integer position,  Boolean redraw = true)

Sets the sash position.

Parameters

Remarks

Does not currently check for an out-of-range value.

See also

SplitterWindow#get_sash_position

SplitterWindow#set_sash_size

set_sash_size(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.

SplitterWindow#set_minimum_pane_size

set_minimum_pane_size(Integer paneSize)

Sets the minimum pane size.

Parameters

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.

See also

SplitterWindow#get_minimum_pane_size

SplitterWindow#set_split_mode

set_split_mode(Integer mode)

Sets the split mode.

Parameters

Remarks

Only sets the internal variable; does not update the display.

See also

SplitterWindow#get_split_mode, SplitterWindow#split_vertically, SplitterWindow#split_horizontally.

SplitterWindow#split_horizontally

Boolean split_horizontally(Window window1,  Window window2, 
                           Integer sashPosition = 0)

Initializes the top and bottom panes of the splitter window. The child windows are shown if they are currently hidden.

Parameters

Return value

true if successful, false otherwise (the window was already split).

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.

See also

SplitterWindow#split_vertically, SplitterWindow#is_split, SplitterWindow#unsplit

SplitterWindow#split_vertically

Boolean split_vertically(Window window1,  Window window2, 
                         Integer sashPosition = 0)

Initializes the left and right panes of the splitter window. The child windows are shown if they are currently hidden.

Parameters

Return value

true if successful, false otherwise (the window was already split).

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.

See also

SplitterWindow#split_horizontally, SplitterWindow#is_split, SplitterWindow#unsplit.

SplitterWindow#unsplit

Boolean unsplit(Window toRemove = nil)

Unsplits the window.

Parameters

Return value

true if successful, false otherwise (the window was not split).

Remarks

This call will not actually delete the pane being removed; it calls on_unsplit which can be overridden for the desired behaviour. By default, the pane being removed is hidden.

See also

SplitterWindow#split_horizontally, SplitterWindow#split_vertically, SplitterWindow#is_split, SplitterWindow#on_unsplit

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.

[This page automatically generated from the Textile source at Wed Sep 09 02:21:24 +0100 2009]