1Gtk2::Menu(3)         User Contributed Perl Documentation        Gtk2::Menu(3)
2
3
4

NAME

6       Gtk2::Menu - wrapper for GtkMenu
7

HIERARCHY

9         Glib::Object
10         +----Glib::InitiallyUnowned
11              +----Gtk2::Object
12                   +----Gtk2::Widget
13                        +----Gtk2::Container
14                             +----Gtk2::MenuShell
15                                  +----Gtk2::Menu
16

INTERFACES

18         Glib::Object::_Unregistered::AtkImplementorIface
19         Gtk2::Buildable
20

METHODS

22   widget = Gtk2::Menu->new
23   accelgroup = $menu->get_accel_group
24   $menu->set_accel_group ($accel_group)
25       ·   $accel_group (Gtk2::AccelGroup)
26
27   string = $menu->get_accel_path
28       Since: gtk+ 2.14
29
30   $menu->set_accel_path ($accel_path)
31       ·   $accel_path (string)
32
33   widget = $menu->get_active
34   $menu->set_active ($index)
35       ·   $index (integer)
36
37   $menu->attach ($child, $left_attach, $right_attach, $top_attach,
38       $bottom_attach)
39       ·   $child (Gtk2::Widget)
40
41       ·   $left_attach (integer)
42
43       ·   $right_attach (integer)
44
45       ·   $top_attach (integer)
46
47       ·   $bottom_attach (integer)
48
49       Since: gtk+ 2.4
50
51   $menu->attach_to_widget ($attach_widget, $detach_func)
52       ·   $attach_widget (Gtk2::Widget)
53
54       ·   $detach_func (scalar)
55
56       Attach $menu to $attach_widget.  $menu must not be currently attached
57       to any other widget, including not a submenu of a "Gtk2::MenuItem".
58
59       If $menu is later detached from the widget with "$menu->detach" then
60       the $detach_func is called as
61
62           &$detach_func ($attach_widget, $menu)
63
64   widget = $menu->get_attach_widget
65   $menu->detach
66   list = Gtk2::Menu->get_for_attach_widget ($widget)
67       ·   $widget (Gtk2::Widget)
68
69       Since: gtk+ 2.6
70
71   integer = $menu->get_monitor
72       Since: gtk+ 2.14
73
74   $menu->set_monitor ($monitor_num)
75       ·   $monitor_num (integer)
76
77       Since: gtk+ 2.4
78
79   $menu->popdown
80   $menu->popup ($parent_menu_shell, $parent_menu_item, $menu_pos_func, $data,
81       $button, $activate_time)
82       ·   $parent_menu_shell (Gtk2::Widget or undef)
83
84       ·   $parent_menu_item (Gtk2::Widget or undef)
85
86       ·   $menu_pos_func (scalar)
87
88       ·   $data (scalar)
89
90       ·   $button (integer)
91
92       ·   $activate_time (integer)
93
94       If $menu_pos_func is not "undef" it's called as
95
96           ($x, $y, $push_in) = &$menu_pos_func ($menu, $x, $y, $data)
97
98       $x,$y inputs are a proposed position based on the mouse pointer (not
99       actually documented in the Gtk manuals).  The return should be a
100       desired $x,$y, and an optional $push_in flag.  If $push_in is true then
101       Gtk will adjust $x,$y if necessary so the menu is fully visible in the
102       screen width and height.
103
104       $menu_pos_func and $data are stored in $menu and may be called again
105       later for a "$menu->reposition" or some obscure things like a changed
106       "set_screen" while torn-off.  A further "$menu->popup" call replaces
107       $menu_pos_func and $data.
108
109   $menu->reorder_child ($child, $position)
110       ·   $child (Gtk2::Widget)
111
112       ·   $position (integer)
113
114   $menu->reposition
115   boolean = $menu->get_reserve_toggle_size
116       Since: gtk+ 2.18
117
118   $menu->set_reserve_toggle_size ($reserve_toggle_size)
119       ·   $reserve_toggle_size (boolean)
120
121       Since: gtk+ 2.18
122
123   $menu->set_screen ($screen)
124       ·   $screen (Gtk2::Gdk::Screen or undef)
125
126       Since: gtk+ 2.2
127
128   boolean = $menu->get_tearoff_state
129   $menu->set_tearoff_state ($torn_off)
130       ·   $torn_off (boolean)
131
132   string = $menu->get_title
133   $menu->set_title ($title)
134       ·   $title (string)
135

PROPERTIES

137       'accel-group' (Gtk2::AccelGroup : default undef : readable / writable /
138       private)
139           The accel group holding accelerators for the menu
140
141       'accel-path' (string : default undef : readable / writable / private)
142           An accel path used to conveniently construct accel paths of child
143           items
144
145       'active' (integer : default -1 : readable / writable / private)
146           The currently selected menu item
147
148       'attach-widget' (Gtk2::Widget : default undef : readable / writable /
149       private)
150           The widget the menu is attached to
151
152       'monitor' (integer : default -1 : readable / writable / private)
153           The monitor the menu will be popped up on
154
155       'reserve-toggle-size' (boolean : default true : readable / writable /
156       private)
157           A boolean that indicates whether the menu reserves space for
158           toggles and icons
159
160       'tearoff-state' (boolean : default false : readable / writable /
161       private)
162           A boolean that indicates whether the menu is torn-off
163
164       'tearoff-title' (string : default undef : readable / writable /
165       private)
166           A title that may be displayed by the window manager when this menu
167           is torn-off
168

CHILD PROPERTIES

170       'bottom-attach' (integer : default -1 : readable / writable / private)
171           The row number to attach the bottom of the child to
172
173       'left-attach' (integer : default -1 : readable / writable / private)
174           The column number to attach the left side of the child to
175
176       'right-attach' (integer : default -1 : readable / writable / private)
177           The column number to attach the right side of the child to
178
179       'top-attach' (integer : default -1 : readable / writable / private)
180           The row number to attach the top of the child to
181

STYLE PROPERTIES

183       'arrow-placement' (Gtk2::ArrowPlacement : default "both" : readable /
184       private)
185           Indicates where scroll arrows should be placed
186
187       'arrow-scaling' (float : default 0.7 : readable / private)
188           Arbitrary constant to scale down the size of the scroll arrow
189
190       'double-arrows' (boolean : default true : readable / private)
191           When scrolling, always show both arrows.
192
193       'horizontal-offset' (integer : default -2 : readable / private)
194           When the menu is a submenu, position it this number of pixels
195           offset horizontally
196
197       'horizontal-padding' (integer : default 0 : readable / private)
198           Extra space at the left and right edges of the menu
199
200       'vertical-offset' (integer : default 0 : readable / private)
201           When the menu is a submenu, position it this number of pixels
202           offset vertically
203
204       'vertical-padding' (integer : default 1 : readable / private)
205           Extra space at the top and bottom of the menu
206

SIGNALS

208       move-scroll (Gtk2::Menu, Gtk2::ScrollType)
209

ENUMS AND FLAGS

211   enum Gtk2::ScrollType
212       ·   'none' / 'GTK_SCROLL_NONE'
213
214       ·   'jump' / 'GTK_SCROLL_JUMP'
215
216       ·   'step-backward' / 'GTK_SCROLL_STEP_BACKWARD'
217
218       ·   'step-forward' / 'GTK_SCROLL_STEP_FORWARD'
219
220       ·   'page-backward' / 'GTK_SCROLL_PAGE_BACKWARD'
221
222       ·   'page-forward' / 'GTK_SCROLL_PAGE_FORWARD'
223
224       ·   'step-up' / 'GTK_SCROLL_STEP_UP'
225
226       ·   'step-down' / 'GTK_SCROLL_STEP_DOWN'
227
228       ·   'page-up' / 'GTK_SCROLL_PAGE_UP'
229
230       ·   'page-down' / 'GTK_SCROLL_PAGE_DOWN'
231
232       ·   'step-left' / 'GTK_SCROLL_STEP_LEFT'
233
234       ·   'step-right' / 'GTK_SCROLL_STEP_RIGHT'
235
236       ·   'page-left' / 'GTK_SCROLL_PAGE_LEFT'
237
238       ·   'page-right' / 'GTK_SCROLL_PAGE_RIGHT'
239
240       ·   'start' / 'GTK_SCROLL_START'
241
242       ·   'end' / 'GTK_SCROLL_END'
243

SEE ALSO

245       Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
246       Gtk2::Container, Gtk2::MenuShell
247
249       Copyright (C) 2003-2011 by the gtk2-perl team.
250
251       This software is licensed under the LGPL.  See Gtk2 for a full notice.
252
253
254
255perl v5.28.0                      2018-07-18                     Gtk2::Menu(3)
Impressum