wx.ribbon.RibbonArtProvider is responsible for drawing all the components of the ribbon interface.
This allows a ribbon bar to have a pluggable look-and-feel, while retaining the same underlying behaviour. As a single art provider is used for all ribbon components, a ribbon bar usually has a consistent (though unique) appearance.
By default, a wx.ribbon.RibbonBar uses an instance of this class called RibbonDefaultArtProvider
, which resolves to wx.ribbon.RibbonAUIArtProvider, wx.ribbon.RibbonMSWArtProvider, or RibbonOSXArtProvider
- whichever is most appropriate to the current platform. These art providers are all slightly configurable with regard to colours and fonts, but for larger modifications, you can derive from one of these classes, or write a completely new art provider class. Call wx.ribbon.RibbonBar.SetArtProvider
to change the art provider being used.
See also
__init__ |
Constructor. |
Clone |
Create a new art provider which is a clone of this one. |
DrawButtonBarBackground |
Draw the background for a wx.ribbon.RibbonButtonBar control. |
DrawButtonBarButton |
Draw a single button for a wx.ribbon.RibbonButtonBar control. |
DrawGalleryBackground |
Draw the background and chrome for a wx.ribbon.RibbonGallery control. |
DrawGalleryItemBackground |
Draw the background of a single item in a wx.ribbon.RibbonGallery control. |
DrawHelpButton |
Draw help button on wx.ribbon.RibbonBar. |
DrawMinimisedPanel |
Draw a minimised ribbon panel. |
DrawPageBackground |
Draw the background of a ribbon page. |
DrawPanelBackground |
Draw the background and chrome for a ribbon panel. |
DrawScrollButton |
Draw a ribbon-style scroll button. |
DrawTab |
Draw a single tab in the tab region of a ribbon bar. |
DrawTabCtrlBackground |
Draw the background of the tab region of a ribbon bar. |
DrawTabSeparator |
Draw a separator between two tabs in a ribbon bar. |
DrawToggleButton |
Draw toggle button on wx.ribbon.RibbonBar. |
DrawTool |
Draw a single tool (for a wx.ribbon.RibbonToolBar control). |
DrawToolBarBackground |
Draw the background for a wx.ribbon.RibbonToolBar control. |
DrawToolGroupBackground |
Draw the background for a group of tools on a wx.ribbon.RibbonToolBar control. |
GetBarTabWidth |
Calculate the ideal and minimum width (in pixels) of a tab in a ribbon bar. |
GetBarToggleButtonArea |
Calculate the position and size of the ribbon’s toggle button. |
GetButtonBarButtonSize |
Calculate the size of a button within a wx.ribbon.RibbonButtonBar. |
GetColor |
|
GetColour |
Get the value of a certain colour setting. |
GetColourScheme |
Get the current colour scheme. |
GetFlags |
Get the previously set style flags. |
GetFont |
Get the value of a certain font setting. |
GetGalleryClientSize |
Calculate the client size of a wx.ribbon.RibbonGallery control for a given size. |
GetGallerySize |
Calculate the size of a wx.ribbon.RibbonGallery control for a given client size. |
GetMetric |
Get the value of a certain integer setting. |
GetMinimisedPanelMinimumSize |
Calculate the size of a minimised ribbon panel. |
GetPageBackgroundRedrawArea |
Calculate the portion of a page background which needs to be redrawn when a page is resized. |
GetPanelClientSize |
Calculate the client size of a panel for a given overall size. |
GetPanelExtButtonArea |
Calculate the position and size of the panel extension button. |
GetPanelSize |
Calculate the size of a panel for a given client size. |
GetRibbonHelpButtonArea |
Calculate the position and size of the ribbon’s help button. |
GetScrollButtonMinimumSize |
Calculate the minimum size (in pixels) of a scroll button. |
GetTabCtrlHeight |
Calculate the height (in pixels) of the tab region of a ribbon bar. |
GetToolSize |
Calculate the size of a tool within a wx.ribbon.RibbonToolBar. |
SetColor |
|
SetColour |
Set the value of a certain colour setting to the value colour. |
SetColourScheme |
Set all applicable colour settings from a few base colours. |
SetFlags |
Set the style flags. |
SetFont |
Set the value of a certain font setting to the value font. |
SetMetric |
Set the value of a certain integer setting to the value new_val. |
wx.ribbon.
RibbonArtProvider
(object)¶Possible constructors:
RibbonArtProvider()
RibbonArtProvider is responsible for drawing all the components of the ribbon interface.
__init__
(self)¶Constructor.
Clone
(self)¶Create a new art provider which is a clone of this one.
Return type: | wx.ribbon.RibbonArtProvider |
---|
DrawButtonBarBackground
(self, dc, wnd, rect)¶Draw the background for a wx.ribbon.RibbonButtonBar control.
Parameters: |
---|
DrawButtonBarButton
(self, dc, wnd, rect, kind, state, label, bitmap_large, bitmap_small)¶Draw a single button for a wx.ribbon.RibbonButtonBar control.
Parameters: |
|
---|
DrawGalleryBackground
(self, dc, wnd, rect)¶Draw the background and chrome for a wx.ribbon.RibbonGallery control.
This should draw the border, background, scroll buttons, extension button, and any other UI elements which are not attached to a specific gallery item.
Parameters: |
|
---|
DrawGalleryItemBackground
(self, dc, wnd, rect, item)¶Draw the background of a single item in a wx.ribbon.RibbonGallery control.
This is painted on top of a gallery background, and behind the items bitmap. Unlike DrawButtonBarButton
and DrawTool
, it is not expected to draw the item bitmap - that is done by the gallery control itself.
Parameters: |
|
---|
DrawHelpButton
(self, dc, wnd, rect)¶Draw help button on wx.ribbon.RibbonBar.
This should draw a help button at top right corner of ribbon bar.
Parameters: |
|
---|
New in version 2.9.5.
DrawMinimisedPanel
(self, dc, wnd, rect, bitmap)¶Draw a minimised ribbon panel.
Parameters: |
|
---|
DrawPageBackground
(self, dc, wnd, rect)¶Draw the background of a ribbon page.
Parameters: |
|
---|
See also
DrawPanelBackground
(self, dc, wnd, rect)¶Draw the background and chrome for a ribbon panel.
This should draw the border, background, label, and any other items of a panel which are outside the client area of a panel.
Note that when a panel is minimised, this function is not called - only DrawMinimisedPanel
is called, so a background should be explicitly painted by that if required.
Parameters: |
|
---|
DrawScrollButton
(self, dc, wnd, rect, style)¶Draw a ribbon-style scroll button.
Parameters: |
|
---|
DrawTab
(self, dc, wnd, tab)¶Draw a single tab in the tab region of a ribbon bar.
Parameters: |
|
---|
DrawTabCtrlBackground
(self, dc, wnd, rect)¶Draw the background of the tab region of a ribbon bar.
Parameters: |
---|
DrawTabSeparator
(self, dc, wnd, rect, visibility)¶Draw a separator between two tabs in a ribbon bar.
Parameters: |
|
---|
DrawToggleButton
(self, dc, wnd, rect, mode)¶Draw toggle button on wx.ribbon.RibbonBar.
This should draw a small toggle button at top right corner of ribbon bar.
Parameters: |
|
---|
New in version 2.9.5.
DrawTool
(self, dc, wnd, rect, bitmap, kind, state)¶Draw a single tool (for a wx.ribbon.RibbonToolBar control).
Parameters: |
|
---|
DrawToolBarBackground
(self, dc, wnd, rect)¶Draw the background for a wx.ribbon.RibbonToolBar control.
Parameters: |
|
---|
DrawToolGroupBackground
(self, dc, wnd, rect)¶Draw the background for a group of tools on a wx.ribbon.RibbonToolBar control.
Parameters: |
|
---|
GetBarTabWidth
(self, dc, wnd, label, bitmap, ideal, small_begin_need_separator, small_must_have_separator, minimum)¶Calculate the ideal and minimum width (in pixels) of a tab in a ribbon bar.
Parameters: |
|
---|
GetBarToggleButtonArea
(self, rect)¶Calculate the position and size of the ribbon’s toggle button.
Parameters: | rect (wx.Rect) – The ribbon bar rectangle from which calculate toggle button rectangle. |
---|---|
Return type: | Rect |
New in version 2.9.5.
GetButtonBarButtonSize
(self, dc, wnd, kind, size, label, bitmap_size_large, bitmap_size_small, button_size, normal_region, dropdown_region)¶Calculate the size of a button within a wx.ribbon.RibbonButtonBar.
Parameters: |
|
---|---|
Return type: | bool |
Returns: |
|
GetColor
(self, id)¶Parameters: | id (int) – |
---|---|
Return type: | Colour |
GetColour
(self, id)¶Get the value of a certain colour setting.
id can be one of the colour values of wx.ribbon.RibbonArtSetting.
Parameters: | id (int) – |
---|---|
Return type: | Colour |
GetColourScheme
(self)¶Get the current colour scheme.
Returns three colours such that if SetColourScheme
were called with them, the colour scheme would be restored to what it was when SetColourScheme
was last called. In practice, this usually means that the returned values are the three colours given in the last call to SetColourScheme
, however if SetColourScheme
performs an idempotent operation upon the colours it is given (like clamping a component of the colour), then the returned values may not be the three colours given in the last call to SetColourScheme
. If SetColourScheme
has not been called, then the returned values should result in a colour scheme similar to, if not identical to, the default colours of the art provider. Note that if SetColour
is called, then GetColourScheme
does not try and return a colour scheme similar to colours being used - it’s return values are dependent upon the last values given to SetColourScheme
, as described above.
Return type: | tuple |
---|
Note
The Python version of this method returns the three scheme colours as a tuple of wx.Colour
objects.
Returns: | ( primary, secondary, tertiary ) |
---|
GetFlags
(self)¶Get the previously set style flags.
Return type: | long |
---|
GetFont
(self, id)¶Get the value of a certain font setting.
id can be one of the font values of wx.ribbon.RibbonArtSetting.
Parameters: | id (int) – |
---|---|
Return type: | Font |
GetGalleryClientSize
(self, dc, wnd, size, client_offset, scroll_up_button, scroll_down_button, extension_button)¶Calculate the client size of a wx.ribbon.RibbonGallery control for a given size.
This should act as the inverse to GetGallerySize
, and decrement the given size by enough to fit the gallery border, buttons, and other chrome.
Parameters: |
|
---|---|
Return type: | Size |
GetGallerySize
(self, dc, wnd, client_size)¶Calculate the size of a wx.ribbon.RibbonGallery control for a given client size.
This should increment the given size by enough to fit the gallery border, buttons, and any other chrome.
Parameters: |
|
---|---|
Return type: | Size |
See also
GetMetric
(self, id)¶Get the value of a certain integer setting.
id can be one of the size values of wx.ribbon.RibbonArtSetting.
Parameters: | id (int) – |
---|---|
Return type: | int |
GetMinimisedPanelMinimumSize
(self, dc, wnd, desired_bitmap_size, expanded_panel_direction)¶Calculate the size of a minimised ribbon panel.
Parameters: |
|
---|---|
Return type: | Size |
GetPageBackgroundRedrawArea
(self, dc, wnd, page_old_size, page_new_size)¶Calculate the portion of a page background which needs to be redrawn when a page is resized.
To optimise the drawing of page backgrounds, as small an area as possible should be returned. Of course, if the way in which a background is drawn means that the entire background needs to be repainted on resize, then the entire new size should be returned.
Parameters: |
|
---|---|
Return type: | Rect |
GetPanelClientSize
(self, dc, wnd, size, client_offset)¶Calculate the client size of a panel for a given overall size.
This should act as the inverse to GetPanelSize
, and decrement the given size by enough to fit the panel label and other chrome.
Parameters: |
|
---|---|
Return type: | Size |
See also
GetPanelExtButtonArea
(self, dc, wnd, rect)¶Calculate the position and size of the panel extension button.
Parameters: |
|
---|---|
Return type: | Rect |
New in version 2.9.4.
GetPanelSize
(self, dc, wnd, client_size, client_offset)¶Calculate the size of a panel for a given client size.
This should increment the given size by enough to fit the panel label and other chrome.
Parameters: |
|
---|---|
Return type: | Size |
See also
GetRibbonHelpButtonArea
(self, rect)¶Calculate the position and size of the ribbon’s help button.
Parameters: | rect (wx.Rect) – The ribbon bar rectangle from which calculate help button rectangle. |
---|---|
Return type: | Rect |
New in version 2.9.5.
GetScrollButtonMinimumSize
(self, dc, wnd, style)¶Calculate the minimum size (in pixels) of a scroll button.
Parameters: |
|
---|---|
Return type: | Size |
GetTabCtrlHeight
(self, dc, wnd, pages)¶Calculate the height (in pixels) of the tab region of a ribbon bar.
Note that as the tab region can contain scroll buttons, the height should be greater than or equal to the minimum height for a tab scroll button.
Parameters: | |
---|---|
Return type: | int |
GetToolSize
(self, dc, wnd, bitmap_size, kind, is_first, is_last, dropdown_region)¶Calculate the size of a tool within a wx.ribbon.RibbonToolBar.
Parameters: |
|
---|---|
Return type: | Size |
SetColour
(self, id, colour)¶Set the value of a certain colour setting to the value colour.
id can be one of the colour values of wx.ribbon.RibbonArtSetting, though not all colour settings will have an effect on every art provider.
Parameters: |
|
---|
See also
SetColourScheme
(self, primary, secondary, tertiary)¶Set all applicable colour settings from a few base colours.
Uses any or all of the three given colours to create a colour scheme, and then sets all colour settings which are relevant to the art provider using that scheme. Note that some art providers may not use the tertiary colour for anything, and some may not use the secondary colour either.
Parameters: |
---|
See also
See also
SetFlags
(self, flags)¶Set the style flags.
Normally called automatically by wx.ribbon.RibbonBar.SetArtProvider
with the ribbon bar’s style flags, so that the art provider has the same flags as the bar which it is serving.
Parameters: | flags (long) – |
---|
SetFont
(self, id, font)¶Set the value of a certain font setting to the value font.
id can be one of the font values of wx.ribbon.RibbonArtSetting.
Parameters: |
|
---|
SetMetric
(self, id, new_val)¶Set the value of a certain integer setting to the value new_val.
id can be one of the size values of wx.ribbon.RibbonArtSetting.
Parameters: |
|
---|