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

STYLE PROPERTIES

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

SIGNALS

137       activate (Gtk2::MenuItem)
138       activate-item (Gtk2::MenuItem)
139       toggle-size-allocate (Gtk2::MenuItem, integer)
140       toggle-size-request (Gtk2::MenuItem, gpointer)
141

SEE ALSO

143       Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
144       Gtk2::Container, Gtk2::Bin, Gtk2::Item
145
147       Copyright (C) 2003-2011 by the gtk2-perl team.
148
149       This software is licensed under the LGPL.  See Gtk2 for a full notice.
150
151
152
153perl v5.36.0                      2022-07-22                 Gtk2::MenuItem(3)
Impressum