Phoenix Logo

phoenix_title wx.lib.agw.ribbon.panel.RibbonPanel

This is the main implementation of RibbonPanel.


class_hierarchy Class Hierarchy

Inheritance diagram for class RibbonPanel:


appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


method_summary Methods Summary

__init__ Default class constructor.
AddChild  
CanAutoMinimise Query if the panel can automatically minimise itself at small sizes.
CommonInit  
DoGetBestSize Gets the size which best suits the window: for a control, it would be the
DoGetNextLargerSize Implementation of RibbonControl.GetNextLargerSize().
DoGetNextSmallerSize Implementation of RibbonControl.GetNextSmallerSize().
DoSetSize Sets the size of the window in pixels.
GetBestSizeForParentSize Finds the best width and height given the parent’s width and height.
GetDefaultBorder Returns the default border style for RibbonPanel.
GetExpandedDummy Get the dummy panel of an expanded panel.
GetExpandedPanel Get the expanded panel of a dummy panel.
GetExpandedPosition  
GetFlags Returns the AGW-specific window style for RibbonPanel.
GetMinimisedIcon Get the bitmap to be used in place of the panel children when it is minimised.
GetMinNotMinimisedSize  
GetMinSize Returns the minimum size of the window, an indication to the sizer layout mechanism
GetPanelSizerBestSize  
GetPanelSizerMinSize  
HasExtButton  
HideExpanded Hide the panel’s external expansion.
IsExtButtonHovered  
IsHovered Query is the mouse is currently hovered over the panel.
IsMinimised Query if the panel would be minimised at a given size.
IsMinimised1 Query if the panel is currently minimised.
IsMinimised2 Query if the panel would be minimised at a given size.
IsSizingContinuous Returns True if this window can take any size (greater than its minimum size),
Layout  
OnChildKillFocus Handles the wx.EVT_KILL_FOCUS event for children of RibbonPanel.
OnEraseBackground Handles the wx.EVT_ERASE_BACKGROUND event for RibbonPanel.
OnKillFocus Handles the wx.EVT_KILL_FOCUS event for RibbonPanel.
OnMotion Handles the wx.EVT_MOTION event for RibbonPanel.
OnMouseClick Handles the wx.EVT_LEFT_DOWN event for RibbonPanel.
OnMouseEnter Handles the wx.EVT_ENTER_WINDOW event for RibbonPanel.
OnMouseEnterChild Handles the wx.EVT_ENTER_WINDOW event for children of RibbonPanel.
OnMouseLeave Handles the wx.EVT_LEAVE_WINDOW event for RibbonPanel.
OnMouseLeaveChild Handles the wx.EVT_LEAVE_WINDOW event for children of RibbonPanel.
OnPaint Handles the wx.EVT_PAINT event for RibbonPanel.
OnSize Handles the wx.EVT_SIZE event for RibbonPanel.
Realize Realize all children of the panel.
RemoveChild  
SetArtProvider Set the art provider to be used.
ShouldSendEventToDummy  
ShowExpanded Show the panel externally expanded.
TestPositionForHover  
TryAfter  

api Class API



class RibbonPanel(RibbonControl)

This is the main implementation of RibbonPanel.


Methods



__init__(self, parent, id=wx.ID_ANY, label="", minimised_icon=wx.NullBitmap, pos=wx.DefaultPosition, size=wx.DefaultSize, agwStyle=RIBBON_PANEL_DEFAULT_STYLE, name="RibbonPanel")

Default class constructor.

