Phoenix Logo

phoenix_title wx.lib.agw.fourwaysplitter.FourWaySplitter

This class is very similar to SplitterWindow except that it allows for four windows and two sashes. Many of the same styles, constants, and methods behave the same as in SplitterWindow. However, in addition of the ability to drag the vertical and the horizontal sash, by dragging at the intersection between the two sashes, it is possible to resize the four windows at the same time.

Note

These things are not yet supported:

  • Minimum pane size (minimum of what? Width? Height?);
  • Using negative sash positions to indicate a position offset from the end;
  • User controlled unsplitting with double clicks on the sash (but supported via the FourWaySplitter.SetExpanded() method);
  • Sash gravity.

class_hierarchy Class Hierarchy

Inheritance diagram for class FourWaySplitter:


appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


super_classes Known Superclasses

wx.Panel


method_summary Methods Summary

__init__ Default class constructor.
AdjustLayout Adjust layout of FourWaySplitter. Mainly used to recalculate the
AppendWindow Add a new window to the splitter at the right side or bottom
DetachWindow Removes the window from the stack of windows managed by the splitter. The
DoGetBestSize Gets the size which best suits the window: for a control, it would be the
DoSendChangingEvent Sends a EVT_SPLITTER_SASH_POS_CHANGING event.
DrawSplitter Actually draws the sashes.
DrawTrackSplitter Draws a fake sash in case we don’t have wx.SP_LIVE_UPDATE style.
ExchangeWindows Trade the positions in the splitter of the two windows.
GetAGWWindowStyleFlag Returns the FourWaySplitter window style.
GetBottomLeft Returns the bottom left window (window index: 2).
GetBottomRight Returns the bottom right window (window index: 3).
GetMode Determines the split mode for FourWaySplitter.
GetTopLeft Returns the top left window (window index: 0).
GetTopRight Returns the top right window (window index: 1).
GetWindow Returns the window at the index idx.
InsertWindow Insert a new window into the splitter at the position given in idx.
MoveSplit Moves the split accordingly to user action.
OnEnterWindow Handles the wx.EVT_ENTER_WINDOW event for FourWaySplitter.
OnLeaveWindow Handles the wx.EVT_LEAVE_WINDOW event for FourWaySplitter.
OnLeftDown Handles the wx.EVT_LEFT_DOWN event for FourWaySplitter.
OnLeftUp Handles the wx.EVT_LEFT_UP event for FourWaySplitter.
OnMotion Handles the wx.EVT_MOTION event for FourWaySplitter.
OnPaint Handles the wx.EVT_PAINT event for FourWaySplitter.
OnSize Handles the wx.EVT_SIZE event for FourWaySplitter.
ReplaceWindow Replaces oldWindow (which is currently being managed by the
SetAGWWindowStyleFlag Sets the FourWaySplitter window style flags.
SetExpanded This method is used to expand one of the four window to fill the
SetHSplit Change horizontal split fraction.
SetVSplit Change vertical split fraction.

api Class API



class FourWaySplitter(wx.Panel)

This class is very similar to SplitterWindow except that it allows for four windows and two sashes. Many of the same styles, constants, and methods behave the same as in SplitterWindow. However, in addition of the ability to drag the vertical and the horizontal sash, by dragging at the intersection between the two sashes, it is possible to resize the four windows at the same time.

Note

These things are not yet supported:

  • Minimum pane size (minimum of what? Width? Height?);
  • Using negative sash positions to indicate a position offset from the end;
  • User controlled unsplitting with double clicks on the sash (but supported via the FourWaySplitter.SetExpanded() method);
  • Sash gravity.

Methods



__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=0, name="FourWaySplitter")

Default class constructor.

Parameters:
  • parent – parent window. Must not be None;
  • id – window identifier. A value of -1 indicates a default value;
  • pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
  • size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
  • style – the underlying Panel window style;
  • agwStyle – the AGW-specific window style. It can be a combination of the following bits:

    Window Styles Hex Value Description
    SP_NOSASH 0x10 No sash will be drawn on FourWaySplitter.
    SP_LIVE_UPDATE 0x80 Don’t draw XOR line but resize the child windows immediately.
    SP_3DBORDER 0x200 Draws a 3D effect border.
  • name – the window name.


AdjustLayout(self)

Adjust layout of FourWaySplitter. Mainly used to recalculate the correct values for split fractions.



AppendWindow(self, window)

Add a new window to the splitter at the right side or bottom of the window stack.

Parameters:window – an instance of wx.Window.


DetachWindow(self, window)

Removes the window from the stack of windows managed by the splitter. The window will still exist so you should Hide or Destroy it as needed.

Parameters:window – an instance of wx.Window.


DoGetBestSize(self)

Gets the size which best suits the window: for a control, it would be the minimal size which doesn’t truncate the control, for a panel - the same size as it would have after a call to Fit().

