wx.lib.agw.ribbon.panel.RibbonPanel¶
This is the main implementation of RibbonPanel.
Class Hierarchy¶
Control Appearance¶
Known Superclasses¶
wx.lib.agw.ribbon.control.RibbonControl
Methods Summary¶
Default class constructor. |
|
AddChild(self, child: Optional[WindowBase]) |
|
Query if the panel can automatically minimise itself at small sizes. |
|
Gets the size which best suits the window: for a control, it would be the |
|
Implementation of |
|
Implementation of |
|
Sets the size of the window in pixels. |
|
Finds the best width and height given the parent’s width and height. |
|
Returns the default border style for |
|
Get the dummy panel of an expanded panel. |
|
Get the expanded panel of a dummy panel. |
|
Returns the AGW-specific window style for |
|
Get the bitmap to be used in place of the panel children when it is minimised. |
|
Returns the minimum size of the window, an indication to the sizer layout mechanism |
|
Hide the panel’s external expansion. |
|
Query is the mouse is currently hovered over the panel. |
|
Query if the panel would be minimised at a given size. |
|
Query if the panel is currently minimised. |
|
Query if the panel would be minimised at a given size. |
|
Returns |
|
Layout() -> bool |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Realize all children of the panel. |
|
RemoveChild(self, child: Optional[WindowBase]) |
|
Set the art provider to be used. |
|
Show the panel externally expanded. |
|
TryAfter(self, event: Event) -> bool |
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.DefaultPositionindicates that wxPython should generate a default position for the window;size – window size.
wx.DefaultSizeindicates 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_STYLE0x0
Defined as no other flags set.
RIBBON_PANEL_NO_AUTO_MINIMISE0x1
Prevents the panel from automatically minimising to conserve screen space.
RIBBON_PANEL_EXT_BUTTON0x8
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_BUTTONSset). The behaviour of this button is application controlled, but typically will show an extended drop-down menu relating to the panel.RIBBON_PANEL_MINIMISE_BUTTON0x10
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_BUTTONSstyle set). This flag is typically combined withRIBBON_PANEL_NO_AUTO_MINIMISEto make a panel which the user always has manual control over when it minimises.RIBBON_PANEL_STRETCH0x20
Allows a single panel to stretch to fill the parent page.
RIBBON_PANEL_FLEXIBLE0x40
Allows toolbars to wrap, taking up the optimum amount of space when used in a vertical palette.
name – the window name.
- AddChild(self, child)¶
AddChild(self, child: Optional[WindowBase])
- 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.DefaultCoordto indicate that the existing value should be used;y (integer) – required y position in pixels, or
wx.DefaultCoordto indicate that the existing value should be used;width (integer) – required width in pixels, or
wx.DefaultCoordto indicate that the existing value should be used;height (integer) – required height in pixels, or
wx.DefaultCoordto 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: awx.DefaultCoordwidth value is taken to indicate a wxPython-supplied default width.wx.SIZE_AUTO_HEIGHT: awx.DefaultCoordheight value is taken to indicate a wxPython-supplied default height.wx.SIZE_AUTO:wx.DefaultCoordsize values are taken to indicate a wxPython-supplied default size.wx.SIZE_USE_EXISTING: existing dimensions should be used ifwx.DefaultCoordvalues are supplied.wx.SIZE_ALLOW_MINUS_ONE: allow negative dimensions (i.e. value ofwx.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
Nonewhen called on the dummy itself.See also
- 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
Nonewhen called on the expanded panel itself.See also
- 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:
Trueif the panel was un-expanded,Falseif it was not (normally due to it not being expanded in the first place).
See also
- IsExtButtonHovered(self)¶
- IsHovered(self)¶
Query is the mouse is currently hovered over the panel.
- Returns:
Trueif the cursor is within the bounds of the panel (i.e. hovered over the panel or one of its children),Falseotherwise.
- 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
Trueif this window can take any size (greater than its minimum size),Falseif it can only take certain sizes.See also
RibbonControl.GetNextSmallerSize(),RibbonControl.GetNextLargerSize()
- Layout(self)¶
Layout() -> bool
Lays out the children of this window using the associated sizer.
- OnChildKillFocus(self, event)¶
Handles the
wx.EVT_KILL_FOCUSevent for children ofRibbonPanel.- Parameters:
event – a
FocusEventevent to be processed.
- OnEraseBackground(self, event)¶
Handles the
wx.EVT_ERASE_BACKGROUNDevent forRibbonPanel.- Parameters:
event – a
EraseEventevent to be processed.
- OnKillFocus(self, event)¶
Handles the
wx.EVT_KILL_FOCUSevent forRibbonPanel.- Parameters:
event – a
FocusEventevent to be processed.
- OnMotion(self, event)¶
Handles the
wx.EVT_MOTIONevent forRibbonPanel.- Parameters:
event – a
MouseEventevent to be processed.
- OnMouseClick(self, event)¶
Handles the
wx.EVT_LEFT_DOWNevent forRibbonPanel.- Parameters:
event – a
MouseEventevent to be processed.
- OnMouseEnter(self, event)¶
Handles the
wx.EVT_ENTER_WINDOWevent forRibbonPanel.- Parameters:
event – a
MouseEventevent to be processed.
- OnMouseEnterChild(self, event)¶
Handles the
wx.EVT_ENTER_WINDOWevent for children ofRibbonPanel.- Parameters:
event – a
MouseEventevent to be processed.
- OnMouseLeave(self, event)¶
Handles the
wx.EVT_LEAVE_WINDOWevent forRibbonPanel.- Parameters:
event – a
MouseEventevent to be processed.
- OnMouseLeaveChild(self, event)¶
Handles the
wx.EVT_LEAVE_WINDOWevent for children ofRibbonPanel.- Parameters:
event – a
MouseEventevent to be processed.
- OnPaint(self, event)¶
Handles the
wx.EVT_PAINTevent forRibbonPanel.- Parameters:
event – a
PaintEventevent to be processed.
- OnSize(self, event)¶
Handles the
wx.EVT_SIZEevent forRibbonPanel.- Parameters:
event – a
wx.SizeEventevent to be processed.
- Realize(self)¶
Realize all children of the panel.
Note
Reimplemented from
RibbonControl.
- RemoveChild(self, child)¶
RemoveChild(self, child: Optional[WindowBase])
- SetArtProvider(self, art)¶
Set the art provider to be used.
Normally called automatically by
RibbonPagewhen 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 referred to as being (externally) expanded.
- Returns:
Trueif the panel was expanded,Falseif 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 referred 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.
See also
- TestPositionForHover(self, pos)¶
- TryAfter(self, event)¶
TryAfter(self, event: Event) -> bool