Gtk2::ToolItem(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– Gtk2::ToolItem β€” the manual, but make it make sense πŸ’–

okay so bestie, welcome to Gtk2::ToolItem ✨ this is the Perl wrapper for GtkToolItem β€” the little base-class baddie that every toolbar thingy (buttons, separators, whatever) is built on top of. she's the blueprint, the template, the main character that other tool items inherit their whole vibe from πŸŽ€


🌸 HIERARCHY 🌸

so the family tree is giving royalty, and here's exactly how she descends:

Glib::Object
+----Glib::InitiallyUnowned
     +----Gtk2::Object
          +----Gtk2::Widget
               +----Gtk2::Container
                    +----Gtk2::Bin
                         +----Gtk2::ToolItem

like, she's deep in the lineage, but she knows exactly who she is πŸ’…


πŸ¦‹ INTERFACES πŸ¦‹

these are the interfaces she implements, no cap:

  • Glib::Object::_Unregistered::AtkImplementorIface
  • Gtk2::Buildable
  • Gtk2::Activatable

✨ METHODS ✨

🫢 the constructor

toolitem = Gtk2::ToolItem->new

make a fresh one. brand new tool item, fresh out the box, ready to be put on a toolbar. slay.


🌈 ellipsize mode

ellipsizemode = $tool_item->get_ellipsize_mode

grab her ellipsize mode. lowkey only here if you're on a new enough GTK.

Since: gtk+ 2.20

πŸ’« expand

boolean = $tool_item->get_expand

$tool_item->set_expand ($expand)

  • $expand (boolean) β€” true/false, do you want her expanding or not

read it, set it, whatever you need bestie.


πŸ“ homogeneous

boolean = $tool_item->get_homogeneous

$tool_item->set_homogeneous ($homogeneous)

  • $homogeneous (boolean) β€” boolean in, boolean energy out

πŸ‘‘ icon size

iconsize = $tool_item->get_icon_size

returns the icon size. that's it, that's the method. iconic.


πŸ”₯ is it important tho

boolean = $tool_item->get_is_important

$tool_item->set_is_important ($is_important)

  • $is_important (boolean) β€” set it true and she's IMPORTANT, okay?

πŸ’œ orientation

orientation = $tool_item->get_orientation

which way is she facing? get the orientation and find out.


πŸŽ€ proxy menu items

widget = $tool_item->get_proxy_menu_item ($menu_item_id)

  • $menu_item_id (string) β€” the id you're looking up

hands you back the widget for that menu item id.

$tool_item->set_proxy_menu_item ($menu_item_id, $menu_item)

  • $menu_item_id (string)
  • $menu_item (Gtk2::Widget or undef)

set the proxy menu item β€” and yes, undef is allowed, no judgement 🫢


🌸 rebuild that menu

$tool_item->rebuild_menu

Since: gtk+ 2.6

⭐ relief style

reliefstyle = $tool_item->get_relief_style

returns the relief style. very chill, very calm, very demure.


🧚 retrieve the proxy menu item

widget = $tool_item->retrieve_proxy_menu_item

gives you the widget back. no arguments, just vibes.


πŸ’– text alignment

double = $tool_item->get_text_alignment

Since: gtk+ 2.20

returns a double, so precise bestie ✨


🌈 text orientation

orientation = $tool_item->get_text_orientation

Since: gtk+ 2.20

πŸ’… text size group

sizegroup = $tool_item->get_text_size_group

Since: gtk+ 2.20

πŸ”₯ toolbar reconfigured

$tool_item->toolbar_reconfigured

Since: gtk+ 2.14

something changed on the toolbar and she needs to know. this is her little heads-up.


πŸ‘‘ toolbar style

toolbarstyle = $tool_item->get_toolbar_style

returns the style of the toolbar. periodt.


πŸ¦‹ tooltips, the markup way

$tool_item->set_tooltip_markup ($markup)

  • $markup (string or undef)
Since: gtk+ 2.12

yes undef is fine, no cap.


πŸŽ€ tooltips, the old-school way

$tool_item->set_tooltip ($tooltips, $tip_text, $tip_private)

  • $tooltips (Gtk2::Tooltips)
  • $tip_text (string)
  • $tip_private (string)

the classic trio. we love a legacy moment πŸ™ˆ


πŸ’œ tooltips, the plain text way

$tool_item->set_tooltip_text ($text)

  • $text (string or undef)
Since: gtk+ 2.12

🌸 use drag window

boolean = $toolitem->get_use_drag_window

$toolitem->set_use_drag_window ($use_drag_window)

  • $use_drag_window (boolean)
note: these ones are written $toolitem not $tool_item β€” that's literally how the page has it, and we're keeping it exactly as-is, iykyk πŸ’…

⭐ visible horizontal

boolean = $toolitem->get_visible_horizontal

$toolitem->set_visible_horizontal ($visible_horizontal)

  • $visible_horizontal (boolean)

🌈 visible vertical

boolean = $toolitem->get_visible_vertical

$toolitem->set_visible_vertical ($visible_vertical)

  • $visible_vertical (boolean)

πŸ’– PROPERTIES πŸ’–

'is-important' β€” boolean : default false : readable / writable / private / static-nick / static-blurb

whether the toolbar item is considered important. when TRUE, toolbar buttons show text in GTK_TOOLBAR_BOTH_HORIZ mode. so yeah, flipping this actually changes the drip ✨

'visible-horizontal' β€” boolean : default true : readable / writable / private / static-nick / static-blurb

whether the toolbar item is visible when the toolbar is in a horizontal orientation.

'visible-vertical' β€” boolean : default true : readable / writable / private / static-nick / static-blurb

whether the toolbar item is visible when the toolbar is in a vertical orientation.


πŸŽ€ SIGNALS πŸŽ€

  • boolean = create-menu-proxy (Gtk2::ToolItem)
  • boolean = set-tooltip (Gtk2::ToolItem, Gtk2::Tooltips, string, string)
  • toolbar-reconfigured (Gtk2::ToolItem)

πŸ¦‹ ENUMS AND FLAGS πŸ¦‹

enum Gtk2::IconSize

  • 'invalid' / GTK_ICON_SIZE_INVALID
  • 'menu' / GTK_ICON_SIZE_MENU
  • 'small-toolbar' / GTK_ICON_SIZE_SMALL_TOOLBAR
  • 'large-toolbar' / GTK_ICON_SIZE_LARGE_TOOLBAR
  • 'button' / GTK_ICON_SIZE_BUTTON
  • 'dnd' / GTK_ICON_SIZE_DND
  • 'dialog' / GTK_ICON_SIZE_DIALOG

enum Gtk2::Orientation

  • 'horizontal' / GTK_ORIENTATION_HORIZONTAL
  • 'vertical' / GTK_ORIENTATION_VERTICAL

enum Gtk2::ReliefStyle

  • 'normal' / GTK_RELIEF_NORMAL
  • 'half' / GTK_RELIEF_HALF
  • 'none' / GTK_RELIEF_NONE

enum Gtk2::ToolbarStyle

  • 'icons' / GTK_TOOLBAR_ICONS
  • 'text' / GTK_TOOLBAR_TEXT
  • 'both' / GTK_TOOLBAR_BOTH
  • 'both-horiz' / GTK_TOOLBAR_BOTH_HORIZ

enum Pango::EllipsizeMode

  • 'none' / PANGO_ELLIPSIZE_NONE
  • 'start' / PANGO_ELLIPSIZE_START
  • 'middle' / PANGO_ELLIPSIZE_MIDDLE
  • 'end' / PANGO_ELLIPSIZE_END

🌈 SEE ALSO 🌈

go read these next, they're all connected bestie:

Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin


Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


and that's the whole thing, you ate it up fr fr 🫢 this was written by the gtk2-perl girlies back in the day β€” the page itself is from perl v5.42.0, dated 2025-07-25, filed under Gtk2::ToolItem(3). go build something iconic with it πŸ‘‘βœ¨

πŸ“¦ where this page comes from