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

NAME

6       Gtk2::Button - wrapper for GtkButton
7

HIERARCHY

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

INTERFACES

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

MNEMONICS

23       Mnemonics are "memory aids"; in GTK+, a mnemonic is an underlined
24       character which corresponds to a keyboard accelerator.  For a button,
25       that means pressing Alt and that key activates the button.
26
27       For convenience, Gtk2-Perl uses mnemonics by default on widgets that
28       support them.  If characters in label string are preceded by an
29       underscore, they are underlined.  If you need a literal underscore
30       character in a label, use '__' (two underscores).  If you don't want to
31       use mnemonics at all, use the non-mnemonic version explicitly (e.g.
32       "Gtk2::Button::new_with_label").
33

METHODS

35   widget = Gtk2::Button->new
36   widget = Gtk2::Button->new ($mnemonic)
37       ·   $mnemonic (string) used to label the widget, see "MNEMONICS"
38
39   widget = Gtk2::Button->new_from_stock ($stock_id)
40       ·   $stock_id (string) creates a new button using the icon and text
41           from the
42
43       specified stock item, see Gtk2::Stock
44
45   widget = Gtk2::Button->new_with_label ($label)
46       ·   $label (string) used to label the widget
47
48   widget = Gtk2::Button->new_with_mnemonic ($mnemonic)
49       ·   $mnemonic (string) used to label the widget, see "MNEMONICS"
50
51   (xalign, yalign) = $button->get_alignment
52       Since: gtk+ 2.4
53
54   $button->set_alignment ($xalign, $yalign)
55       ·   $xalign (double)
56
57       ·   $yalign (double)
58
59       Since: gtk+ 2.4
60
61   $button->clicked
62   $button->enter
63   window or undef = $button->get_event_window
64       Since: gtk+ 2.22
65
66   boolean = $button->get_focus_on_click
67       Since: gtk+ 2.4
68
69   $button->set_focus_on_click ($focus_on_click)
70       ·   $focus_on_click (boolean)
71
72       Since: gtk+ 2.4
73
74   widget or undef = $button->get_image
75       Since: gtk+ 2.6
76
77   positiontype = $button->get_image_position
78       Since: gtk+ 2.10
79
80   $button->set_image_position ($position)
81       ·   $position (Gtk2::PositionType)
82
83       Since: gtk+ 2.10
84
85   $button->set_image ($image)
86       ·   $image (Gtk2::Widget or undef)
87
88       Since: gtk+ 2.6
89
90   string = $button->get_label
91   $button->set_label ($label)
92       ·   $label (string)
93
94   $button->leave
95   $button->pressed
96   $button->released
97   reliefstyle = $button->get_relief
98   $button->set_relief ($newstyle)
99       ·   $newstyle (Gtk2::ReliefStyle)
100
101   boolean = $button->get_use_stock
102   $button->set_use_stock ($use_stock)
103       ·   $use_stock (boolean)
104
105   boolean = $button->get_use_underline
106   $button->set_use_underline ($use_underline)
107       ·   $use_underline (boolean)
108

PROPERTIES

110       'focus-on-click' (boolean : default true : readable / writable /
111       private / static-nick / static-blurb)
112           Whether the button grabs focus when it is clicked with the mouse
113
114       'image' (Gtk2::Widget : default undef : readable / writable / private /
115       static-nick / static-blurb)
116           Child widget to appear next to the button text
117
118       'image-position' (Gtk2::PositionType : default "left" : readable /
119       writable / private / static-nick / static-blurb)
120           The position of the image relative to the text
121
122       'label' (string : default undef : readable / writable / construct /
123       private / static-nick / static-blurb)
124           Text of the label widget inside the button, if the button contains
125           a label widget
126
127       'relief' (Gtk2::ReliefStyle : default "normal" : readable / writable /
128       private / static-nick / static-blurb)
129           The border relief style
130
131       'use-stock' (boolean : default false : readable / writable / construct
132       / private / static-nick / static-blurb)
133           If set, the label is used to pick a stock item instead of being
134           displayed
135
136       'use-underline' (boolean : default false : readable / writable /
137       construct / private / static-nick / static-blurb)
138           If set, an underline in the text indicates the next character
139           should be used for the mnemonic accelerator key
140
141       'xalign' (float : default 0.5 : readable / writable / private / static-
142       nick / static-blurb)
143           Horizontal position of child in available space. 0.0 is left
144           aligned, 1.0 is right aligned
145
146       'yalign' (float : default 0.5 : readable / writable / private / static-
147       nick / static-blurb)
148           Vertical position of child in available space. 0.0 is top aligned,
149           1.0 is bottom aligned
150

STYLE PROPERTIES

152       'child-displacement-x' (integer : default 0 : readable / private /
153       static-nick / static-blurb)
154           How far in the x direction to move the child when the button is
155           depressed
156
157       'child-displacement-y' (integer : default 0 : readable / private /
158       static-nick / static-blurb)
159           How far in the y direction to move the child when the button is
160           depressed
161
162       'default-border' (Gtk2::Border : default undef : readable / private /
163       static-nick / static-blurb)
164           Extra space to add for GTK_CAN_DEFAULT buttons
165
166       'default-outside-border' (Gtk2::Border : default undef : readable /
167       private / static-nick / static-blurb)
168           Extra space to add for GTK_CAN_DEFAULT buttons that is always drawn
169           outside the border
170
171       'displace-focus' (boolean : default false : readable / private /
172       static-nick / static-blurb)
173           Whether the child_displacement_x/_y properties should also affect
174           the focus rectangle
175
176       'image-spacing' (integer : default 2 : readable / private / static-nick
177       / static-blurb)
178           Spacing in pixels between the image and label
179
180       'inner-border' (Gtk2::Border : default undef : readable / private /
181       static-nick / static-blurb)
182           Border between button edges and child.
183

SIGNALS

185       activate (Gtk2::Button)
186       clicked (Gtk2::Button)
187       enter (Gtk2::Button)
188       leave (Gtk2::Button)
189       pressed (Gtk2::Button)
190       released (Gtk2::Button)
191

ENUMS AND FLAGS

193   enum Gtk2::PositionType
194       ·   'left' / 'GTK_POS_LEFT'
195
196       ·   'right' / 'GTK_POS_RIGHT'
197
198       ·   'top' / 'GTK_POS_TOP'
199
200       ·   'bottom' / 'GTK_POS_BOTTOM'
201
202   enum Gtk2::ReliefStyle
203       ·   'normal' / 'GTK_RELIEF_NORMAL'
204
205       ·   'half' / 'GTK_RELIEF_HALF'
206
207       ·   'none' / 'GTK_RELIEF_NONE'
208

SEE ALSO

210       Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
211       Gtk2::Container, Gtk2::Bin
212
214       Copyright (C) 2003-2011 by the gtk2-perl team.
215
216       This software is licensed under the LGPL.  See Gtk2 for a full notice.
217
218
219
220perl v5.32.0                      2020-07-28                   Gtk2::Button(3)
Impressum