Gtk.ToolItem
Gtk.ToolItem — The base class of widgets that can be added to Gtk.ToolShell
Object Hierarchy:
GObject
╰── GInitiallyUnowned
╰── Gtk.Widget
╰── Gtk.Container
╰── Gtk.Bin
╰── Gtk.ToolItem
├── Gtk.ToolButton
╰── Gtk.SeparatorToolItem
See also:
Gtk.Toolbar, Gtk.ToolButton, Gtk.SeparatorToolItem
Functions:
- new
() -> Gtk.ToolItem
- set_homogeneous
(self, homogeneous:bool)
- get_homogeneous
(self) -> bool
- set_expand
(self, expand:bool)
- get_expand
(self) -> bool
- set_tooltip_text
(self, text:str)
- set_tooltip_markup
(self, markup:str)
- set_use_drag_window
(self, use_drag_window:bool)
- get_use_drag_window
(self) -> bool
- set_visible_horizontal
(self, visible_horizontal:bool)
- get_visible_horizontal
(self) -> bool
- set_visible_vertical
(self, visible_vertical:bool)
- get_visible_vertical
(self) -> bool
- set_is_important
(self, is_important:bool)
- get_is_important
(self) -> bool
- get_ellipsize_mode
(self) -> Pango.EllipsizeMode
- get_icon_size
(self) -> int
- get_orientation
(self) -> Gtk.Orientation
- get_toolbar_style
(self) -> Gtk.ToolbarStyle
- get_relief_style
(self) -> Gtk.ReliefStyle
- get_text_alignment
(self) -> float
- get_text_orientation
(self) -> Gtk.Orientation
- retrieve_proxy_menu_item
(self) -> Gtk.Widget
- get_proxy_menu_item
(self, menu_item_id:str) -> Gtk.Widget
- set_proxy_menu_item
(self, menu_item_id:str, menu_item:Gtk.Widget)
- rebuild_menu
(self)
- toolbar_reconfigured
(self)
- get_text_size_group
(self) -> Gtk.SizeGroup
Signals:
- “create-menu-proxy”
(tool_item, user_data)
Description:
Gtk.ToolItem
s are widgets that can appear on a toolbar. To create a toolbar item that contain something else than a button, use Gtk.ToolItem::new()
. Use gtk_container_add() to add a child widget to the tool item.
For toolbar items that contain buttons, see the Gtk.ToolButton, Gtk.ToggleToolButton and GtkRadioToolButton classes.
See the Gtk.Toolbar class for a description of the toolbar widget, and Gtk.ToolShell for a description of the tool shell interface.
Function Details:
new()
new () -> Gtk.ToolItem
Creates a new Gtk.ToolItem
Returns: the new Gtk.ToolItem
Since: 2.4
set_homogeneous()
set_homogeneous (self, homogeneous:bool)
Sets whether tool_item
is to be allocated the same size as otherhomogeneous items. The effect is that all homogeneous items will havethe same width as the widest of the items.
- Since: 2.4
get_homogeneous()
get_homogeneous (self) -> bool
Returns whether tool_item
is the same size as other homogeneousitems. See Gtk.ToolItem:set_homogeneous()
.
Returns:
True
if the item is the same size as other homogeneousitems.Since: 2.4
set_expand()
set_expand (self, expand:bool)
Sets whether tool_item
is allocated extra space when thereis more room on the toolbar then needed for the items. Theeffect is that the item gets bigger when the toolbar gets biggerand smaller when the toolbar gets smaller.
- Since: 2.4
get_expand()
get_expand (self) -> bool
Returns whether tool_item
is allocated extra space.See Gtk.ToolItem:set_expand()
.
Returns:
True
iftool_item
is allocated extra space.Since: 2.4
set_tooltip_text()
set_tooltip_text (self, text:str)
Sets the text to be displayed as tooltip on the item.See `Gtk.Widget:set_tooltip_text
()`.
- Since: 2.12
set_tooltip_markup()
set_tooltip_markup (self, markup:str)
Sets the markup text to be displayed as tooltip on the item.See `Gtk.Widget:set_tooltip_markup
()`.
- Since: 2.12
set_use_drag_window()
set_use_drag_window (self, use_drag_window:bool)
Sets whether tool_item
has a drag window. When True
thetoolitem can be used as a drag source through `Gtk.Drag:source_set
().When
tool_itemhas a drag window it will intercept all events,even those that would otherwise be sent to a child of
tool_item`.
- Since: 2.4
get_use_drag_window()
get_use_drag_window (self) -> bool
Returns whether tool_item
has a drag window. SeeGtk.ToolItem:set_use_drag_window()
.
Returns:
True
iftool_item
uses a drag window.Since: 2.4
set_visible_horizontal()
set_visible_horizontal (self, visible_horizontal:bool)
Sets whether tool_item
is visible when the toolbar is docked horizontally.
- Since: 2.4
get_visible_horizontal()
get_visible_horizontal (self) -> bool
Returns whether the tool_item
is visible on toolbars that aredocked horizontally.
Returns:
True
iftool_item
is visible on toolbars that aredocked horizontally.Since: 2.4
set_visible_vertical()
set_visible_vertical (self, visible_vertical:bool)
Sets whether tool_item
is visible when the toolbar is dockedvertically. Some tool items, such as text entries, are too wide to beuseful on a vertically docked toolbar. If visible_vertical
is FALSE``tool_item
will not appear on toolbars that are docked vertically.
- Since: 2.4
get_visible_vertical()
get_visible_vertical (self) -> bool
Returns whether tool_item
is visible when the toolbar is docked vertically.See Gtk.ToolItem:set_visible_vertical()
.
Returns: Whether
tool_item
is visible when the toolbar is docked verticallySince: 2.4
set_is_important()
set_is_important (self, is_important:bool)
Sets whether tool_item
should be considered important. The Gtk.ToolButtonclass
uses this property to determine whether to show or hide its labelwhen the toolbar style is GTK_TOOLBAR_BOTH_HORIZ
. The result is thatonly tool buttons with the “is_important” property set have labels, aneffect known as “priority text”
- Since: 2.4
get_is_important()
get_is_important (self) -> bool
Returns whether tool_item
is considered important. SeeGtk.ToolItem:set_is_important()
Returns:
True
iftool_item
is considered important.Since: 2.4
get_ellipsize_mode()
get_ellipsize_mode (self) -> Pango.EllipsizeMode
Returns the ellipsize mode used for tool_item
. Custom subclasses ofGtk.ToolItem
should call this function to find out how text shouldbe ellipsized.
Returns: a PangoEllipsizeMode indicating how text in
tool_item
should be ellipsized.Since: 2.20
get_icon_size()
get_icon_size (self) -> int
Returns the icon size used for tool_item
. Custom subclasses ofGtk.ToolItem
should call this function to find out what size iconsthey should use.
Returns: a
Gtk.IconSize
indicating the icon sizeused fortool_item
.Since: 2.4
get_orientation()
get_orientation (self) -> Gtk.Orientation
Returns the orientation used for tool_item
. Custom subclasses ofGtk.ToolItem
should call this function to find out what size iconsthey should use.
Returns: a
Gtk.Orientation
indicating the orientationused fortool_item
Since: 2.4
get_toolbar_style()
get_toolbar_style (self) -> Gtk.ToolbarStyle
Returns the toolbar style used for tool_item
. Custom subclasses ofGtk.ToolItem
should call this function in the handler of theGtk.ToolItem
::toolbar_reconfigured signal to find out in what stylethe toolbar is displayed and change themselves accordingly
Possibilities are:
GTK_TOOLBAR_BOTH
, meaning the tool item should showboth an icon and a label, stacked vertically
GTK_TOOLBAR_ICONS
, meaning the toolbar shows only icons
GTK_TOOLBAR_TEXT
, meaning the tool item should only show text
GTK_TOOLBAR_BOTH_HORIZ
, meaning the tool item should showboth an icon and a label, arranged horizontally
Returns: A
Gtk.ToolbarStyle
indicating the toolbar style usedfortool_item
.Since: 2.4
get_relief_style()
get_relief_style (self) -> Gtk.ReliefStyle
Returns the relief style of tool_item
. See `Gtk.Button:set_relief
().Custom subclasses of
Gtk.ToolItem` should call this function in the handlerof the “toolbar_reconfigured” signal to find out therelief style of buttons.
Returns: a
Gtk.ReliefStyle
indicating the relief style usedfortool_item
.Since: 2.4
get_text_alignment()
get_text_alignment (self) -> float
Returns the text alignment used for tool_item
. Custom subclasses ofGtk.ToolItem
should call this function to find out how text shouldbe aligned.
Returns: a gfloat indicating the horizontal text alignmentused for
tool_item
Since: 2.20
get_text_orientation()
get_text_orientation (self) -> Gtk.Orientation
Returns the text orientation used for tool_item
. Custom subclasses ofGtk.ToolItem
should call this function to find out how text shouldbe orientated.
Returns: a
Gtk.Orientation
indicating the text orientationused fortool_item
Since: 2.20
retrieve_proxy_menu_item()
retrieve_proxy_menu_item (self) -> Gtk.Widget
Returns the Gtk.MenuItem
that was last set byGtk.ToolItem:set_proxy_menu_item()
, ie. the Gtk.MenuItem
that is going to appear in the overflow menu.
Returns: The
Gtk.MenuItem
that is going to appear in theoverflow menu fortool_item
.Since: 2.4
get_proxy_menu_item()
get_proxy_menu_item (self, menu_item_id:str) -> Gtk.Widget
If menu_item_id
matches the string passed toGtk.ToolItem:set_proxy_menu_item()
return the corresponding Gtk.MenuItem
.
Custom subclasses of Gtk.ToolItem
should use this function toupdate their menu item when the Gtk.ToolItem
changes. That themenu_item_ids
must match ensures that a Gtk.ToolItem
will not inadvertently change a menu item that they did not create.
Returns: The
Gtk.MenuItem
passed toGtk.ToolItem:set_proxy_menu_item()
, if themenu_item_ids
match.Since: 2.4
set_proxy_menu_item()
set_proxy_menu_item (self, menu_item_id:str, menu_item:Gtk.Widget)
Sets the Gtk.MenuItem
used in the toolbar overflow menu. Themenu_item_id
is used to identify the caller of this function andshould also be used with Gtk.ToolItem:get_proxy_menu_item()
.
- Since: 2.4
rebuild_menu()
rebuild_menu (self)
Calling this function signals to the toolbar that theoverflow menu item for tool_item
has changed. If theoverflow menu is visible when this function it called,the menu will be rebuilt.
The function must be called when the tool item changes what itwill do in response to the “create-menu-proxy” signal.
- Since: 2.6
toolbar_reconfigured()
toolbar_reconfigured (self)
Emits the signal “toolbar_reconfigured” on tool_item
.Gtk.Toolbar
and other Gtk.ToolShell
implementations use this functionto notify children, when some aspect of their configuration changes.
- Since: 2.14
get_text_size_group()
get_text_size_group (self) -> Gtk.SizeGroup
Returns the size group used for labels in tool_item
.Custom subclasses of Gtk.ToolItem
should call this functionand use the size group for labels.
Returns: a
Gtk.SizeGroup
.Since: 2.20