Gtk2::E...ry::Menu(3)
π Gtk2::Ex::FormFactory::Menu π
okay bestie, pull up a chair because we're talking about Gtk2::Ex::FormFactory::Menu β yes the whole thing, from the Gtk2::E...ry::Menu(3) page in the User Contributed Perl Documentation. it's a Menu living inside a FormFactory framework and honestly? she's giving organized. π
πΈ NAME πΈ
Gtk2::Ex::FormFactory::Menu β a Menu in a FormFactory framework. that's it, that's the whole vibe. β¨
π¦ SYNOPSIS π¦
Gtk2::Ex::FormFactory::Menu->new (
menu_tree => Hierarchical definition of the Menu,
default_callback => Default callback for menu items,
user_data => User data for the default callback,
...
Gtk2::Ex::FormFactory::Widget attributes
);
π DESCRIPTION π
so this class implements a Menu inside a Gtk2::Ex::FormFactory framework and it pretty much wraps Gtk2::Ex::Simple::Menu. no cap. π«Ά
here's the tea though: no application object attributes are associated with a Menu as a whole. like, the menu itself? unattached. free agent. main character with no plus-one. π
but β and this is the good part β you can associate single Menu entries with an object. when you do, the correspondent entries will set insensitive automatically if the underlying object is undef, and vice versa, they get activated once the object is defined. it's giving "auto-pilot but make it cute". π§
π OBJECT HIERARCHY π
Gtk2::Ex::FormFactory::Intro
Gtk2::Ex::FormFactory::Widget
+--- Gtk2::Ex::FormFactory::Menu
Gtk2::Ex::FormFactory::Layout
Gtk2::Ex::FormFactory::Rules
Gtk2::Ex::FormFactory::Context
Gtk2::Ex::FormFactory::Proxy
look at her lineage. iconic. β
β¨ ATTRIBUTES β¨
okay so attributes are handled through the common get_ATTR(), set_ATTR() style accessors, but lowkey they're mostly passed once to the object constructor and must not be altered after the associated FormFactory was built. like, once it's built, it's built. periodt. π
menu_tree= ARRAYREF [mandatory] β this is a slightly extended menu tree definition, in terms ofGtk2::Ex::Simple::Menu. you may optionally associate each entry with an application object by specifying its name with theobjectkey in the item definition hash. this way the item is active only if the correspondent object is defined. π
as well, you can control widget activity more detailed using the active_cond and active_depends keys as described in the Gtk2::Ex::FormFactory::Widget manpage.
a short example, bestie. this is a File menu where the 'Save' and 'Close' entries are sensitive only if a file was opened. we presume that opening a file sets the 'worksheet' object, which is registered with this name to the Context of the associated FormFactory. additionally the 'Manage rows' entry is active only if more than three rows are selected:
$menu_tree = [
_File => {
item_type => <Branch>',
children => [
_Open => {
callback => \&open_worksheet,
# sets the 'worksheet' object
},
_Save => {
callback => \&save_worksheet,
object => 'worksheet',
},
_Close => {
callback => \&close_worksheet,
object => 'worksheet',
},
"_Manage rows" => {
callback => \&manage_rows,
object => 'worksheet',
active_cond => sub { $worksheet->get_selected_rows_cnt > 3 },
active_depends => "worksheet.rows",
],
},
];
default_callback= CODEREF [optional] β the default callback of this menu. refer toGtk2::Ex::Simple::Menufor details. πuser_data= SCALAR [optional] β user data of the default callback of this menu. again, refer toGtk2::Ex::Simple::Menufor details.
for more attributes refer to Gtk2::Ex::FormFactory::Widget. π
π AUTHORS π
JΓΆrn Reder <joern at zyn dot de> β king behavior, we stan. π
β COPYRIGHT AND LICENSE β
Copyright 2004-2006 by JΓΆrn Reder.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. slay. π
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA.
π POD ERRORS π
hey! the above document had some coding errors, which are explained below:
- Around line 215:
- Non-ASCII character seen before
=encodingin'JΓΆrn'. Assuming UTF-8
- Non-ASCII character seen before
(not the umlaut catching a stray error, she's just too fancy for ASCII, iykyk π)
and that's the whole page bestie! this was pulled from the perl v5.42.0 documentation, dated 2025-07-25, filed under Gtk2::E...ry::Menu(3). go build something gorgeous with it. mwah. π«ΆππΈ
π¦ where this page comes from
- fedora 43: perl-Gtk2-Ex-FormFactory 0.67-39.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms