Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / Checkbutton.pod
CommitLineData
86530b38
AT
1# Copyright (c) 1990-1994 The Regents of the University of California.
2# Copyright (c) 1994-1996 Sun Microsystems, Inc.
3# See the file "license.terms" for information on usage and redistribution
4# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5#
6#
7
8=head1 NAME
9
10Tk::Checkbutton - Create and manipulate Checkbutton widgets
11
12=for category Tk Widget Classes
13
14=head1 SYNOPSIS
15
16I<$checkbutton> = I<$parent>-E<gt>B<Checkbutton>(?I<options>?);
17
18=head1 STANDARD OPTIONS
19
20B<-activebackground> B<-cursor> B<-highlightthickness> B<-takefocus>
21B<-activeforeground> B<-disabledforeground> B<-image> B<-text>
22B<-anchor> B<-font> B<-justify> B<-textvariable>
23B<-background> B<-foreground> B<-padx> B<-underline>
24B<-bitmap> B<-highlightbackground> B<-pady> B<-wraplength>
25B<-borderwidth> B<-highlightcolor> B<-relief>
26
27See L<Tk::options> for details of the standard options.
28
29=head1 WIDGET-SPECIFIC OPTIONS
30
31=over 4
32
33=item Name: B<command>
34
35=item Class: B<Command>
36
37=item Switch: B<-command>
38
39Specifies a L<perl/Tk callback|Tk::callbacks> to associate with the button. This command
40is typically invoked when mouse button 1 is released over the button
41window. The button's global variable (B<-variable> option) will
42be updated before the command is invoked.
43
44=item Name: B<height>
45
46=item Class: B<Height>
47
48=item Switch: B<-height>
49
50Specifies a desired height for the button.
51If an image or bitmap is being displayed in the button then the value is in
52screen units (i.e. any of the forms acceptable to B<Tk_GetPixels>);
53for text it is in lines of text.
54If this option isn't specified, the button's desired height is computed
55from the size of the image or bitmap or text being displayed in it.
56
57=item Name: B<indicatorOn>
58
59=item Class: B<IndicatorOn>
60
61=item Switch: B<-indicatoron>
62
63Specifies whether or not the indicator should be drawn. Must be a
64proper boolean value. If false, the B<relief> option is
65ignored and the widget's relief is always sunken if the widget is
66selected and raised otherwise.
67
68=item Name: B<offValue>
69
70=item Class: B<Value>
71
72=item Switch: B<-offvalue>
73
74Specifies value to store in the button's associated variable whenever
75this button is deselected. Defaults to ``0''.
76
77=item Name: B<onValue>
78
79=item Class: B<Value>
80
81=item Switch: B<-onvalue>
82
83Specifies value to store in the button's associated variable whenever
84this button is selected. Defaults to ``1''.
85
86=item Name: B<selectColor>
87
88=item Class: B<Background>
89
90=item Switch: B<-selectcolor>
91
92Specifies a background color to use when the button is selected.
93If B<indicatorOn> is true then the color applies to the indicator.
94Under Windows, this color is used as the background for the indicator
95regardless of the select state.
96If B<indicatorOn> is false, this color is used as the background
97for the entire widget, in place of B<background> or B<activeBackground>,
98whenever the widget is selected.
99If specified as an empty string then no special color is used for
100displaying when the widget is selected.
101
102=item Name: B<selectImage>
103
104=item Class: B<SelectImage>
105
106=item Switch: B<-selectimage>
107
108Specifies an image to display (in place of the B<image> option)
109when the checkbutton is selected.
110This option is ignored unless the B<image> option has been
111specified.
112
113=item Name: B<state>
114
115=item Class: B<State>
116
117=item Switch: B<-state>
118
119Specifies one of three states for the checkbutton: B<normal>, B<active>,
120or B<disabled>. In normal state the checkbutton is displayed using the
121B<foreground> and B<background> options. The active state is
122typically used when the pointer is over the checkbutton. In active state
123the checkbutton is displayed using the B<activeForeground> and
124B<activeBackground> options. Disabled state means that the checkbutton
125should be insensitive: the default bindings will refuse to activate
126the widget and will ignore mouse button presses.
127In this state the B<disabledForeground> and
128B<background> options determine how the checkbutton is displayed.
129
130=item Name: B<variable>
131
132=item Class: B<Variable>
133
134=item Switch: B<-variable>
135
136Specifies reference to a variable to set to indicate whether
137or not this button is selected. Defaults to C<\$widget-E<gt>{'Value'}>
138member of the widget's hash. In general perl variables are C<undef> unless
139specifically initialized which will not match either default B<-onvalue> or
140default B<-offvalue>.
141
142=item Name: B<width>
143
144=item Class: B<Width>
145
146=item Switch: B<-width>
147
148Specifies a desired width for the button.
149If an image or bitmap is being displayed in the button then the value is in
150screen units (i.e. any of the forms acceptable to B<Tk_GetPixels>);
151for text it is in characters.
152If this option isn't specified, the button's desired width is computed
153from the size of the image or bitmap or text being displayed in it.
154
155=back
156
157=head1 DESCRIPTION
158
159The B<Checkbutton> method creates a new window (given by the
160$widget argument) and makes it into a checkbutton widget.
161Additional
162options, described above, may be specified on the command line
163or in the option database
164to configure aspects of the checkbutton such as its colors, font,
165text, and initial relief. The B<checkbutton> command returns its
166$widget argument. At the time this command is invoked,
167there must not exist a window named $widget, but
168$widget's parent must exist.
169
170A checkbutton is a widget
171that displays a textual string, bitmap or image
172and a square called an I<indicator>.
173If text is displayed, it must all be in a single font, but it
174can occupy multiple lines on the screen (if it contains newlines
175or if wrapping occurs because of the B<wrapLength> option) and
176one of the characters may optionally be underlined using the
177B<underline> option.
178A checkbutton has
179all of the behavior of a simple button, including the
180following: it can display itself in either of three different
181ways, according to the B<state> option;
182it can be made to appear
183raised, sunken, or flat; it can be made to flash; and it invokes
184a L<perl/Tk callback|Tk::callbacks> whenever mouse button 1 is clicked over the
185checkbutton.
186
187In addition, checkbuttons can be I<selected>.
188If a checkbutton is selected then the indicator is normally
189drawn with a selected appearance, and
190a Tcl variable associated with the checkbutton is set to a particular
191value (normally 1).
192Under Unix, the indicator is drawn with a sunken relief and a special
193color. Under Windows, the indicator is drawn with a check mark inside.
194If the checkbutton is not selected, then the indicator is drawn with a
195deselected appearance, and the associated variable is
196set to a different value (typically 0).
197Under Unix, the indicator is drawn with a raised relief and no special
198color. Under Windows, the indicator is drawn without a check mark inside.
199By default, the name of the variable associated with a checkbutton is the
200same as the I<name> used to create the checkbutton.
201The variable name, and the ``on'' and ``off'' values stored in it,
202may be modified with options on the command line or in the option
203database.
204Configuration options may also be used to modify the way the
205indicator is displayed (or whether it is displayed at all).
206By default a checkbutton is configured to select and deselect
207itself on alternate button clicks.
208In addition, each checkbutton monitors its associated variable and
209automatically selects and deselects itself when the variables value
210changes to and from the button's ``on'' value.
211
212=head1 WIDGET METHODS
213
214The B<Checkbutton> method creates a widget object.
215This object supports the B<configure> and B<cget> methods
216described in L<Tk::options> which can be used to enquire and
217modify the options described above.
218The widget also inherits all the methods provided by the generic
219L<Tk::Widget|Tk::Widget> class.
220
221The following additional methods are available for checkbutton widgets:
222
223=over 4
224
225=item I<$checkbutton>-E<gt>B<deselect>
226
227Deselects the checkbutton and sets the associated variable to its ``off''
228value.
229
230=item I<$checkbutton>-E<gt>B<flash>
231
232Flashes the checkbutton. This is accomplished by redisplaying the checkbutton
233several times, alternating between active and normal colors. At
234the end of the flash the checkbutton is left in the same normal/active
235state as when the command was invoked.
236This command is ignored if the checkbutton's state is B<disabled>.
237
238=item I<$checkbutton>-E<gt>B<invoke>
239
240Does just what would have happened if the user invoked the checkbutton
241with the mouse: toggle the selection state of the button and invoke
242the L<perl/Tk callback|Tk::callbacks> associated with the checkbutton, if there is one.
243The return value is the return value from the L<perl/Tk callback|Tk::callbacks>, or an
244empty string if there is no command associated with the checkbutton.
245This command is ignored if the checkbutton's state is B<disabled>.
246
247=item I<$checkbutton>-E<gt>B<select>
248
249Selects the checkbutton and sets the associated variable to its ``on''
250value.
251
252=item I<$checkbutton>-E<gt>B<toggle>
253
254Toggles the selection state of the button, redisplaying it and
255modifying its associated variable to reflect the new state.
256
257=back
258
259=head1 BINDINGS
260
261Tk automatically creates class bindings for checkbuttons that give them
262the following default behavior:
263
264=over 4
265
266=item [1]
267
268On Unix systems, a checkbutton activates whenever the mouse passes
269over it and deactivates whenever the mouse leaves the checkbutton. On
270Mac and Windows systems, when mouse button 1 is pressed over a
271checkbutton, the button activates whenever the mouse pointer is inside
272the button, and deactivates whenever the mouse pointer leaves the
273button.
274
275=item [2]
276
277When mouse button 1 is pressed over a checkbutton, it is invoked (its
278selection state toggles and the command associated with the button is
279invoked, if there is one).
280
281=item [3]
282
283When a checkbutton has the input focus, the space key causes the checkbutton
284to be invoked. Under Windows, there are additional key bindings; plus
285(+) and equal (=) select the button, and minus (-) deselects the button.
286
287If the checkbutton's state is B<disabled> then none of the above
288actions occur: the checkbutton is completely non-responsive.
289
290The behavior of checkbuttons can be changed by defining new bindings for
291individual widgets or by redefining the class bindings.
292
293=back
294
295=head1 KEYWORDS
296
297checkbutton, widget
298
299=cut
300