Note

Overridden from Panel.



DoSendChangingEvent(self, pt)

Sends a EVT_SPLITTER_SASH_POS_CHANGING event.

Parameters:pt – the point at which the splitter is being positioned.


DrawSplitter(self, dc)

Actually draws the sashes.

Parameters:dc – an instance of wx.DC.


DrawTrackSplitter(self, x, y)

Draws a fake sash in case we don’t have wx.SP_LIVE_UPDATE style.

Parameters:
  • x – the x position of the sash;
  • y – the y position of the sash.

Note

This method relies on ScreenDC which is currently unavailable on wxMac.



ExchangeWindows(self, window1, window2)

Trade the positions in the splitter of the two windows.

Parameters:


GetAGWWindowStyleFlag(self)

Returns the FourWaySplitter window style.

See also

SetAGWWindowStyleFlag for a list of possible window styles.



GetBottomLeft(self)

Returns the bottom left window (window index: 2).



GetBottomRight(self)

Returns the bottom right window (window index: 3).



GetMode(self, pt)

Determines the split mode for FourWaySplitter.

Parameters:pt – the point at which the mouse has been clicked, an instance of wx.Point.
Returns:One of the following 3 split modes:
Split Mode Description
wx.HORIZONTAL the user has clicked on the horizontal sash
wx.VERTICAL The user has clicked on the vertical sash
wx.BOTH The user has clicked at the intersection between the 2 sashes


GetTopLeft(self)

Returns the top left window (window index: 0).



GetTopRight(self)

Returns the top right window (window index: 1).



GetWindow(self, idx)

Returns the window at the index idx.

Parameters:idx – the index at which the window is located.


InsertWindow(self, idx, window, sashPos=-1)

Insert a new window into the splitter at the position given in idx.

Parameters:
  • idx – the index at which the window will be inserted;
  • window – an instance of wx.Window;
  • sashPos – the sash position after the window insertion.


MoveSplit(self, x, y)

Moves the split accordingly to user action.

Parameters:
  • x – the new splitter x coordinate;
  • y – the new splitter y coordinate.


OnEnterWindow(self, event)

Handles the wx.EVT_ENTER_WINDOW event for FourWaySplitter.

Parameters:event – a MouseEvent event to be processed.


OnLeaveWindow(self, event)

Handles the wx.EVT_LEAVE_WINDOW event for FourWaySplitter.

Parameters:event – a MouseEvent event to be processed.


OnLeftDown(self, event)

Handles the wx.EVT_LEFT_DOWN event for FourWaySplitter.

Parameters:event – a MouseEvent event to be processed.


OnLeftUp(self, event)

Handles the wx.EVT_LEFT_UP event for FourWaySplitter.

Parameters:event – a MouseEvent event to be processed.


OnMotion(self, event)

Handles the wx.EVT_MOTION event for FourWaySplitter.

Parameters:event – a MouseEvent event to be processed.


OnPaint(self, event)

Handles the wx.EVT_PAINT event for FourWaySplitter.

Parameters:event – a PaintEvent event to be processed.


OnSize(self, event)

Handles the wx.EVT_SIZE event for FourWaySplitter.

Parameters:event – a wx.SizeEvent event to be processed.


ReplaceWindow(self, oldWindow, newWindow)

Replaces oldWindow (which is currently being managed by the splitter) with newWindow. The oldWindow window will still exist so you should Hide or Destroy it as needed.

Parameters:


SetAGWWindowStyleFlag(self, agwStyle)

Sets the FourWaySplitter window style flags.

Parameters:agwStyle – the AGW-specific window style. This can be a combination of the following bits:

Window Styles Hex Value Description
SP_NOSASH 0x10 No sash will be drawn on FourWaySplitter.
SP_LIVE_UPDATE 0x80 Don’t draw XOR line but resize the child windows immediately.
SP_3DBORDER 0x200 Draws a 3D effect border.


SetExpanded(self, expanded)

This method is used to expand one of the four window to fill the whole client size (when expanded >= 0) or to return to the four-window view (when expanded < 0).

Parameters:expanded – an integer >= 0 to expand a window to fill the whole client size, or an integer < 0 to return to the four-window view.


SetHSplit(self, s)

Change horizontal split fraction.

Parameters:s – the split fraction, which is an integer value between 0 and 10000 (inclusive), indicating how much space to allocate to the leftmost panes. For example, to split the panes at 35 percent, use:

fourSplitter.SetHSplit(3500)


SetVSplit(self, s)

Change vertical split fraction.

Parameters:s – the split fraction, which is an integer value between 0 and 10000 (inclusive), indicating how much space to allocate to the topmost panes. For example, to split the panes at 35 percent, use:

fourSplitter.SetVSplit(3500)