Parameters:
  • parent – pointer to a parent window, typically a RibbonPage, though it can be any window;
  • id – window identifier. If wx.ID_ANY, will automatically create an identifier;
  • label – label of the new button;
  • minimised_icon – the bitmap to be used in place of the panel children when it is minimised;
  • pos – window position. wx.DefaultPosition indicates that wxPython should generate a default position for the window;
  • size – window size. wx.DefaultSize indicates that wxPython should generate a default size for the window. If no suitable size can be found, the window will be sized to 20x20 pixels so that the window is visible but obviously not correctly sized;
  • agwStyle – the AGW-specific window style. This can be one of the following bits:

    Window Styles Hex Value Description
    RIBBON_PANEL_DEFAULT_STYLE 0x0 Defined as no other flags set.
    RIBBON_PANEL_NO_AUTO_MINIMISE 0x1 Prevents the panel from automatically minimising to conserve screen space.
    RIBBON_PANEL_EXT_BUTTON 0x8 Causes an extension button to be shown in the panel’s chrome (if the bar in which it is contained has RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS set). The behaviour of this button is application controlled, but typically will show an extended drop-down menu relating to the panel.
    RIBBON_PANEL_MINIMISE_BUTTON 0x10 Causes a (de)minimise button to be shown in the panel’s chrome (if the bar in which it is contained has the RIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS style set). This flag is typically combined with RIBBON_PANEL_NO_AUTO_MINIMISE to make a panel which the user always has manual control over when it minimises.
    RIBBON_PANEL_STRETCH 0x20 Allows a single panel to stretch to fill the parent page.
    RIBBON_PANEL_FLEXIBLE 0x40 Allows toolbars to wrap, taking up the optimum amount of space when used in a vertical palette.
  • name – the window name.


AddChild(self, child)


CanAutoMinimise(self)

Query if the panel can automatically minimise itself at small sizes.



CommonInit(self, label, icon, agwStyle)


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().

Returns:An instance of wx.Size.

Note

Overridden from wx.Control.



DoGetNextLargerSize(self, direction, relative_to)

Implementation of RibbonControl.GetNextLargerSize().

Controls which have non-continuous sizing must override this virtual function rather than RibbonControl.GetNextLargerSize().



DoGetNextSmallerSize(self, direction, relative_to)

Implementation of RibbonControl.GetNextSmallerSize().

Controls which have non-continuous sizing must override this virtual function rather than RibbonControl.GetNextSmallerSize().



DoSetSize(self, x, y, width, height, sizeFlags=wx.SIZE_AUTO)

Sets the size of the window in pixels.

Parameters:
  • x (integer) – required x position in pixels, or wx.DefaultCoord to indicate that the existing value should be used;
  • y (integer) – required y position in pixels, or wx.DefaultCoord to indicate that the existing value should be used;
  • width (integer) – required width in pixels, or wx.DefaultCoord to indicate that the existing value should be used;
  • height (integer) – required height in pixels, or wx.DefaultCoord to indicate that the existing value should be used;
  • sizeFlags (integer) – indicates the interpretation of other parameters. It is a bit list of the following:

    • wx.SIZE_AUTO_WIDTH: a wx.DefaultCoord width value is taken to indicate a wxPython-supplied default width.
    • wx.SIZE_AUTO_HEIGHT: a wx.DefaultCoord height value is taken to indicate a wxPython-supplied default height.
    • wx.SIZE_AUTO: wx.DefaultCoord size values are taken to indicate a wxPython-supplied default size.
    • wx.SIZE_USE_EXISTING: existing dimensions should be used if wx.DefaultCoord values are supplied.
    • wx.SIZE_ALLOW_MINUS_ONE: allow negative dimensions (i.e. value of wx.DefaultCoord) to be interpreted as real dimensions, not default values.
    • wx.SIZE_FORCE: normally, if the position and the size of the window are already the same as the parameters of this function, nothing is done. but with this flag a window resize may be forced even in this case (supported in wx 2.6.2 and later and only implemented for MSW and ignored elsewhere currently).


GetBestSizeForParentSize(self, parentSize)

Finds the best width and height given the parent’s width and height.



GetDefaultBorder(self)

Returns the default border style for RibbonPanel.



GetExpandedDummy(self)

Get the dummy panel of an expanded panel.

Note

This should be called on an expanded panel to get the dummy associated with it - it will return None when called on the dummy itself.



GetExpandedPanel(self)

Get the expanded panel of a dummy panel.

Note

This should be called on a dummy panel to get the expanded panel associated with it - it will return None when called on the expanded panel itself.



GetExpandedPosition(self, panel, expanded_size, direction)


GetFlags(self)

Returns the AGW-specific window style for RibbonPanel.



GetMinimisedIcon(self)

Get the bitmap to be used in place of the panel children when it is minimised.



GetMinNotMinimisedSize(self)


GetMinSize(self)

Returns the minimum size of the window, an indication to the sizer layout mechanism that this is the minimum required size.

This method normally just returns the value set by SetMinSize, but it can be overridden to do the calculation on demand.



GetPanelSizerBestSize(self)


GetPanelSizerMinSize(self)


HasExtButton(self)


HideExpanded(self)

Hide the panel’s external expansion.

Returns:True if the panel was un-expanded, False if it was not (normally due to it not being expanded in the first place).


IsExtButtonHovered(self)


IsHovered(self)

Query is the mouse is currently hovered over the panel.

Returns:True if the cursor is within the bounds of the panel (i.e. hovered over the panel or one of its children), False otherwise.


IsMinimised(self, at_size=None)

Query if the panel would be minimised at a given size.

Parameters:at_size – an instance of wx.Size, giving the size at which the panel should be tested for minimisation.


IsMinimised1(self)

Query if the panel is currently minimised.



IsMinimised2(self, at_size)

Query if the panel would be minimised at a given size.

Parameters:at_size – an instance of wx.Size, giving the size at which the panel should be tested for minimisation.


IsSizingContinuous(self)

Returns True if this window can take any size (greater than its minimum size), False if it can only take certain sizes.

See also

RibbonControl.GetNextSmallerSize(), RibbonControl.GetNextLargerSize()



Layout(self)


OnChildKillFocus(self, event)

Handles the wx.EVT_KILL_FOCUS event for children of RibbonPanel.

Parameters:event – a FocusEvent event to be processed.


OnEraseBackground(self, event)

Handles the wx.EVT_ERASE_BACKGROUND event for RibbonPanel.

Parameters:event – a EraseEvent event to be processed.


OnKillFocus(self, event)

Handles the wx.EVT_KILL_FOCUS event for RibbonPanel.

Parameters:event – a FocusEvent event to be processed.


OnMotion(self, event)

Handles the wx.EVT_MOTION event for RibbonPanel.

Parameters:event – a MouseEvent event to be processed.


OnMouseClick(self, event)

Handles the wx.EVT_LEFT_DOWN event for RibbonPanel.

Parameters:event – a MouseEvent event to be processed.


OnMouseEnter(self, event)

Handles the wx.EVT_ENTER_WINDOW event for RibbonPanel.

Parameters:event – a MouseEvent event to be processed.


OnMouseEnterChild(self, event)

Handles the wx.EVT_ENTER_WINDOW event for children of RibbonPanel.

Parameters:event – a MouseEvent event to be processed.


OnMouseLeave(self, event)

Handles the wx.EVT_LEAVE_WINDOW event for RibbonPanel.

Parameters:event – a MouseEvent event to be processed.


OnMouseLeaveChild(self, event)

Handles the wx.EVT_LEAVE_WINDOW event for children of RibbonPanel.

Parameters:event – a MouseEvent event to be processed.


OnPaint(self, event)

Handles the wx.EVT_PAINT event for RibbonPanel.

Parameters:event – a PaintEvent event to be processed.


OnSize(self, event)

Handles the wx.EVT_SIZE event for RibbonPanel.

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


Realize(self)

Realize all children of the panel.

Note

Reimplemented from RibbonControl.



RemoveChild(self, child)


SetArtProvider(self, art)

Set the art provider to be used.

Normally called automatically by RibbonPage when the panel is created, or the art provider changed on the page. The new art provider will be propagated to the children of the panel.

Reimplemented from RibbonControl.

Parameters:art – an art provider.


ShouldSendEventToDummy(self, event)


ShowExpanded(self)

Show the panel externally expanded.

When a panel is minimised, it can be shown full-size in a pop-out window, which is refered to as being (externally) expanded.

Returns:True if the panel was expanded, False if it was not (possibly due to it not being minimised, or already being expanded).

Note

When a panel is expanded, there exist two panels - the original panel (which is refered to as the dummy panel) and the expanded panel. The original is termed a dummy as it sits in the ribbon bar doing nothing, while the expanded panel holds the panel children.



TestPositionForHover(self, pos)


TryAfter(self, event)