Gtk.ToolItem - Classes - Gtk 3.0 (original) (raw)
g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Activatable Gtk.Activatable GObject.GInterface->Gtk.Activatable Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.ToolItem Gtk.ToolItem Gtk.Activatable->Gtk.ToolItem Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.ToolItem Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget->Gtk.Container
Subclasses:
Gtk.SeparatorToolItem, Gtk.ToolButton
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 | new () |
---|---|
get_ellipsize_mode () | |
get_expand () | |
get_homogeneous () | |
get_icon_size () | |
get_is_important () | |
get_orientation () | |
get_proxy_menu_item (menu_item_id) | |
get_relief_style () | |
get_text_alignment () | |
get_text_orientation () | |
get_text_size_group () | |
get_toolbar_style () | |
get_use_drag_window () | |
get_visible_horizontal () | |
get_visible_vertical () | |
rebuild_menu () | |
retrieve_proxy_menu_item () | |
set_expand (expand) | |
set_homogeneous (homogeneous) | |
set_is_important (is_important) | |
set_proxy_menu_item (menu_item_id, menu_item) | |
set_tooltip_markup (markup) | |
set_tooltip_text (text) | |
set_use_drag_window (use_drag_window) | |
set_visible_horizontal (visible_horizontal) | |
set_visible_vertical (visible_vertical) | |
toolbar_reconfigured () |
Virtual Methods¶
Inherited:
Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Activatable (2)
do_create_menu_proxy () |
---|
do_toolbar_reconfigured () |
Properties¶
Inherited:
Gtk.Container (3), Gtk.Widget (39), Gtk.Activatable (2)
Name | Type | Flags | Short Description |
---|---|---|---|
is-important | bool | r/w/en | Whether the toolbar item is considered important. When True, toolbar buttons show text in Gtk.ToolbarStyle.BOTH_HORIZ mode |
visible-horizontal | bool | r/w/en | Whether the toolbar item is visible when the toolbar is in a horizontal orientation. |
visible-vertical | bool | r/w/en | Whether the toolbar item is visible when the toolbar is in a vertical orientation. |
Style Properties¶
Inherited:
Signals¶
Inherited:
Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name | Short Description |
---|---|
create-menu-proxy | This signal is emitted when the toolbar needs information from tool_item about whether the item should appear in the toolbar overflow menu. |
toolbar-reconfigured | This signal is emitted when some property of the toolbar that the item is a child of changes. |
Fields¶
Inherited:
Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name | Type | Access | Description |
---|---|---|---|
parent | Gtk.Bin | 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(). 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 Gtk.RadioToolButton classes.
See the Gtk.Toolbar class for a description of the toolbar widget, andGtk.ToolShell for a description of the tool shell interface.
Returns:
the new Gtk.ToolItem
Return type:
Creates a new Gtk.ToolItem
New in version 2.4.
Returns:
a Pango.EllipsizeMode indicating how text in selfshould be ellipsized.
Return type:
Returns the ellipsize mode used for self. Custom subclasses ofGtk.ToolItem should call this function to find out how text should be ellipsized.
New in version 2.20.
Returns:
True if self is allocated extra space.
Return type:
Returns whether self is allocated extra space. See Gtk.ToolItem.set_expand().
New in version 2.4.
Returns:
True if the item is the same size as other homogeneous items.
Return type:
Returns whether self is the same size as other homogeneous items. See Gtk.ToolItem.set_homogeneous().
New in version 2.4.
Returns:
a Gtk.IconSize indicating the icon size used for self
Return type:
Returns the icon size used for self. Custom subclasses ofGtk.ToolItem should call this function to find out what size icons they should use.
New in version 2.4.
Returns:
True if self is considered important.
Return type:
Returns whether self is considered important. SeeGtk.ToolItem.set_is_important()
New in version 2.4.
Returns:
a Gtk.Orientation indicating the orientation used for self
Return type:
Returns the orientation used for self. Custom subclasses ofGtk.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_idsmatch.
Return type:
Gtk.Widget or None
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 to update their menu item when the Gtk.ToolItem changes. That themenu_item_ids must match ensures that a Gtk.ToolItemwill not inadvertently change a menu item that they did not create.
New in version 2.4.
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 of Gtk.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.
Returns:
a float indicating the horizontal text alignment used for self
Return type:
Returns the text alignment used for self. Custom subclasses ofGtk.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 ofGtk.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.
Returns:
A Gtk.ToolbarStyle indicating the toolbar style used for self.
Return type:
Returns the toolbar style used for self. Custom subclasses ofGtk.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 accordingly
Possibilities are:
- Gtk.ToolbarStyle.BOTH, meaning the tool item should show both an icon and a label, stacked vertically
- Gtk.ToolbarStyle.ICONS, meaning the toolbar shows only icons
- Gtk.ToolbarStyle.TEXT, meaning the tool item should only show text
- Gtk.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:
True if self uses a drag window.
Return type:
Returns whether self has a drag window. SeeGtk.ToolItem.set_use_drag_window().
New in version 2.4.
get_visible_horizontal()[source]¶
Returns:
True if self is visible on toolbars that are docked horizontally.
Return type:
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. the Gtk.MenuItemthat is going to appear in the overflow menu.
New in version 2.4.
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.ToolButtonclass uses this property to determine whether to show or hide its label when the toolbar style is Gtk.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_item
- menu_item (Gtk.Widget or None) – a Gtk.MenuItem to use in the overflow menu, or None
Sets the Gtk.MenuItem used in the toolbar overflow menu. Themenu_item_id is used to identify the caller of this function and should also be used with Gtk.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 through Gtk.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 other Gtk.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 other Gtk.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:
True if the signal was handled, False if not
Return type:
This signal is emitted when the toolbar needs information from tool_itemabout 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 a Nonepointer and return True to indicate that the item should not appear in the overflow menu
- call Gtk.ToolItem.set_proxy_menu_item() with a new menu item and return True, or
- return 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 functions
- Gtk.ToolShell.get_orientation()
- Gtk.ToolShell.get_style()
- Gtk.ToolShell.get_icon_size()
- Gtk.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:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Whether the toolbar item is considered important. When True, toolbar buttons show text in Gtk.ToolbarStyle.BOTH_HORIZ mode
Gtk.ToolItem.props.visible_horizontal¶
Name:
visible-horizontal
Type:
Default Value:
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Whether the toolbar item is visible when the toolbar is in a horizontal orientation.
Gtk.ToolItem.props.visible_vertical¶
Name:
visible-vertical
Type:
Default Value:
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Whether the toolbar item is visible when the toolbar is in a vertical orientation.