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

CHILD PROPERTIES

173       'bottom-attach' (integer : default -1 : readable / writable / private /
174       static-nick / static-blurb)
175           The row number to attach the bottom of the child to
176
177       'left-attach' (integer : default -1 : readable / writable / private /
178       static-nick / static-blurb)
179           The column number to attach the left side of the child to
180
181       'right-attach' (integer : default -1 : readable / writable / private /
182       static-nick / static-blurb)
183           The column number to attach the right side of the child to
184
185       'top-attach' (integer : default -1 : readable / writable / private /
186       static-nick / static-blurb)
187           The row number to attach the top of the child to
188

STYLE PROPERTIES

190       'arrow-placement' (Gtk2::ArrowPlacement : default "both" : readable /
191       private / static-nick / static-blurb)
192           Indicates where scroll arrows should be placed
193
194       'arrow-scaling' (float : default 0.7 : readable / private / static-nick
195       / static-blurb)
196           Arbitrary constant to scale down the size of the scroll arrow
197
198       'double-arrows' (boolean : default true : readable / private / static-
199       nick / static-blurb)
200           When scrolling, always show both arrows.
201
202       'horizontal-offset' (integer : default -2 : readable / private /
203       static-nick / static-blurb)
204           When the menu is a submenu, position it this number of pixels
205           offset horizontally
206
207       'horizontal-padding' (integer : default 0 : readable / private /
208       static-nick / static-blurb)
209           Extra space at the left and right edges of the menu
210
211       'vertical-offset' (integer : default 0 : readable / private / static-
212       nick / static-blurb)
213           When the menu is a submenu, position it this number of pixels
214           offset vertically
215
216       'vertical-padding' (integer : default 1 : readable / private / static-
217       nick / static-blurb)
218           Extra space at the top and bottom of the menu
219

SIGNALS

221       move-scroll (Gtk2::Menu, Gtk2::ScrollType)
222

ENUMS AND FLAGS

224   enum Gtk2::ScrollType
225       •   'none' / 'GTK_SCROLL_NONE'
226
227       •   'jump' / 'GTK_SCROLL_JUMP'
228
229       •   'step-backward' / 'GTK_SCROLL_STEP_BACKWARD'
230
231       •   'step-forward' / 'GTK_SCROLL_STEP_FORWARD'
232
233       •   'page-backward' / 'GTK_SCROLL_PAGE_BACKWARD'
234
235       •   'page-forward' / 'GTK_SCROLL_PAGE_FORWARD'
236
237       •   'step-up' / 'GTK_SCROLL_STEP_UP'
238
239       •   'step-down' / 'GTK_SCROLL_STEP_DOWN'
240
241       •   'page-up' / 'GTK_SCROLL_PAGE_UP'
242
243       •   'page-down' / 'GTK_SCROLL_PAGE_DOWN'
244
245       •   'step-left' / 'GTK_SCROLL_STEP_LEFT'
246
247       •   'step-right' / 'GTK_SCROLL_STEP_RIGHT'
248
249       •   'page-left' / 'GTK_SCROLL_PAGE_LEFT'
250
251       •   'page-right' / 'GTK_SCROLL_PAGE_RIGHT'
252
253       •   'start' / 'GTK_SCROLL_START'
254
255       •   'end' / 'GTK_SCROLL_END'
256

SEE ALSO

258       Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
259       Gtk2::Container, Gtk2::MenuShell
260
262       Copyright (C) 2003-2011 by the gtk2-perl team.
263
264       This software is licensed under the LGPL.  See Gtk2 for a full notice.
265
266
267
268perl v5.34.0                      2022-01-21                     Gtk2::Menu(3)
Impressum