This is the main implementation of RibbonPanel
.
wx.lib.agw.ribbon.control.RibbonControl
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 |
RibbonPanel
(RibbonControl)¶This is the main implementation of RibbonPanel
.
__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.
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 |
---|---|---|
|
0x0 |
Defined as no other flags set. |
|
0x1 |
Prevents the panel from automatically minimising to conserve screen space. |
|
0x8 |
Causes an extension button to be shown in the panel’s chrome (if the bar in which it is contained has |
|
0x10 |
Causes a (de)minimise button to be shown in the panel’s chrome (if the bar in which it is contained has the |
|
0x20 |
Allows a single panel to stretch to fill the parent page. |
|
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)¶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().
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.
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.
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 None
when 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.
True
if the panel was un-expanded, False
if 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.
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.
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.
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)¶Layout() -> bool
Lays out the children of this window using the associated sizer.
OnChildKillFocus
(self, event)¶Handles the wx.EVT_KILL_FOCUS
event for children of RibbonPanel
.
event – a FocusEvent
event to be processed.
OnEraseBackground
(self, event)¶Handles the wx.EVT_ERASE_BACKGROUND
event for RibbonPanel
.
event – a EraseEvent
event to be processed.
OnKillFocus
(self, event)¶Handles the wx.EVT_KILL_FOCUS
event for RibbonPanel
.
event – a FocusEvent
event to be processed.
OnMotion
(self, event)¶Handles the wx.EVT_MOTION
event for RibbonPanel
.
event – a MouseEvent
event to be processed.
OnMouseClick
(self, event)¶Handles the wx.EVT_LEFT_DOWN
event for RibbonPanel
.
event – a MouseEvent
event to be processed.
OnMouseEnter
(self, event)¶Handles the wx.EVT_ENTER_WINDOW
event for RibbonPanel
.
event – a MouseEvent
event to be processed.
OnMouseEnterChild
(self, event)¶Handles the wx.EVT_ENTER_WINDOW
event for children of RibbonPanel
.
event – a MouseEvent
event to be processed.
OnMouseLeave
(self, event)¶Handles the wx.EVT_LEAVE_WINDOW
event for RibbonPanel
.
event – a MouseEvent
event to be processed.
OnMouseLeaveChild
(self, event)¶Handles the wx.EVT_LEAVE_WINDOW
event for children of RibbonPanel
.
event – a MouseEvent
event to be processed.
OnPaint
(self, event)¶Handles the wx.EVT_PAINT
event for RibbonPanel
.
event – a PaintEvent
event to be processed.
OnSize
(self, event)¶Handles the wx.EVT_SIZE
event for RibbonPanel
.
event – a wx.SizeEvent
event 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 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
.
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.
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 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