Gtk2::ItemFactory(3)
π 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) β aGtkItemFactoryEntry$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 ofGtkItemFactoryEntry's, bring friends
π $ifactory->delete_entries (...)
bye bye entries, no hard feelings π¦
...(list) β the list ofGtkItemFactoryEntry's you're saying farewell to
π§ $ifactory->delete_entry ($entry_ref)
just one entry this time. intimate. personal. π₯Ί
$entry_ref(scalar) β aGtkItemFactoryEntry
β $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,undefby 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:
Gtk2Glib::ObjectGlib::InitiallyUnownedGtk2::Object
π COPYRIGHT π
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
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms