Gtk.ToolItem¶
- Subclasses:
Methods¶
- Inherited:
Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Activatable (6)
- Structs:
Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Activatable (2)
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
Whether the toolbar item is considered important. When |
||
r/w/en |
Whether the toolbar item is visible when the toolbar is in a horizontal orientation. |
||
r/w/en |
Whether the toolbar item is visible when the toolbar is in a vertical orientation. |
Style Properties¶
- Inherited:
Signals¶
- Inherited:
Name |
Short Description |
---|---|
This signal is emitted when the toolbar needs information from tool_item about whether the item should appear in the toolbar overflow menu. |
|
This signal is emitted when some property of the toolbar that the item is a child of changes. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Gtk.ToolItem(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Gtk.ToolItems
are widgets that can appear on a toolbar. To create a toolbar item that contain something else than a button, useGtk.ToolItem.new
(). UseGtk.Container.add
() to add a child widget to the tool item.For toolbar items that contain buttons, see the
Gtk.ToolButton
,Gtk.ToggleToolButton
andGtk.RadioToolButton
classes.See the
Gtk.Toolbar
class for a description of the toolbar widget, andGtk.ToolShell
for a description of the tool shell interface.- classmethod new()[source]¶
- Returns:
the new
Gtk.ToolItem
- Return type:
Creates a new
Gtk.ToolItem
New in version 2.4.
- get_ellipsize_mode()[source]¶
- Returns:
a
Pango.EllipsizeMode
indicating how text in self should be ellipsized.- Return type:
Returns the ellipsize mode used for self. Custom subclasses of
Gtk.ToolItem
should call this function to find out how text should be ellipsized.New in version 2.20.
- get_expand()[source]¶
-
Returns whether self is allocated extra space. See
Gtk.ToolItem.set_expand
().New in version 2.4.
- get_homogeneous()[source]¶
-
Returns whether self is the same size as other homogeneous items. See
Gtk.ToolItem.set_homogeneous
().New in version 2.4.
- get_icon_size()[source]¶
- Returns:
a
Gtk.IconSize
indicating the icon size used for self- Return type:
Returns the icon size used for self. Custom subclasses of
Gtk.ToolItem
should call this function to find out what size icons they should use.New in version 2.4.
- get_is_important()[source]¶
-
Returns whether self is considered important. See
Gtk.ToolItem.set_is_important
()New in version 2.4.
- get_orientation()[source]¶
- Returns:
a
Gtk.Orientation
indicating the orientation used for self- Return type:
Returns the orientation used for self. Custom subclasses of
Gtk.ToolItem
should call this function to find out what size icons they should use.New in version 2.4.
- Parameters:
menu_item_id (
str
) – a string used to identify the menu item- Returns:
The
Gtk.MenuItem
passed toGtk.ToolItem.set_proxy_menu_item
(), if the menu_item_ids match.- Return type:
Gtk.Widget
orNone
If menu_item_id matches the string passed to
Gtk.ToolItem.set_proxy_menu_item
() return the correspondingGtk.MenuItem
.Custom subclasses of
Gtk.ToolItem
should use this function to update their menu item when theGtk.ToolItem
changes. That the menu_item_ids must match ensures that aGtk.ToolItem
will not inadvertently change a menu item that they did not create.New in version 2.4.
- get_relief_style()[source]¶
- Returns:
a
Gtk.ReliefStyle
indicating the relief style used for self.- Return type:
Returns the relief style of self. See
Gtk.Button.set_relief
(). Custom subclasses ofGtk.ToolItem
should call this function in the handler of the #GtkToolItem::toolbar_reconfigured signal to find out the relief style of buttons.New in version 2.4.
- get_text_alignment()[source]¶
-
Returns the text alignment used for self. Custom subclasses of
Gtk.ToolItem
should call this function to find out how text should be aligned.New in version 2.20.
- get_text_orientation()[source]¶
- Returns:
a
Gtk.Orientation
indicating the text orientation used for self- Return type:
Returns the text orientation used for self. Custom subclasses of
Gtk.ToolItem
should call this function to find out how text should be orientated.New in version 2.20.
- get_text_size_group()[source]¶
- Returns:
- Return type:
Returns the size group used for labels in self. Custom subclasses of
Gtk.ToolItem
should call this function and use the size group for labels.New in version 2.20.
- get_toolbar_style()[source]¶
- Returns:
A
Gtk.ToolbarStyle
indicating the toolbar style used for self.- Return type:
Returns the toolbar style used for self. Custom subclasses of
Gtk.ToolItem
should call this function in the handler of the GtkToolItem::toolbar_reconfigured signal to find out in what style the toolbar is displayed and change themselves accordinglyPossibilities are:
Gtk.ToolbarStyle.BOTH
, meaning the tool item should show both an icon and a label, stacked verticallyGtk.ToolbarStyle.ICONS
, meaning the toolbar shows only iconsGtk.ToolbarStyle.TEXT
, meaning the tool item should only show textGtk.ToolbarStyle.BOTH_HORIZ
, meaning the tool item should show both an icon and a label, arranged horizontally
New in version 2.4.
- get_use_drag_window()[source]¶
-
Returns whether self has a drag window. See
Gtk.ToolItem.set_use_drag_window
().New in version 2.4.
- get_visible_horizontal()[source]¶
-
Returns whether the self is visible on toolbars that are docked horizontally.
New in version 2.4.
- get_visible_vertical()[source]¶
- Returns:
Whether self is visible when the toolbar is docked vertically
- Return type:
Returns whether self is visible when the toolbar is docked vertically. See
Gtk.ToolItem.set_visible_vertical
().New in version 2.4.
Calling this function signals to the toolbar that the overflow menu item for self has changed. If the overflow menu is visible when this function it called, the menu will be rebuilt.
The function must be called when the tool item changes what it will do in response to the
Gtk.ToolItem
::create-menu-proxy
signal.New in version 2.6.
- Returns:
The
Gtk.MenuItem
that is going to appear in the overflow menu for self.- Return type:
Returns the
Gtk.MenuItem
that was last set byGtk.ToolItem.set_proxy_menu_item
(), ie. theGtk.MenuItem
that is going to appear in the overflow menu.New in version 2.4.
- set_expand(expand)[source]¶
- Parameters:
expand (
bool
) – Whether self is allocated extra space
Sets whether self is allocated extra space when there is more room on the toolbar then needed for the items. The effect is that the item gets bigger when the toolbar gets bigger and smaller when the toolbar gets smaller.
New in version 2.4.
- set_homogeneous(homogeneous)[source]¶
- Parameters:
homogeneous (
bool
) – whether self is the same size as other homogeneous items
Sets whether self is to be allocated the same size as other homogeneous items. The effect is that all homogeneous items will have the same width as the widest of the items.
New in version 2.4.
- set_is_important(is_important)[source]¶
- Parameters:
is_important (
bool
) – whether the tool item should be considered important
Sets whether self should be considered important. The
Gtk.ToolButton
class uses this property to determine whether to show or hide its label when the toolbar style isGtk.ToolbarStyle.BOTH_HORIZ
. The result is that only tool buttons with the “is_important” property set have labels, an effect known as “priority text”New in version 2.4.
- Parameters:
menu_item_id (
str
) – a string used to identify menu_itemmenu_item (
Gtk.Widget
orNone
) – aGtk.MenuItem
to use in the overflow menu, orNone
Sets the
Gtk.MenuItem
used in the toolbar overflow menu. The menu_item_id is used to identify the caller of this function and should also be used withGtk.ToolItem.get_proxy_menu_item
().See also
Gtk.ToolItem
::create-menu-proxy
.New in version 2.4.
- set_tooltip_markup(markup)[source]¶
- Parameters:
markup (
str
) – markup text to be used as tooltip for self
Sets the markup text to be displayed as tooltip on the item. See
Gtk.Widget.set_tooltip_markup
().New in version 2.12.
- set_tooltip_text(text)[source]¶
- Parameters:
text (
str
) – text to be used as tooltip for self
Sets the text to be displayed as tooltip on the item. See
Gtk.Widget.set_tooltip_text
().New in version 2.12.
- set_use_drag_window(use_drag_window)[source]¶
- Parameters:
use_drag_window (
bool
) – Whether self has a drag window.
Sets whether self has a drag window. When
True
the toolitem can be used as a drag source throughGtk.Widget.drag_source_set
(). When self has a drag window it will intercept all events, even those that would otherwise be sent to a child of self.New in version 2.4.
- set_visible_horizontal(visible_horizontal)[source]¶
- Parameters:
visible_horizontal (
bool
) – Whether self is visible when in horizontal mode
Sets whether self is visible when the toolbar is docked horizontally.
New in version 2.4.
- set_visible_vertical(visible_vertical)[source]¶
- Parameters:
visible_vertical (
bool
) – whether self is visible when the toolbar is in vertical mode
Sets whether self is visible when the toolbar is docked vertically. Some tool items, such as text entries, are too wide to be useful on a vertically docked toolbar. If visible_vertical is
False
self will not appear on toolbars that are docked vertically.New in version 2.4.
- toolbar_reconfigured()[source]¶
Emits the signal #GtkToolItem::toolbar_reconfigured on self.
Gtk.Toolbar
and otherGtk.ToolShell
implementations use this function to notify children, when some aspect of their configuration changes.New in version 2.14.
- Return type:
Signal emitted when the toolbar needs information from tool_item about whether the item should appear in the toolbar overflow menu.
- do_toolbar_reconfigured() virtual¶
Emits the signal #GtkToolItem::toolbar_reconfigured on tool_item.
Gtk.Toolbar
and otherGtk.ToolShell
implementations use this function to notify children, when some aspect of their configuration changes.New in version 2.14.
Signal Details¶
- Signal Name:
create-menu-proxy
- Flags:
- Parameters:
tool_item (
Gtk.ToolItem
) – The object which received the signal- Returns:
- Return type:
This signal is emitted when the toolbar needs information from tool_item about whether the item should appear in the toolbar overflow menu. In response the tool item should either
call
Gtk.ToolItem.set_proxy_menu_item
() with aNone
pointer and returnTrue
to indicate that the item should not appear in the overflow menucall
Gtk.ToolItem.set_proxy_menu_item
() with a new menu item and returnTrue
, orreturn
False
to indicate that the signal was not handled by the item. This means that the item will not appear in the overflow menu unless a later handler installs a menu item.
The toolbar may cache the result of this signal. When the tool item changes how it will respond to this signal it must call
Gtk.ToolItem.rebuild_menu
() to invalidate the cache and ensure that the toolbar rebuilds its overflow menu.
- Gtk.ToolItem.signals.toolbar_reconfigured(tool_item)¶
- Signal Name:
toolbar-reconfigured
- Flags:
- Parameters:
tool_item (
Gtk.ToolItem
) – The object which received the signal
This signal is emitted when some property of the toolbar that the item is a child of changes. For custom subclasses of
Gtk.ToolItem
, the default handler of this signal use the functionsGtk.ToolShell.get_relief_style
() to find out what the toolbar should look like and change themselves accordingly.
Property Details¶
- Gtk.ToolItem.props.is_important¶
- Name:
is-important
- Type:
- Default Value:
- Flags:
Whether the toolbar item is considered important. When
True
, toolbar buttons show text inGtk.ToolbarStyle.BOTH_HORIZ
mode
- Gtk.ToolItem.props.visible_horizontal¶
- Name:
visible-horizontal
- Type:
- Default Value:
- Flags:
Whether the toolbar item is visible when the toolbar is in a horizontal orientation.