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:


Signals:

  • “create-menu-proxy” (tool_item, user_data)

Description:

Gtk.ToolItems 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 if tool_itemis 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().Whentool_itemhas a drag window it will intercept all events,even those that would otherwise be sent to a child oftool_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 if tool_itemuses 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 if tool_itemis 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_itemis visible when the toolbar is docked vertically

  • Since: 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 if tool_itemis 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_itemshould 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 for tool_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 for tool_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 usedfor tool_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 ofGtk.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 usedfor tool_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 for tool_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.MenuItemthat is going to appear in the overflow menu.

  • Returns: The Gtk.MenuItem that is going to appear in theoverflow menu for tool_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.ToolItemwill not inadvertently change a menu item that they did not create.

  • Returns: The Gtk.MenuItem passed toGtk.ToolItem:set_proxy_menu_item(), if the menu_item_idsmatch.

  • 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


results matching ""

    No results matching ""