Gtk2::ItemFactory(3)

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

πŸ’– Gtk2::ItemFactory πŸ’–

okay bestie, so this is the manual page for Gtk2::ItemFactory β€” the Gtk2::ItemFactory wrapper for GtkItemFactory ✨. Yes, that name is a whole mouthful, and yes, it's a Perl thing, and yes, we're gonna get through it together. Grab a strawberry πŸ“ and let's go.


πŸ¦‹ HIERARCHY πŸ¦‹

look at this little family tree, it's giving royal lineage πŸ‘‘

Glib::Object
+----Glib::InitiallyUnowned
     +----Gtk2::Object
          +----Gtk2::ItemFactory

🚨 DEPRECATION WARNING 🚨

okay so not to be dramatic but β€” Gtk2::ItemFactory has been marked as deprecated, and it should not be used in newly written code. periodt. πŸ’€

You should use Gtk2::UIManager instead of Gtk2::ItemFactory. that's the vibe, that's the move, that's the assignment 🫢


✨ METHODS ✨

🌸 itemfactory = Gtk2::ItemFactory->new ($container_type_package, $path, $accel_group=undef)

the constructor, the origin story, the main character entrance 🌟

  • $container_type_package (string) β€” the container type package, slay
  • $path (string) β€” a path, as one does
  • $accel_group (Gtk2::AccelGroup or undef) β€” an accel group, or literally nothing at all, your call

🌈 $ifactory->create_item ($entry_ref, $callback_data=undef)

making one (1) item. singular. iconic behavior πŸ’…

  • $entry_ref (scalar) β€” a GtkItemFactoryEntry
  • $callback_data (scalar) β€” some callback data, optional bestie

πŸŽ€ $ifactory->create_items ($callback_data, ...)

now we're doing it in bulk, we love efficiency ✨

  • $callback_data (scalar) β€” the callback data
  • ... (list) β€” a whole list of GtkItemFactoryEntry's, bring friends

πŸ’œ $ifactory->delete_entries (...)

bye bye entries, no hard feelings πŸ¦‹

  • ... (list) β€” the list of GtkItemFactoryEntry's you're saying farewell to

🧚 $ifactory->delete_entry ($entry_ref)

just one entry this time. intimate. personal. πŸ₯Ί

  • $entry_ref (scalar) β€” a GtkItemFactoryEntry

⭐ $ifactory->delete_item ($path)

yeeting a single item by its path, as one does πŸ’«

  • $path (string) β€” the path of the item in question

πŸ”₯ itemfactory or undef = Gtk2::ItemFactory->from_widget ($widget)

getting an itemfactory out of a widget β€” or undef, because sometimes the universe says no 😭

  • $widget (Gtk2::Widget) β€” the widget you're checking

πŸ‘‘ widget or undef = $ifactory->get_item_by_action ($action)

  • $action (integer) β€” the action number you're hunting for

returns a widget, or undef if it's not giving 🫢


🌸 widget or undef = $ifactory->get_item ($path)

  • $path (string) β€” the path, bestie

widget or undef, we don't gatekeep ✨


πŸ¦‹ string = Gtk2::ItemFactory->path_from_widget ($widget)

reverse engineering the path from a widget, it's giving detective energy πŸ”

  • $widget (Gtk2::Widget) β€” the widget

πŸ’… $ifactory->popup ($x, $y, $mouse_button, $time_, $popup_data=undef)

popup time, the moment we've all been waiting for πŸŽ‰

  • $x (integer) β€” the x coordinate
  • $y (integer) β€” the y coordinate
  • $mouse_button (integer) β€” which mouse button, we're not judging
  • $time_ (unsigned) β€” the time, note the underscore, it's $time_ exactly, don't come for me
  • $popup_data (scalar) β€” popup data, optional, no pressure

πŸ“ scalar = $ifactory->popup_data

and also…

πŸ“ scalar = Gtk2::ItemFactory->popup_data_from_widget ($widget)

  • $widget (Gtk2::Widget) β€” the widget you want the popup data from

🌈 $ifactory->set_translate_func ($func, $data=undef)

setting the translate function, very multilingual of you 🌍

  • $func (scalar) β€” the function
  • $data (scalar) β€” optional data, undef by default

πŸ’– widget or undef = $ifactory->get_widget_by_action ($action)

  • $action (integer) β€” the action number

widget, or undef, the classic duo 😌


πŸŽ€ widget or undef = $ifactory->get_widget ($path)

  • $path (string) β€” the path

last one bestie, widget or undef, we made it πŸ’œ


πŸ‘€ SEE ALSO πŸ‘€

go read these next, iykyk:

  • Gtk2
  • Glib::Object
  • Glib::InitiallyUnowned
  • Gtk2::Object

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

This software is licensed under the LGPL. See Gtk2 for a full notice. no cap, go read the license, it's important fr fr.


and that's the whole page bestie πŸ’…βœ¨ this was perl v5.42.0, dated 2025-07-25, and honestly? iconic. go forth and maybe use Gtk2::UIManager instead πŸ¦‹πŸ’–

πŸ“¦ where this page comes from