wxSplitterWindowThis 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 wxSplitterWindow user interface. Window styles
See also window styles overview. Derived from
wxWindow Include files <wx/splitter.h> Event handling To process input from a splitter control, use the following event handler macros to direct input to member functions that take a wxSplitterEvent argument.
Members
wxSplitterWindow::wxSplitterWindow
wxSplitterWindow::wxSplitterWindowwxSplitterWindow() Default constructor. wxSplitterWindow(wxWindow* parent, wxWindowID id, const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style=wxSP_3D, const wxString& name = "splitterWindow") Constructor for creating the window. Parameters parent
id
pos
size
style
name
Remarks After using this constructor, you must create either one or two subwindows with the splitter window as parent, and then call one of wxSplitterWindow::Initialize, wxSplitterWindow::SplitVertically and wxSplitterWindow::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. See also wxSplitterWindow::Initialize, wxSplitterWindow::SplitVertically, wxSplitterWindow::SplitHorizontally, wxSplitterWindow::Create
wxSplitterWindow::~wxSplitterWindow~wxSplitterWindow() Destroys the wxSplitterWindow and its children.
wxSplitterWindow::Createbool Create(wxWindow* parent, wxWindowID id, const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style=wxSP_3D, const wxString& name = "splitterWindow") Creation function, for two-step construction. See wxSplitterWindow::wxSplitterWindow for details.
wxSplitterWindow::GetMinimumPaneSizeint GetMinimumPaneSize() const Returns the current minimum pane size (defaults to zero). See also wxSplitterWindow::SetMinimumPaneSize
wxSplitterWindow::GetSashGravitydouble GetSashGravity() Returns the current sash gravity. See also wxSplitterWindow::SetSashGravity
wxSplitterWindow::GetSashPositionint GetSashPosition() Returns the current sash position. See also wxSplitterWindow::SetSashPosition
wxSplitterWindow::GetSplitModeint GetSplitMode() const Gets the split mode. See also wxSplitterWindow::SetSplitMode, wxSplitterWindow::SplitVertically, wxSplitterWindow::SplitHorizontally.
wxSplitterWindow::GetWindow1wxWindow* GetWindow1() const Returns the left/top or only pane.
wxSplitterWindow::GetWindow2wxWindow* GetWindow2() const Returns the right/bottom pane.
wxSplitterWindow::Initializevoid Initialize(wxWindow* window) Initializes the splitter window to have one pane. The child window is shown if it is currently hidden. Parameters window
Remarks This should be called if you wish to initially view only a single pane in the splitter window. See also wxSplitterWindow::SplitVertically, wxSplitterWindow::SplitHorizontally
wxSplitterWindow::IsSplitbool IsSplit() const Returns true if the window is split, false otherwise.
wxSplitterWindow::OnDoubleClickSashvirtual void OnDoubleClickSash(int x, int y) Application-overridable function called when the sash is double-clicked with the left mouse button. Parameters x
y
Remarks The default implementation of this function calls Unsplit if the minimum pane size is zero. See also
wxSplitterWindow::OnUnsplitvirtual void OnUnsplit(wxWindow* removed) Application-overridable function called when the window is unsplit, either programmatically or using the wxSplitterWindow user interface. Parameters removed
Remarks The default implementation of this function simply hides removed. You may wish to delete the window.
wxSplitterWindow::OnSashPositionChangevirtual bool OnSashPositionChange(int 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 newSashPosition
Remarks The default implementation of this function verifies that the sizes of both panes of the splitter are greater than minimum pane size.
wxSplitterWindow::ReplaceWindowbool ReplaceWindow(wxWindow * winOld, wxWindow * winNew) This function replaces one of the windows managed by the wxSplitterWindow 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 wxSplitterWindow::GetMinimumPaneSize See also
wxSplitterWindow::Unsplit
wxSplitterWindow::SetSashGravityvoid SetSashGravity(double gravity) Sets the sash gravity. Parameters gravity
Remarks Gravity is real factor which controls position of sash while resizing wxSplitterWindow. Gravity tells wxSplitterWindow how much will left/top window grow while resizing. Example values:
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 wxSplitterWindow. See also wxSplitterWindow::GetSashGravity
wxSplitterWindow::SetSashPositionvoid SetSashPosition(int position, const bool redraw = true) Sets the sash position. Parameters position
redraw
Remarks Does not currently check for an out-of-range value. See also wxSplitterWindow::GetSashPosition
wxSplitterWindow::SetSashSizevoid SetSashSize(int 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.
wxSplitterWindow::SetMinimumPaneSizevoid SetMinimumPaneSize(int paneSize) Sets the minimum pane size. Parameters paneSize
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 wxSP_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 wxSplitterWindow::GetMinimumPaneSize
wxSplitterWindow::SetSplitModevoid SetSplitMode(int mode) Sets the split mode. Parameters mode
Remarks Only sets the internal variable; does not update the display. See also wxSplitterWindow::GetSplitMode, wxSplitterWindow::SplitVertically, wxSplitterWindow::SplitHorizontally.
wxSplitterWindow::SplitHorizontallybool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = 0) Initializes the top and bottom panes of the splitter window. The child windows are shown if they are currently hidden. Parameters window1
window2
sashPosition
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 IsSplit. See also wxSplitterWindow::SplitVertically, wxSplitterWindow::IsSplit, wxSplitterWindow::Unsplit
wxSplitterWindow::SplitVerticallybool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = 0) Initializes the left and right panes of the splitter window. The child windows are shown if they are currently hidden. Parameters window1
window2
sashPosition
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 IsSplit. See also wxSplitterWindow::SplitHorizontally, wxSplitterWindow::IsSplit, wxSplitterWindow::Unsplit.
wxSplitterWindow::Unsplitbool Unsplit(wxWindow* toRemove = NULL) Unsplits the window. Parameters toRemove
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 OnUnsplit which can be overridden for the desired behaviour. By default, the pane being removed is hidden. See also wxSplitterWindow::SplitHorizontally, wxSplitterWindow::SplitVertically, wxSplitterWindow::IsSplit, wxSplitterWindow::OnUnsplit
wxSplitterWindow::UpdateSizevoid UpdateSize() 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.
|