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.
EVT_RIBBONTOOLBAR_CLICKED: Triggered when the normal (non-dropdown) region of a tool on the tool bar is clicked.
EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED: Triggered when the dropdown region of a tool on the tool bar is clicked. 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). ^^
Default constructor. |
|
Add a dropdown tool to the tool bar (simple version). |
|
Add a hybrid tool to the tool bar (simple version). |
|
Add a separator to the tool bar. |
|
Add a toggle tool to the tool bar (simple version). |
|
Add a tool to the tool bar (simple version). |
|
Deletes all the tools in the toolbar. |
|
Create a tool bar in two-step tool bar construction. |
|
Removes the specified tool from the toolbar and deletes it. |
|
This function behaves like |
|
Enable or disable a single tool on the bar. |
|
Returns a pointer to the tool opaque structure by id or |
|
Returns the active item of the tool bar or |
|
Return the opaque pointer corresponding to the given tool. |
|
Get any client data associated with the tool. |
|
Returns the number of tools in the toolbar. |
|
Called to determine whether a tool is enabled (responds to user input). |
|
Returns the help string for the given tool. |
|
Return the id associated to the tool opaque structure. |
|
Return the kind of the given tool. |
|
Returns the tool position in the toolbar, or |
|
Returns the tool’s rect with coordinates relative to the toolbar’s parent, or a default-constructed rect if the tool is not found. |
|
Gets the on/off state of a toggle tool. |
|
Insert a dropdown tool to the tool bar (simple version) as the specified position. |
|
Insert a hybrid tool to the tool bar (simple version) as the specified position. |
|
Insert a separator to the tool bar at the specified position. |
|
Insert a toggle tool to the tool bar (simple version) as the specified position. |
|
Insert a tool to the tool bar (simple version) as the specified position. |
|
Calculate tool layouts and positions. |
|
Set the number of rows to distribute tool groups over. |
|
Sets the client data associated with the tool. |
|
Sets the bitmap to be used by the tool with the given |
|
Sets the help string shown in tooltip for the given tool. |
|
Sets the bitmap to be used by the tool with the given |
|
Set a toggle tool to the checked or unchecked state. |
See |
|
See |
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.
parent (wx.Window) – Parent window for the tool bar (typically a wx.ribbon.RibbonPanel).
id (wx.WindowID) – An identifier for the toolbar. ID_ANY
is taken to mean a default.
pos (wx.Point) – Initial position of the tool bar.
size (wx.Size) – Initial size of the tool bar.
style (long) – Tool bar style, currently unused.
AddDropdownTool
(self, tool_id, bitmap, help_string="")¶Add a dropdown tool to the tool bar (simple version).
tool_id (int) –
bitmap (wx.Bitmap) –
help_string (string) –
RibbonToolBarToolBase
See also
AddHybridTool
(self, tool_id, bitmap, help_string="")¶Add a hybrid tool to the tool bar (simple version).
tool_id (int) –
bitmap (wx.Bitmap) –
help_string (string) –
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.
RibbonToolBarToolBase
AddToggleTool
(self, tool_id, bitmap, help_string)¶Add a toggle tool to the tool bar (simple version).
tool_id (int) –
bitmap (wx.Bitmap) –
help_string (string) –
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).
tool_id (int) –
bitmap (wx.Bitmap) –
help_string (string) –
kind (RibbonButtonKind) –
RibbonToolBarToolBase
AddTool (self, tool_id, bitmap, bitmap_disabled=NullBitmap, help_string=””, kind=RIBBON_BUTTON_NORMAL, clientData=None)
Add a tool to the tool bar.
tool_id (int) – ID
of the new tool (used for event callbacks).
bitmap (wx.Bitmap) – Bitmap to use as the foreground for the new tool. Does not have to be the same size as other tool bitmaps, but should be similar as otherwise it will look visually odd.
bitmap_disabled (wx.Bitmap) – Bitmap to use when the tool is disabled. If left as NullBitmap, then a bitmap will be automatically generated from bitmap.
help_string (string) – The UI help string to associate with the new tool.
kind (RibbonButtonKind) – The kind of tool to add.
clientData (PyUserData) – Client data to associate with the new tool.
RibbonToolBarToolBase
An opaque pointer which can be used only with other tool bar methods.
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.
DeleteTool
(self, tool_id)¶Removes the specified tool from the toolbar and deletes it.
tool_id (int) – ID
of the tool to delete.
bool
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.
pos (int) –
bool
New in version 2.9.4.
EnableTool
(self, tool_id, enable=True)¶Enable or disable a single tool on the bar.
tool_id (int) – ID
of the tool to enable or disable.
enable (bool) – True
to enable the tool, False
to disable it.
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.
tool_id (int) –
RibbonToolBarToolBase
New in version 2.9.4.
GetActiveTool
(self)¶Returns the active item of the tool bar or None
if there is none.
The active tool is the one being clicked.
RibbonToolBarToolBase
New in version 4.1/wxWidgets-3.1.7.
GetClassDefaultAttributes
(variant=WINDOW_VARIANT_NORMAL)¶variant (WindowVariant) –
VisualAttributes
GetToolByPos
(self, *args, **kw)¶GetToolByPos (self, pos)
Return the opaque pointer corresponding to the given tool.
pos (int) –
RibbonToolBarToolBase
an opaque pointer, None
if is a separator or not found.
New in version 2.9.4.
GetToolByPos (self, x, y)
Returns the opaque pointer for the tool at the given coordinates, which are relative to the toolbar’s parent.
x (int) –
y (int) –
RibbonToolBarToolBase
an opaque pointer, None
if is not found.
New in version 4.1/wxWidgets-3.1.5.
GetToolClientData
(self, tool_id)¶Get any client data associated with the tool.
tool_id (int) – ID
of the tool in question, as passed to AddTool
.
PyUserData
Client data, or None
if there is none.
New in version 2.9.4.
GetToolCount
(self)¶Returns the number of tools in the toolbar.
int
New in version 2.9.4.
GetToolEnabled
(self, tool_id)¶Called to determine whether a tool is enabled (responds to user input).
tool_id (int) – ID
of the tool in question, as passed to AddTool
.
bool
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.
tool_id (int) – ID
of the tool in question, as passed to AddTool
.
string
New in version 2.9.4.
GetToolId
(self, tool)¶Return the id associated to the tool opaque structure.
The structure pointer must not be None
.
tool (RibbonToolBarToolBase) –
int
New in version 2.9.4.
GetToolKind
(self, tool_id)¶Return the kind of the given tool.
tool_id (int) – ID
of the tool in question, as passed to AddTool
.
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.
tool_id (int) – ID
of the tool in question, as passed to AddTool
.
int
New in version 2.9.4.
GetToolRect
(self, tool_id)¶Returns the tool’s rect with coordinates relative to the toolbar’s parent, or a default-constructed rect if the tool is not found.
tool_id (int) – ID
of the tool in question, as passed to AddTool
.
Rect
New in version 4.1/wxWidgets-3.1.5.
GetToolState
(self, tool_id)¶Gets the on/off state of a toggle tool.
tool_id (int) – ID
of the tool in question, as passed to AddTool
.
bool
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.
pos (int) –
tool_id (int) –
bitmap (wx.Bitmap) –
help_string (string) –
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.
pos (int) –
tool_id (int) –
bitmap (wx.Bitmap) –
help_string (string) –
RibbonToolBarToolBase
New in version 2.9.4.
See also
InsertSeparator
(self, pos)¶Insert a separator to the tool bar at the specified position.
pos (int) –
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.
pos (int) –
tool_id (int) –
bitmap (wx.Bitmap) –
help_string (string) –
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.
pos (int) –
tool_id (int) –
bitmap (wx.Bitmap) –
help_string (string) –
kind (RibbonButtonKind) –
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.
pos (int) – Position of the new tool (number of tools and separators from the beginning of the toolbar).
tool_id (int) – ID
of the new tool (used for event callbacks).
bitmap (wx.Bitmap) – Bitmap to use as the foreground for the new tool. Does not have to be the same size as other tool bitmaps, but should be similar as otherwise it will look visually odd.
bitmap_disabled (wx.Bitmap) – Bitmap to use when the tool is disabled. If left as NullBitmap, then a bitmap will be automatically generated from bitmap.
help_string (string) – The UI help string to associate with the new tool.
kind (RibbonButtonKind) – The kind of tool to add.
clientData (PyUserData) – Client data to associate with the new tool.
RibbonToolBarToolBase
An opaque pointer which can be used only with other tool bar methods.
New in version 2.9.4.
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.
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.
nMin (int) – The minimum number of rows to use.
nMax (int) – The maximum number of rows to use (defaults to nMin).
SetToolClientData
(self, tool_id, clientData)¶Sets the client data associated with the tool.
tool_id (int) – ID
of the tool in question, as passed to AddTool
.
clientData (PyUserData) – The client data to use.
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.
New in version 2.9.4.
SetToolHelpString
(self, tool_id, helpString)¶Sets the help string shown in tooltip for the given tool.
tool_id (int) – ID
of the tool in question, as passed to AddTool
.
helpString (string) – A string for the help.
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
.
New in version 2.9.4.
ToggleTool
(self, tool_id, checked)¶Set a toggle tool to the checked or unchecked state.
tool_id (int) – ID
of the toggle tool to manipulate.
checked (bool) – True
to set the tool to the toggled/pressed/checked state, False
to set it to the untoggled/unpressed/unchecked state.
New in version 2.9.4.
ActiveTool
¶See GetActiveTool
ToolCount
¶See GetToolCount