Version: 2.9.4
Public Member Functions
wxSplitterWindow Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/splitter.h>

Inheritance diagram for wxSplitterWindow:

Detailed Description

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.

Styles

This class supports the following styles:

Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxSplitterEvent& event)

Event macros for events emitted by this class:

Library:  wxCore
Category:  Miscellaneous Windows
参照:
wxSplitterEvent, wxSplitterWindow Overview

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.
int GetSashSize () const
 Returns the default sash size in pixels or 0 if it is invisible.
int GetDefaultSashSize () const
 Returns the default sash size in pixels.
wxSplitMode GetSplitMode () const
 Gets the split mode.
wxWindowGetWindow1 () const
 Returns the left/top or only pane.
wxWindowGetWindow2 () const
 Returns the right/bottom pane.
void Initialize (wxWindow *window)
 Initializes the splitter window to have one pane.
bool IsSashInvisible () const
 Returns true if the sash is invisible even when the window is split, false otherwise.
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 SetSplitMode (int mode)
 Sets the split mode.
void SetSashInvisible (bool invisible=true)
 Sets whether the sash should be invisible, even when the window is split.
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.

List of all members.


Constructor & Destructor Documentation

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.

Parameters:
parentThe parent of the splitter window.
idThe window identifier.
posThe window position.
sizeThe window size.
styleThe window style. See wxSplitterWindow.
nameThe window name.
注意:
After using this constructor, you must create either one or two subwindows with the splitter window as parent, and then call one of Initialize(), SplitVertically() and 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.
参照:
Initialize(), SplitVertically(), SplitHorizontally(), Create()
virtual wxSplitterWindow::~wxSplitterWindow ( ) [virtual]

Destroys the wxSplitterWindow and its children.


Member Function Documentation

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.

Reimplemented from wxWindow.

int wxSplitterWindow::GetDefaultSashSize ( ) const

Returns the default sash size in pixels.

The size of the sash is its width for a vertically split window and its height for a horizontally split one. Its other direction is the same as the client size of the window in the corresponding direction.

The default sash size is platform-dependent because it conforms to the current platform look-and-feel and cannot be changed.

Since:
2.9.4
int wxSplitterWindow::GetMinimumPaneSize ( ) const

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

参照:
SetMinimumPaneSize()
double wxSplitterWindow::GetSashGravity ( ) const

Returns the current sash gravity.

参照:
SetSashGravity()
int wxSplitterWindow::GetSashPosition ( ) const

Returns the current sash position.

参照:
SetSashPosition()
int wxSplitterWindow::GetSashSize ( ) const

Returns the default sash size in pixels or 0 if it is invisible.

参照:
GetDefaultSashSize(), IsSashInvisible()
wxSplitMode wxSplitterWindow::GetSplitMode ( ) const

Gets the split mode.

参照:
SetSplitMode(), SplitVertically(), SplitHorizontally().
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.

Parameters:
windowThe pane for the unsplit window.
注意:
This should be called if you wish to initially view only a single pane in the splitter window.
参照:
SplitVertically(), SplitHorizontally()
bool wxSplitterWindow::IsSashInvisible ( ) const

Returns true if the sash is invisible even when the window is split, false otherwise.

注意:
This is a shortcut for HasFlag(wxSP_NOSASH)
参照:
SetSashInvisible()
Since:
2.9.4
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.

Parameters:
xThe x position of the mouse cursor.
yThe y position of the mouse cursor.
注意:
The default implementation of this function calls Unsplit if the minimum pane size is zero.
参照:
Unsplit()
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.

Parameters:
newSashPositionThe new sash position (always positive or zero)
注意:
The default implementation of this function verifies that the sizes of both panes of the splitter are greater than minimum pane size.
virtual void wxSplitterWindow::OnUnsplit ( wxWindow removed) [virtual]

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

Parameters:
removedThe window being removed.
注意:
The default implementation of this function simply hides removed. You may wish to delete the window.
bool wxSplitterWindow::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.

参照:
GetMinimumPaneSize()
void wxSplitterWindow::SetMinimumPaneSize ( int  paneSize)

Sets the minimum pane size.

Parameters:
paneSizeMinimum pane size in pixels.
注意:
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.
参照:
GetMinimumPaneSize()
void wxSplitterWindow::SetSashGravity ( double  gravity)

Sets the sash gravity.

Parameters:
gravityThe sash gravity. Value between 0.0 and 1.0.
注意:
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:
  • 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 wxSplitterWindow.
参照:
GetSashGravity()
void wxSplitterWindow::SetSashInvisible ( bool  invisible = true)

Sets whether the sash should be invisible, even when the window is split.

When the sash is invisible, it doesn't appear on the screen at all and, in particular, doesn't allow the user to resize the windows.

注意:
Only sets the internal variable; does not update the display.
Parameters:
invisibleIf true, the sash is always invisible, else it is shown when the window is split.
参照:
IsSashInvisible()
Since:
2.9.4
void wxSplitterWindow::SetSashPosition ( int  position,
bool  redraw = true 
)

Sets the sash position.

Parameters:
positionThe sash position in pixels.
redrawIf true, resizes the panes and redraws the sash and border.
注意:
Does not currently check for an out-of-range value.
参照:
GetSashPosition()
void wxSplitterWindow::SetSplitMode ( int  mode)

Sets the split mode.

Parameters:
modeCan be wxSPLIT_VERTICAL or wxSPLIT_HORIZONTAL.
注意:
Only sets the internal variable; does not update the display.
参照:
GetSplitMode(), SplitVertically(), SplitHorizontally().
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.

Parameters:
window1The top pane.
window2The bottom pane.
sashPositionThe 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).
Returns:
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 IsSplit().
参照:
SplitVertically(), IsSplit(), Unsplit()
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.

Parameters:
window1The left pane.
window2The right pane.
sashPositionThe 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).
Returns:
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 IsSplit().
参照:
SplitHorizontally(), IsSplit(), Unsplit().
bool wxSplitterWindow::Unsplit ( wxWindow toRemove = NULL)

Unsplits the window.

Parameters:
toRemoveThe pane to remove, or NULL to remove the right or bottom pane.
Returns:
true if successful, false otherwise (the window was not split).
注意:
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.
参照:
SplitHorizontally(), SplitVertically(), IsSplit(), OnUnsplit()
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.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines