A ribbon tool bar is similar to a traditional toolbar which has no labels.
It contains one or more tool groups, each of which contains one or more tools. Each tool is represented by a (generally small, i.e. 16x15) bitmap.
Handlers bound for the following event types will receive a wx.ribbon.RibbonToolBarEvent parameter.
wx.ribbon.RibbonToolBarEvent.PopupMenu
should be called by the event handler if it wants to display a popup menu (which is what most dropdown tools should be doing).__init__ |
Default constructor. |
AddDropdownTool |
Add a dropdown tool to the tool bar (simple version). |
AddHybridTool |
Add a hybrid tool to the tool bar (simple version). |
AddSeparator |
Add a separator to the tool bar. |
AddToggleTool |
Add a toggle tool to the tool bar (simple version). |
AddTool |
Add a tool to the tool bar (simple version). |
ClearTools |
Deletes all the tools in the toolbar. |
Create |
Create a tool bar in two-step tool bar construction. |
DeleteTool |
Removes the specified tool from the toolbar and deletes it. |
DeleteToolByPos |
This function behaves like DeleteTool but it deletes the tool at the specified position and not the one with the given id. |
EnableTool |
Enable or disable a single tool on the bar. |
FindById |
Returns a pointer to the tool opaque structure by id or None if no corresponding tool is found. |
GetToolByPos |
Return the opaque pointer corresponding to the given tool. |
GetToolClientData |
Get any client data associated with the tool. |
GetToolEnabled |
Called to determine whether a tool is enabled (responds to user input). |
GetToolHelpString |
Returns the help string for the given tool. |
GetToolId |
Return the id assciated to the tool opaque structure. |
GetToolKind |
Return the kind of the given tool. |
GetToolPos |
Returns the tool position in the toolbar, or NOT_FOUND if the tool is not found. |
GetToolState |
Gets the on/off state of a toggle tool. |
InsertDropdownTool |
Insert a dropdown tool to the tool bar (simple version) as the specified position. |
InsertHybridTool |
Insert a hybrid tool to the tool bar (simple version) as the specified position. |
InsertSeparator |
Insert a separator to the tool bar at the specified position. |
InsertToggleTool |
Insert a toggle tool to the tool bar (simple version) as the specified position. |
InsertTool |
Insert a tool to the tool bar (simple version) as the specified position. |
Realize |
Calculate tool layouts and positions. |
SetRows |
Set the number of rows to distribute tool groups over. |
SetToolClientData |
Sets the client data associated with the tool. |
SetToolDisabledBitmap |
Sets the bitmap to be used by the tool with the given ID when the tool is in a disabled state. |
SetToolHelpString |
Sets the help string shown in tooltip for the given tool. |
SetToolNormalBitmap |
Sets the bitmap to be used by the tool with the given ID . |
ToggleTool |
Set a toggle tool to the checked or unchecked state. |
wx.ribbon.
RibbonToolBar
(RibbonControl)¶Possible constructors:
RibbonToolBar()
RibbonToolBar(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize,
style=0)
A ribbon tool bar is similar to a traditional toolbar which has no labels.
__init__
(self, *args, **kw)¶__init__ (self)
Default constructor.
With this constructor, Create
should be called in order to create the tool bar.
__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0)
Construct a ribbon tool bar with the given parameters.
Parameters: |
|
---|
AddDropdownTool
(self, tool_id, bitmap, help_string="")¶Add a dropdown tool to the tool bar (simple version).
Parameters: |
|
---|---|
Return type: | RibbonToolBarToolBase |
See also
AddHybridTool
(self, tool_id, bitmap, help_string="")¶Add a hybrid tool to the tool bar (simple version).
Parameters: |
|
---|---|
Return type: | RibbonToolBarToolBase |
See also
AddSeparator
(self)¶Add a separator to the tool bar.
Separators are used to separate tools into groups. As such, a separator is not explicitly drawn, but is visually seen as the gap between tool groups.
Return type: | RibbonToolBarToolBase |
---|
AddToggleTool
(self, tool_id, bitmap, help_string)¶Add a toggle tool to the tool bar (simple version).
Parameters: |
|
---|---|
Return type: | RibbonToolBarToolBase |
New in version 2.9.4.
See also
AddTool
(self, *args, **kw)¶AddTool (self, tool_id, bitmap, help_string, kind=RIBBON_BUTTON_NORMAL)
Add a tool to the tool bar (simple version).
Parameters: |
|
---|---|
Return type: | RibbonToolBarToolBase |
AddTool (self, tool_id, bitmap, bitmap_disabled=NullBitmap, help_string=””, kind=RIBBON_BUTTON_NORMAL, clientData=None)
Add a tool to the tool bar.
Parameters: |
|
---|
Client data to associate with the new tool.
Return type: | RibbonToolBarToolBase |
---|---|
Returns: | An opaque pointer which can be used only with other tool bar methods. |
See also
ClearTools
(self)¶Deletes all the tools in the toolbar.
New in version 2.9.4.
Create
(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0)¶Create a tool bar in two-step tool bar construction.
Should only be called when the default constructor is used, and arguments have the same meaning as in the full constructor.
Parameters: | |
---|---|
Return type: | bool |
DeleteTool
(self, tool_id)¶Removes the specified tool from the toolbar and deletes it.
Parameters: | tool_id (int) – ID of the tool to delete. |
---|---|
Return type: | bool |
Returns: | True if the tool was deleted, False otherwise. |
New in version 2.9.4.
See also
DeleteToolByPos
(self, pos)¶This function behaves like DeleteTool
but it deletes the tool at the specified position and not the one with the given id.
Useful to delete separators.
Parameters: | pos (int) – |
---|---|
Return type: | bool |
New in version 2.9.4.
EnableTool
(self, tool_id, enable=True)¶Enable or disable a single tool on the bar.
Parameters: |
|
---|
New in version 2.9.4.
FindById
(self, tool_id)¶Returns a pointer to the tool opaque structure by id or None
if no corresponding tool is found.
Parameters: | tool_id (int) – |
---|---|
Return type: | RibbonToolBarToolBase |
New in version 2.9.4.
GetToolByPos
(self, pos)¶Return the opaque pointer corresponding to the given tool.
Parameters: | pos (int) – |
---|---|
Return type: | RibbonToolBarToolBase |
Returns: | an opaque pointer, None if is a separator or not found. |
New in version 2.9.4: Returns the number of tools in the toolbar.
New in version 2.9.4.
GetToolClientData
(self, tool_id)¶Get any client data associated with the tool.
Parameters: | tool_id (int) – ID of the tool in question, as passed to AddTool . |
---|---|
Return type: | PyUserData |
Returns: | Client data, or None if there is none. |
New in version 2.9.4.
GetToolEnabled
(self, tool_id)¶Called to determine whether a tool is enabled (responds to user input).
Parameters: | tool_id (int) – ID of the tool in question, as passed to AddTool . |
---|---|
Return type: | bool |
Returns: | True if the tool is enabled, False otherwise. |
New in version 2.9.4.
See also
GetToolHelpString
(self, tool_id)¶Returns the help string for the given tool.
Parameters: | tool_id (int) – ID of the tool in question, as passed to AddTool . |
---|---|
Return type: | string |
New in version 2.9.4.
GetToolId
(self, tool)¶Return the id assciated to the tool opaque structure.
The structure pointer must not be None
.
Parameters: | tool (RibbonToolBarToolBase) – |
---|---|
Return type: | int |
New in version 2.9.4.
GetToolKind
(self, tool_id)¶Return the kind of the given tool.
Parameters: | tool_id (int) – ID of the tool in question, as passed to AddTool . |
---|---|
Return type: | wx.ribbon.RibbonButtonKind |
New in version 2.9.4.
GetToolPos
(self, tool_id)¶Returns the tool position in the toolbar, or NOT_FOUND
if the tool is not found.
Parameters: | tool_id (int) – ID of the tool in question, as passed to AddTool . |
---|---|
Return type: | int |
New in version 2.9.4.
GetToolState
(self, tool_id)¶Gets the on/off state of a toggle tool.
Parameters: | tool_id (int) – ID of the tool in question, as passed to AddTool . |
---|---|
Return type: | bool |
Returns: | True if the tool is toggled on, False otherwise. |
New in version 2.9.4.
See also
InsertDropdownTool
(self, pos, tool_id, bitmap, help_string="")¶Insert a dropdown tool to the tool bar (simple version) as the specified position.
Parameters: |
|
---|---|
Return type: | RibbonToolBarToolBase |
New in version 2.9.4.
See also
InsertHybridTool
(self, pos, tool_id, bitmap, help_string="")¶Insert a hybrid tool to the tool bar (simple version) as the specified position.
Parameters: |
|
---|---|
Return type: | RibbonToolBarToolBase |
New in version 2.9.4.
See also
InsertSeparator
(self, pos)¶Insert a separator to the tool bar at the specified position.
Parameters: | pos (int) – |
---|---|
Return type: | RibbonToolBarToolBase |
New in version 2.9.4.
See also
InsertToggleTool
(self, pos, tool_id, bitmap, help_string="")¶Insert a toggle tool to the tool bar (simple version) as the specified position.
Parameters: |
|
---|---|
Return type: | RibbonToolBarToolBase |
New in version 2.9.4.
See also
InsertTool
(self, *args, **kw)¶InsertTool (self, pos, tool_id, bitmap, help_string, kind=RIBBON_BUTTON_NORMAL)
Insert a tool to the tool bar (simple version) as the specified position.
Parameters: |
|
---|---|
Return type: | RibbonToolBarToolBase |
New in version 2.9.4.
See also
InsertTool (self, pos, tool_id, bitmap, bitmap_disabled=NullBitmap, help_string=””, kind=RIBBON_BUTTON_NORMAL, clientData=None)
Insert a tool to the tool bar at the specified position.
Parameters: |
|
---|
Client data to associate with the new tool.
Return type: | RibbonToolBarToolBase |
---|---|
Returns: | An opaque pointer which can be used only with other tool bar methods. |
New in version 2.9.4.
See also
Realize
(self)¶Calculate tool layouts and positions.
Must be called after tools are added to the tool bar, as otherwise the newly added tools will not be displayed.
Return type: | bool |
---|
SetRows
(self, nMin, nMax=-1)¶Set the number of rows to distribute tool groups over.
Tool groups can be distributed over a variable number of rows. The way in which groups are assigned to rows is not specified, and the order of groups may change, but they will be distributed in such a way as to minimise the overall size of the tool bar.
Parameters: |
|
---|
SetToolClientData
(self, tool_id, clientData)¶Sets the client data associated with the tool.
Parameters: |
|
---|
New in version 2.9.4.
SetToolDisabledBitmap
(self, tool_id, bitmap)¶Sets the bitmap to be used by the tool with the given ID
when the tool is in a disabled state.
Parameters: |
---|
New in version 2.9.4.
SetToolHelpString
(self, tool_id, helpString)¶Sets the help string shown in tooltip for the given tool.
Parameters: |
|
---|
New in version 2.9.4.
See also
SetToolNormalBitmap
(self, tool_id, bitmap)¶Sets the bitmap to be used by the tool with the given ID
.
Parameters: |
---|
New in version 2.9.4.
ToggleTool
(self, tool_id, checked)¶Set a toggle tool to the checked or unchecked state.
Parameters: |
|
---|
New in version 2.9.4.