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.
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.
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. |
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.
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.
SplitterWindow#init, SplitterWindow#split_vertically, SplitterWindow#split_horizontally, SplitterWindow#create
destructor()
Destroys the SplitterWindow and its children.
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.
Integer get_minimum_pane_size()
Returns the current minimum pane size (defaults to zero).
SplitterWindow#set_minimum_pane_size
double get_sash_gravity()
Returns the current sash gravity.
SplitterWindow#set_sash_gravity
Integer get_sash_position()
Returns the current sash position.
SplitterWindow#set_sash_position
Integer get_split_mode()
Gets the split mode.
SplitterWindow#set_split_mode, SplitterWindow#split_vertically, SplitterWindow#split_horizontally.
Window get_window_1()
Returns the left/top or only pane.
Window get_window_2()
Returns the right/bottom pane.
init(Window window)
Initializes the splitter window to have one pane. The child window is shown if it is currently hidden.
This should be called if you wish to initially view only a single pane in the splitter window.
SplitterWindow#split_vertically, SplitterWindow#split_horizontally
Boolean is_split()
Returns true if the window is split, false otherwise.
on_double_click_sash(Integer x, Integer y)
Application-overridable function called when the sash is double-clicked with the left mouse button.
The default implementation of this function calls Unsplit if the minimum pane size is zero.
on_unsplit(Window removed)
Application-overridable function called when the window is unsplit, either programmatically or using the SplitterWindow user interface.
The default implementation of this function simply hides removed. You may wish to delete the window.
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.
The default implementation of this function verifies that the sizes of both panes of the splitter are greater than minimum pane size.
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.
SplitterWindow#get_minimum_pane_size
SplitterWindow#split_vertically
SplitterWindow#split_horizontally
set_sash_gravity(Float gravity)
Sets the sash gravity.
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.
SplitterWindow#get_sash_gravity
set_sash_position(Integer position, Boolean redraw = true)
Sets the sash position.
Does not currently check for an out-of-range value.
SplitterWindow#get_sash_position
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.
set_minimum_pane_size(Integer paneSize)
Sets the minimum pane size.
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.
SplitterWindow#get_minimum_pane_size
set_split_mode(Integer mode)
Sets the split mode.
Only sets the internal variable; does not update the display.
SplitterWindow#get_split_mode, SplitterWindow#split_vertically, 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.
true if successful, false otherwise (the window was already split).
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#split_vertically, SplitterWindow#is_split, SplitterWindow#unsplit
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.
true if successful, false otherwise (the window was already split).
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#split_horizontally, SplitterWindow#is_split, SplitterWindow#unsplit.
Boolean unsplit(Window toRemove = nil)
Unsplits the window.
true if successful, false otherwise (the window was not split).
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.
SplitterWindow#split_horizontally, SplitterWindow#split_vertically, SplitterWindow#is_split, SplitterWindow#on_unsplit
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 Thu May 01 00:50:44 +0100 2008]