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

NAME

6       Gtk2::MenuItem - wrapper for GtkMenuItem
7

DESCRIPTION

9       If a MenuItem is created with a $label string, or if the "label"
10       property is set later, then it should be destroyed with
11       "$item->destroy".  Just dropping the last Perl ref is not enough
12       because (as of Gtk through to 2.18) there's a circular reference from
13       the child "Gtk2::AccelLabel" back up to the item (the "accel-widget"
14       property).
15
16       When a MenuItem is in a "Gtk2::Menu" a "destroy" happens automatically.
17       Dropping the last ref to a Menu calls "destroy" on its children, as
18       usual for a container.  But if you remove a MenuItem with a label from
19       a menu (or never add it to one) then be sure to "$item->destroy"
20       explicitly.
21

HIERARCHY

23         Glib::Object
24         +----Glib::InitiallyUnowned
25              +----Gtk2::Object
26                   +----Gtk2::Widget
27                        +----Gtk2::Container
28                             +----Gtk2::Bin
29                                  +----Gtk2::Item
30                                       +----Gtk2::MenuItem
31

INTERFACES

33         Glib::Object::_Unregistered::AtkImplementorIface
34         Gtk2::Buildable
35         Gtk2::Activatable
36

METHODS

38   widget = Gtk2::MenuItem->new ($label=undef)
39       ·   $label (string)
40
41       If a $label argument is given then this is "new_with_mnemonic".
42
43   widget = Gtk2::MenuItem->new_with_label ($label=undef)
44       ·   $label (string)
45
46   widget = Gtk2::MenuItem->new_with_mnemonic ($label=undef)
47       ·   $label (string)
48
49   string = $menu_item->get_accel_path
50       Since: gtk+ 2.14
51
52   $menu_item->set_accel_path ($accel_path)
53       ·   $accel_path (string)
54
55   $menu_item->activate
56   $menu_item->deselect
57   string = $menu_item->get_label
58       Since: gtk+ 2.16
59
60   $menu_item->set_label ($label)
61       ·   $label (string)
62
63       Since: gtk+ 2.16
64
65   $menu_item->remove_submenu
66   boolean = $menu_item->get_right_justified
67   $menu_item->set_right_justified ($right_justified)
68       ·   $right_justified (boolean)
69
70   $menu_item->select
71   widget or undef = $menu_item->get_submenu
72   $menu_item->set_submenu ($submenu)
73       ·   $submenu (Gtk2::Widget or undef)
74
75   $menu_item->toggle_size_allocate ($allocation)
76       ·   $allocation (integer)
77
78   requisition = $menu_item->toggle_size_request
79   boolean = $menu_item->get_use_underline
80       Since: gtk+ 2.16
81
82   $menu_item->set_use_underline ($use_underline)
83       ·   $use_underline (boolean)
84
85       Since: gtk+ 2.16
86

PROPERTIES

88       'accel-path' (string : default undef : readable / writable / private)
89           Sets the accelerator path of the menu item
90
91       'label' (string : default "" : readable / writable / private)
92           The text for the child label
93
94       'right-justified' (boolean : default false : readable / writable /
95       private)
96           Sets whether the menu item appears justified at the right side of a
97           menu bar
98
99       'submenu' (Gtk2::Menu : default undef : readable / writable / private)
100           The submenu attached to the menu item, or NULL if it has none
101
102       'use-underline' (boolean : default false : readable / writable /
103       private)
104           If set, an underline in the text indicates the next character
105           should be used for the mnemonic accelerator key
106

STYLE PROPERTIES

108       'arrow-scaling' (float : default 0.8 : readable / private)
109           Amount of space used up by arrow, relative to the menu item's font
110           size
111
112       'arrow-spacing' (integer : default 10 : readable / private)
113           Space between label and arrow
114
115       'horizontal-padding' (integer : default 3 : readable / private)
116           Padding to left and right of the menu item
117
118       'selected-shadow-type' (Gtk2::ShadowType : default "none" : readable /
119       private)
120           Shadow type when item is selected
121
122       'toggle-spacing' (integer : default 5 : readable / private)
123           Space between icon and label
124
125       'width-chars' (integer : default 12 : readable / private)
126           The minimum desired width of the menu item in characters
127

SIGNALS

129       activate (Gtk2::MenuItem)
130       activate-item (Gtk2::MenuItem)
131       toggle-size-allocate (Gtk2::MenuItem, integer)
132       toggle-size-request (Gtk2::MenuItem, gpointer)
133

SEE ALSO

135       Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
136       Gtk2::Container, Gtk2::Bin, Gtk2::Item
137
139       Copyright (C) 2003-2011 by the gtk2-perl team.
140
141       This software is licensed under the LGPL.  See Gtk2 for a full notice.
142
143
144
145perl v5.30.0                      2019-07-26                 Gtk2::MenuItem(3)
Impressum