#include <wx/splitter.h>
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 wxSplitterWindow user interface.
This class supports the following styles:
The following event handler macros redirect the events to member function handlers 'func' with prototypes like:
Event macros for events emitted by this class:
Public Member Functions | |
wxSplitterWindow () | |
Default constructor. | |
wxSplitterWindow (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSP_3D, const wxString &name="splitterWindow") | |
Constructor for creating the window. | |
virtual | ~wxSplitterWindow () |
Destroys the wxSplitterWindow and its children. | |
bool | Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &point=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSP_3D, const wxString &name="splitter") |
Creation function, for two-step construction. | |
int | GetMinimumPaneSize () const |
Returns the current minimum pane size (defaults to zero). | |
double | GetSashGravity () const |
Returns the current sash gravity. | |
int | GetSashPosition () const |
Returns the current sash position. | |
wxSplitMode | GetSplitMode () const |
Gets the split mode. | |
wxWindow * | GetWindow1 () const |
Returns the left/top or only pane. | |
wxWindow * | GetWindow2 () const |
Returns the right/bottom pane. | |
void | Initialize (wxWindow *window) |
Initializes the splitter window to have one pane. | |
bool | IsSplit () const |
Returns true if the window is split, false otherwise. | |
virtual void | OnDoubleClickSash (int x, int y) |
Application-overridable function called when the sash is double-clicked with the left mouse button. | |
virtual bool | OnSashPositionChange (int newSashPosition) |
Application-overridable function called when the sash position is changed by user. | |
virtual void | OnUnsplit (wxWindow *removed) |
Application-overridable function called when the window is unsplit, either programmatically or using the wxSplitterWindow user interface. | |
bool | ReplaceWindow (wxWindow *winOld, wxWindow *winNew) |
This function replaces one of the windows managed by the wxSplitterWindow with another one. | |
void | SetMinimumPaneSize (int paneSize) |
Sets the minimum pane size. | |
void | SetSashGravity (double gravity) |
Sets the sash gravity. | |
void | SetSashPosition (int position, bool redraw=true) |
Sets the sash position. | |
void | SetSashSize (int size) |
Sets the sash size. | |
void | SetSplitMode (int mode) |
Sets the split mode. | |
virtual bool | SplitHorizontally (wxWindow *window1, wxWindow *window2, int sashPosition=0) |
Initializes the top and bottom panes of the splitter window. | |
virtual bool | SplitVertically (wxWindow *window1, wxWindow *window2, int sashPosition=0) |
Initializes the left and right panes of the splitter window. | |
bool | Unsplit (wxWindow *toRemove=NULL) |
Unsplits the window. | |
void | UpdateSize () |
Causes any pending sizing of the sash and child panes to take place immediately. |
wxSplitterWindow::wxSplitterWindow | ( | ) |
Default constructor.
wxSplitterWindow::wxSplitterWindow | ( | wxWindow * | parent, | |
wxWindowID | id = wxID_ANY , |
|||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = wxSP_3D , |
|||
const wxString & | name = "splitterWindow" | |||
) |
Constructor for creating the window.
parent | The parent of the splitter window. | |
id | The window identifier. | |
pos | The window position. | |
size | The window size. | |
style | The window style. See wxSplitterWindow. | |
name | The window name. |
virtual wxSplitterWindow::~wxSplitterWindow | ( | ) | [virtual] |
Destroys the wxSplitterWindow and its children.
bool wxSplitterWindow::Create | ( | wxWindow * | parent, | |
wxWindowID | id = wxID_ANY , |
|||
const wxPoint & | point = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = wxSP_3D , |
|||
const wxString & | name = "splitter" | |||
) |
Creation function, for two-step construction.
See wxSplitterWindow() for details.
int wxSplitterWindow::GetMinimumPaneSize | ( | ) | const |
Returns the current minimum pane size (defaults to zero).
double wxSplitterWindow::GetSashGravity | ( | ) | const |
Returns the current sash gravity.
int wxSplitterWindow::GetSashPosition | ( | ) | const |
Returns the current sash position.
wxSplitMode wxSplitterWindow::GetSplitMode | ( | ) | const |
Gets the split mode.
wxWindow* wxSplitterWindow::GetWindow1 | ( | ) | const |
Returns the left/top or only pane.
wxWindow* wxSplitterWindow::GetWindow2 | ( | ) | const |
Returns the right/bottom pane.
void wxSplitterWindow::Initialize | ( | wxWindow * | window | ) |
Initializes the splitter window to have one pane.
The child window is shown if it is currently hidden.
window | The pane for the unsplit window. |
bool wxSplitterWindow::IsSplit | ( | ) | const |
Returns true if the window is split, false otherwise.
virtual void wxSplitterWindow::OnDoubleClickSash | ( | int | x, | |
int | y | |||
) | [virtual] |
Application-overridable function called when the sash is double-clicked with the left mouse button.
x | The x position of the mouse cursor. | |
y | The y position of the mouse cursor. |
virtual bool wxSplitterWindow::OnSashPositionChange | ( | int | newSashPosition | ) | [virtual] |
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.
newSashPosition | The new sash position (always positive or zero) |
virtual void wxSplitterWindow::OnUnsplit | ( | wxWindow * | removed | ) | [virtual] |
Application-overridable function called when the window is unsplit, either programmatically or using the wxSplitterWindow user interface.
removed | The window being removed. |
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.
void wxSplitterWindow::SetMinimumPaneSize | ( | int | paneSize | ) |
Sets the minimum pane size.
paneSize | Minimum pane size in pixels. |
void wxSplitterWindow::SetSashGravity | ( | double | gravity | ) |
Sets the sash gravity.
gravity | The sash gravity. Value between 0.0 and 1.0. |
void wxSplitterWindow::SetSashPosition | ( | int | position, | |
bool | redraw = true | |||
) |
Sets the sash position.
position | The sash position in pixels. | |
redraw | If true, resizes the panes and redraws the sash and border. |
void wxSplitterWindow::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.
void wxSplitterWindow::SetSplitMode | ( | int | mode | ) |
Sets the split mode.
mode | Can be wxSPLIT_VERTICAL or wxSPLIT_HORIZONTAL. |
virtual bool wxSplitterWindow::SplitHorizontally | ( | wxWindow * | window1, | |
wxWindow * | window2, | |||
int | sashPosition = 0 | |||
) | [virtual] |
Initializes the top and bottom panes of the splitter window.
The child windows are shown if they are currently hidden.
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). |
virtual bool wxSplitterWindow::SplitVertically | ( | wxWindow * | window1, | |
wxWindow * | window2, | |||
int | sashPosition = 0 | |||
) | [virtual] |
Initializes the left and right panes of the splitter window.
The child windows are shown if they are currently hidden.
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). |
bool wxSplitterWindow::Unsplit | ( | wxWindow * | toRemove = NULL |
) |
Unsplits the window.
toRemove | The pane to remove, or NULL to remove the right or bottom pane. |
void wxSplitterWindow::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.
![]() |
[ top ] |