1Gtk2::Ex::FormFactory::UMseenru(C3o)ntributed Perl DocumGetnkt2a:t:iEoxn::FormFactory::Menu(3)
2
3
4

NAME

6       Gtk2::Ex::FormFactory::Menu - A Menu in a FormFactory framework
7

SYNOPSIS

9         Gtk2::Ex::FormFactory::Menu->new (
10           menu_tree        => Hierarchical definition of the Menu,
11           default_callback => Default callback for menu items,
12           user_data        => User data for the default callback,
13           ...
14           Gtk2::Ex::FormFactory::Widget attributes
15         );
16

DESCRIPTION

18       This class implements a Menu in a Gtk2::Ex::FormFactory framework and
19       pretty much wraps Gtk2::Ex::Simple::Menu. No application object
20       attributes are associated with a Menu as a whole.
21
22       But you may associate single Menu entries with an object. This way the
23       correspondent entries will set insensitive automatically if the
24       underlying object is undef and vice versa are activated once the object
25       is defined.
26

OBJECT HIERARCHY

28         Gtk2::Ex::FormFactory::Intro
29
30         Gtk2::Ex::FormFactory::Widget
31         +--- Gtk2::Ex::FormFactory::Menu
32
33         Gtk2::Ex::FormFactory::Layout
34         Gtk2::Ex::FormFactory::Rules
35         Gtk2::Ex::FormFactory::Context
36         Gtk2::Ex::FormFactory::Proxy
37

ATTRIBUTES

39       Attributes are handled through the common get_ATTR(), set_ATTR() style
40       accessors, but they are mostly passed once to the object constructor
41       and must not be altered after the associated FormFactory was built.
42
43       menu_tree = ARRAYREF [mandatory]
44           This is a slightly extended menu tree definition in terms of
45           Gtk2::Ex::Simple::Menu. You may optionally associate each entry
46           with an application object by specifying its name with the object
47           key in the item definition hash. This way the item is active only
48           if the correspondent object is defined.
49
50           As well you can control widget activity more detailed using the
51           active_cond and active_depends keys as described in the
52           Gtk2::Ex::FormFactory::Widget manpage.
53
54           A short example. This is a File menu where the 'Save' and 'Close'
55           entries are sensitive only if a file was opened. We presume that
56           opening a file sets the 'worksheet' object, which is registered
57           with this name to the Context of the associated FormFactory.
58           Additionally the 'Manage rows' entry is active only if more than
59           three rows are selected:
60
61             $menu_tree = [
62               _File => {
63                 item_type => <Branch>',
64                 children  => [
65                   _Open  => {
66                     callback => \&open_worksheet,
67                                 # sets the 'worksheet' object
68                   },
69                   _Save => {
70                     callback => \&save_worksheet,
71                     object   => 'worksheet',
72                   },
73                   _Close => {
74                     callback => \&close_worksheet,
75                     object   => 'worksheet',
76                   },
77                   "_Manage rows" => {
78                     callback       => \&manage_rows,
79                     object         => 'worksheet',
80                     active_cond    => sub { $worksheet->get_selected_rows_cnt > 3 },
81                     active_depends => "worksheet.rows",
82                 ],
83               },
84             ];
85
86       default_callback = CODEREF [optional]
87           The default callback of this menu. Refer to Gtk2::Ex::Simple::Menu
88           for details.
89
90       user_data = SCALAR [optional]
91           User data of the default callback of this menu. Refer to
92           Gtk2::Ex::Simple::Menu for details.
93
94       For more attributes refer to Gtk2::Ex::FormFactory::Widget.
95

AUTHORS

97        Jörn Reder <joern at zyn dot de>
98
100       Copyright 2004-2006 by Jörn Reder.
101
102       This library is free software; you can redistribute it and/or modify it
103       under the terms of the GNU Library General Public License as published
104       by the Free Software Foundation; either version 2.1 of the License, or
105       (at your option) any later version.
106
107       This library is distributed in the hope that it will be useful, but
108       WITHOUT ANY WARRANTY; without even the implied warranty of
109       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
110       Library General Public License for more details.
111
112       You should have received a copy of the GNU Library General Public
113       License along with this library; if not, write to the Free Software
114       Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307
115       USA.
116

POD ERRORS

118       Hey! The above document had some coding errors, which are explained
119       below:
120
121       Around line 215:
122           Non-ASCII character seen before =encoding in 'Jörn'. Assuming UTF-8
123
124
125
126perl v5.32.0                      2020-07-28    Gtk2::Ex::FormFactory::Menu(3)
Impressum