Package wx :: Class SplitterWindow
[frames | no frames]

Type SplitterWindow

object --+            
         |            
    Object --+        
             |        
    EvtHandler --+    
                 |    
            Window --+
                     |
                    SplitterWindow

Known Subclasses:
Crust, Filling, ThinSplitterWindow

wx.SplitterWindow manages up to two subwindows or panes, with an optional vertical or horizontal split which can be used with the mouse or programmatically.

Styles

wx.SP_3D Draws a 3D effect border and sash.
wx.SP_3DSASH Draws a 3D effect sash.
wx.SP_3DBORDER Synonym for wxSP_BORDER.
wx.SP_BORDER Draws a standard border.
wx.SP_NOBORDER No border (default).
wx.SP_NO_XP_THEME Under Windows XP, switches off the attempt to draw the splitter using Windows XP theming, so the borders and sash will take on the pre-XP look.
wx.SP_PERMIT_UNSPLIT Always allow to unsplit, even with the minimum pane size other than zero.
wx.SP_LIVE_UPDATE Don't draw XOR line but resize the child windows immediately.

Events

EVT_SPLITTER_SASH_POS_CHANGING The sash position is in the process of being changed. May be used to modify the position of the tracking bar to properly reflect the position that would be set if the drag were to be completed at this point.
EVT_SPLITTER_SASH_POS_CHANGED The sash position was changed. May be used to modify the sash position before it is set, or to prevent the change from taking place.
EVT_SPLITTER_UNSPLIT The splitter has been just unsplit.
EVT_SPLITTER_DCLICK The sash was double clicked. 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.)

Method Summary
SplitterWindow __init__(self, parent, id, pos, size, style, name)
Constructor.
bool Create(self, parent, id, pos, size, style, name)
Create the GUI part of the SplitterWindow for the 2-phase create.
int GetBorderSize(self)
Gets the border size
VisualAttributes GetClassDefaultAttributes(variant)
Get the default attributes for this class. (Static method)
int GetMinimumPaneSize(self)
Gets the minimum pane size in pixels.
bool GetNeedUpdating(self)
double GetSashGravity(self)
Gets the sash gravity.
int GetSashPosition(self)
Returns the surrent sash position.
int GetSashSize(self)
Gets the sash size
int GetSplitMode(self)
Gets the split mode
Window GetWindow1(self)
Gets the only or left/top pane.
Window GetWindow2(self)
Gets the right/bottom pane.
  Initialize(self, window)
Initializes the splitter window to have one pane.
bool IsSplit(self)
Is the window split?
bool ReplaceWindow(self, winOld, winNew)
This function replaces one of the windows managed by the SplitterWindow with another one.
bool SashHitTest(self, x, y, tolerance)
Tests for x, y over the sash
  SetBorderSize(self, width)
Sets the border size.
  SetMinimumPaneSize(self, min)
Sets the minimum pane size in pixels.
  SetNeedUpdating(self, needUpdating)
  SetSashGravity(self, gravity)
Set the sash gravity.
  SetSashPosition(self, position, redraw)
Sets the sash position, in pixels.
  SetSashSize(self, width)
Sets the sash size.
  SetSplitMode(self, mode)
Sets the split mode.
  SizeWindows(self)
Resizes subwindows
bool SplitHorizontally(self, window1, window2, sashPosition)
Initializes the top and bottom panes of the splitter window.
bool SplitVertically(self, window1, window2, sashPosition)
Initializes the left and right panes of the splitter window.
bool Unsplit(self, toRemove)
Unsplits the window.
  UpdateSize(self)
Causes any pending sizing of the sash and child panes to take place immediately.

Property Summary
  BorderSize: See GetBorderSize and SetBorderSize
  MinimumPaneSize: See GetMinimumPaneSize and SetMinimumPaneSize
  NeedUpdating: See GetNeedUpdating and SetNeedUpdating
  SashGravity: See GetSashGravity and SetSashGravity
  SashPosition: See GetSashPosition and SetSashPosition
  SashSize: See GetSashSize and SetSashSize
  SplitMode: See GetSplitMode and SetSplitMode
  thisown: The membership flag
  Window1: See GetWindow1
  Window2: See GetWindow2

Instance Method Details

__init__(self, parent, id=-1, pos=DefaultPosition, size=DefaultSize, style=SP_3D, name=SplitterNameStr)
(Constructor)

Constructor. Creates and shows a SplitterWindow.

Parameters:
parent
           (type=Window)

id
           (type=int)

pos
           (type=Point)

size
           (type=Size)

style
           (type=long)

name
           (type=String)

Returns:
SplitterWindow
Overrides:
wx.Window.__init__

Create(self, parent, id=-1, pos=DefaultPosition, size=DefaultSize, style=SP_3D, name=SplitterNameStr)

Create the GUI part of the SplitterWindow for the 2-phase create.

Parameters:
parent
           (type=Window)

id
           (type=int)

pos
           (type=Point)

size
           (type=Size)

style
           (type=long)

name
           (type=String)

Returns:
bool
Overrides:
wx.Window.Create

GetBorderSize(self)

Gets the border size

Returns:
int

GetMinimumPaneSize(self)

Gets the minimum pane size in pixels.

Returns:
int

GetSashGravity(self)

Gets the sash gravity.

Returns:
double

See Also:

SetSashGravity

GetSashPosition(self)

Returns the surrent sash position.

Returns:
int

GetSashSize(self)

Gets the sash size

Returns:
int

GetSplitMode(self)

Gets the split mode

Returns:
int

GetWindow1(self)

Gets the only or left/top pane.

Returns:
Window

GetWindow2(self)

Gets the right/bottom pane.

Returns:
Window

Initialize(self, window)

Initializes the splitter window to have one pane. This should be called if you wish to initially view only a single pane in the splitter window. The child window is shown if it is currently hidden.

Parameters:
window
           (type=Window)

IsSplit(self)

Is the window split?

Returns:
bool

ReplaceWindow(self, winOld, 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. It is valid to call this function whether the splitter has two windows or only one.

Both parameters should be non-None 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 Destroy the replaced window and you may wish to do it yourself.

Parameters:
winOld
           (type=Window)

winNew
           (type=Window)

Returns:
bool

SashHitTest(self, x, y, tolerance=5)

Tests for x, y over the sash

Parameters:
x
           (type=int)

y
           (type=int)

tolerance
           (type=int)

Returns:
bool

SetBorderSize(self, width)

Sets the border size. Currently a NOP.

Parameters:
width
           (type=int)

SetMinimumPaneSize(self, min)

Sets the minimum 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 wx.SP_PERMIT_UNSPLIT style is used when a splitter window is created, the window may be unsplit even if minimum size is non-zero.

Parameters:
min
           (type=int)

SetSashGravity(self, gravity)

Set the sash gravity. Gravity is a floating-point factor between 0.0 and 1.0 which controls position of sash while resizing the wx.SplitterWindow. The gravity specifies how much the left/top window will grow while resizing.

Example values:

0.0 Only the bottom or right window is automaticaly resized.
0.5 Both windows grow equally.
1.0 Only left/top window grows.

The default value of sash gravity is 0.0. That value is compatible with the previous (before gravity was introduced) behaviour of the wx.SplitterWindow.

Parameters:
gravity
           (type=double)

SetSashPosition(self, position, redraw=True)

Sets the sash position, in pixels. If redraw is Ttrue then the panes are resized and the sash and border are redrawn.

Parameters:
position
           (type=int)

redraw
           (type=bool)

SetSashSize(self, width)

Sets the sash size.

Parameters:
width
           (type=int)

SetSplitMode(self, mode)

Sets the split mode. The mode can be wx.SPLIT_VERTICAL or wx.SPLIT_HORIZONTAL. This only sets the internal variable; does not update the display.

Parameters:
mode
           (type=int)

SizeWindows(self)

Resizes subwindows

SplitHorizontally(self, window1, window2, sashPosition=0)

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

Returns True if successful, False otherwise (the window was already split).

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

Parameters:
window1 - The top pane.
           (type=Window)

window2 - The bottom pane.
           (type=Window)

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).
           (type=int)

Returns:
bool

SplitVertically(self, window1, window2, sashPosition=0)

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

Returns True if successful, False otherwise (the window was already split).

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

Parameters:
window1 - The left pane.
           (type=Window)

window2 - The right pane.
           (type=Window)

sashPosition - The initial position of the sash. If this value is positive, it specifies the size of the left pane. If it is negative, its absolute value gives the size of the right pane. Finally, specify 0 (default) to choose the default position (half of the total window width).
           (type=int)

Returns:
bool

Unsplit(self, toRemove=None)

Unsplits the window. Pass the pane to remove, or None to remove the right or bottom pane. Returns True if successful, False otherwise (the window was not split).

This function will not actually delete the pane being removed; it sends EVT_SPLITTER_UNSPLIT which can be handled for the desired behaviour. By default, the pane being removed is only hidden.

Parameters:
toRemove
           (type=Window)

Returns:
bool

UpdateSize(self)

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.


Static Method Details

GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)

Get the default attributes for this class. This is useful if you want to use the same font or colour in your own control as in a standard control -- which is a much better idea than hard coding specific colours or fonts which might look completely out of place on the user's system, especially if it uses themes.

The variant parameter is only relevant under Mac currently and is ignore under other platforms. Under Mac, it will change the size of the returned font. See wx.Window.SetWindowVariant for more about this.

Parameters:
variant
           (type=int)

Returns:
VisualAttributes

Property Details

BorderSize

See GetBorderSize and SetBorderSize

Get Method:
GetBorderSize(self)
Set Method:
SetBorderSize(self, width)

MinimumPaneSize

See GetMinimumPaneSize and SetMinimumPaneSize

Get Method:
GetMinimumPaneSize(self)
Set Method:
SetMinimumPaneSize(self, min)

NeedUpdating

See GetNeedUpdating and SetNeedUpdating

Get Method:
GetNeedUpdating(self)
Set Method:
SetNeedUpdating(self, needUpdating)

SashGravity

See GetSashGravity and SetSashGravity

Get Method:
GetSashGravity(self)
Set Method:
SetSashGravity(self, gravity)

SashPosition

See GetSashPosition and SetSashPosition

Get Method:
GetSashPosition(self)
Set Method:
SetSashPosition(self, position, redraw)

SashSize

See GetSashSize and SetSashSize

Get Method:
GetSashSize(self)
Set Method:
SetSashSize(self, width)

SplitMode

See GetSplitMode and SetSplitMode

Get Method:
GetSplitMode(self)
Set Method:
SetSplitMode(self, mode)

thisown

The membership flag

Window1

See GetWindow1

Get Method:
GetWindow1(self)

Window2

See GetWindow2

Get Method:
GetWindow2(self)

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:12:35 2007 http://epydoc.sf.net