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 / options.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::options - Standard options supported by widgets and their manipulation
11
12=for category Creating and Configuring Widgets
13
14=head1 SYNOPSIS
15
16S< >I<$value> = I<$widget>-E<gt>B<cget>('I<-option>');
17
18S< >I<$widget>-E<gt>B<configure>(I<-option>=E<gt>I<value> ?,I<-option>=E<gt>I<value> ...?);
19
20S< >I<@list> = I<$widget>-E<gt>B<configure>('I<-option>');
21
22S< >I<@lol> = I<$widget>-E<gt>B<configure>;
23
24=head1 DESCRIPTION
25
26All widgets, and images have a standard mechanism for setting and querying
27attibutes or options. The mechanism is based on two methods B<configure>
28and B<cget>. The behaviour of these methods is as follows:
29
30=over 4
31
32=item I<$widget>-E<gt>B<configure>(I<-option>=E<gt>I<value> ?,I<-option>=E<gt>I<value> ...?);
33
34Sets the values of I<-option> to I<value> for each I<-option>=E<gt>I<value>
35pair. The internal B<new> method does an implicit B<configure> in this
36form with options passed in at widget create time.
37
38=item I<$widget>-E<gt>B<configure>('I<-option>')
39
40In array context returns a list of five or two elements. If I<-option>
41is an alias for another options it return a list consisting of the
42alias option and the name for the option is is an alias for, e.g.,
43C<('-bg', 'background')>. If I<-option> is not an alias the returned
44list has the following five elements:
45
46=over 8
47
48=item I<Option Name>
49
50The value of I<-option>, e.g., B<-background>.
51
52=item I<Name>
53
54The option's name in the option database, e.g., C<background>.
55
56=item I<Class>
57
58The option's class value in the option database, e.g., C<Background>.
59
60=item I<Default>
61
62The default value for the option if not specified or in the option database,
63e.g., C<grey>.
64
65=item I<Value>
66
67The current value (as returned by B<cget>), e.g., C<white>.
68
69=back
70
71=item I<$widget>-E<gt>B<configure>
72
73Returns a list of lists for all the options supported by I<$widget>.
74Each sub-list is in the form returned by B<configure>('I<-option>').
75(This mechanism is used by the B<Tk::Derived> class to determine
76the options available from base class.)
77
78=item I<$widget>-E<gt>B<cget>('I<-option>')
79
80Returns the current value of I<-option> for I<$widget>.
81
82B<cget>('I<-option>') is clumsy with the need for B<''> due to perl's
83parsing rules. Something more subtle using L<tie|perlfunc/tie> might look better.
84
85=back
86
87The following paragraphs describe the common configuration options supported by
88widgets in the Tk toolkit. Every widget does not necessarily support every option
89(see the the documentation entries for individual widgets for a list of the
90standard options supported by that widget), but if a widget does support an option
91with one of the names listed below, then the option has exactly the effect
92described below.
93
94In the descriptions below, ``Name'' refers to the option's name in the option
95database. ``Class'' refers to the option's class value
96in the option database. ``Switch'' refers to the switch used in widget-creation
97and B<configure> widget methods to set this value. For example, if an option's
98configure option is B<-foreground> and there exists a widget I<$widget>, then the
99call:
100
101S< >I<$widget>-E<gt>B<configure>(B<-foreground>=E<gt>B<'black'>)
102
103may be used to specify the value B<black> for the option in the widget I<$widget>.
104Configure options may be abbreviated, as long as the abbreviation is unambiguous
105(abbreviation is deprecated in perl/Tk).
106
107=head2 Creation options: Widget Name and Class
108
109The B<Name> and B<-class> options can only be specified when a widget is
110created, and cannot be changed with B<configure>. These options determine
111the widget's identity and how Tk applies resource values from the
112option database (see L<Tk::option>) and so they
113cannot be assigned by the options database.
114
115=over 4
116
117=item Name: I<name>
118
119=item Switch: B<Name>
120
121Specifies the path element for the widget. Names generally begin with a
122lowercase letter.
123
124Each widget has a unique I<pathname> that follows the hierarchy from the
125B<MainWindow> to the widget itself. Since the widget's B<PathName> is
126used to assign options from the options database, it is important to
127specify a distinctive B<Name> for any widget that will have non-default
128options. See L<Tk::option> for details.
129
130=item Name: I<class>
131
132=item Switch: B<-class>
133
134Specifies a class for the window. Classes generally begin with an
135uppercase letter.
136
137This class will be used when querying the option database for
138the window's other options (see Tk::options), and it will also be used
139later for other purposes such as bindings. One typically assigns a class
140to a B<TopLevel> or B<Frame> so that the class will apply to all of
141that widget's children.
142
143=back
144
145=head2 Reconfigurable options
146
147These options can be set at widget creation or changed later via B<configure>.
148
149=over 4
150
151=item Name: B<activeBackground>
152
153=item Class: B<Foreground>
154
155=item Switch: B<-activebackground>
156
157Specifies background color to use when drawing active elements.
158An element (a widget or portion of a widget) is active if the
159mouse cursor is positioned over the element and pressing a mouse button
160will cause some action to occur.
161If strict Motif compliance has been requested by setting the
162B<$Tk::strictMotif> variable, this option will normally be
163ignored; the normal background color will be used instead.
164For some elements on Windows and Macintosh systems, the active color
165will only be used while mouse button 1 is pressed over the element.
166
167=item Name: B<activeBorderWidth>
168
169=item Class: B<BorderWidth>
170
171=item Switch: B<-activeborderwidth>
172
173Specifies a non-negative value indicating
174the width of the 3-D border drawn around active elements.
175See above for definition of active elements.
176The value may have any of the forms acceptable to B<Tk_GetPixels>.
177This option is typically only available in widgets displaying more
178than one element at a time (e.g. menus but not buttons).
179
180=item Name: B<activeForeground>
181
182=item Class: B<Background>
183
184=item Switch: B<-activeforeground>
185
186Specifies foreground color to use when drawing active elements.
187See above for definition of active elements.
188
189=item Name: B<activetile>
190
191=item Class: B<Tile>
192
193=item Switch: B<-activetile>
194
195Specifies image used to display inside active elements of the widget.
196See above for definition of active elements.
197
198=item Name: B<anchor>
199
200=item Class: B<Anchor>
201
202=item Switch: B<-anchor>
203
204Specifies how the information in a widget (e.g. text or a bitmap)
205is to be displayed in the widget.
206Must be one of the values B<n>, B<ne>, B<e>, B<se>,
207B<s>, B<sw>, B<w>, B<nw>, or B<center>.
208For example, B<nw> means display the information such that its
209top-left corner is at the top-left corner of the widget.
210
211=item Name: B<background>
212
213=item Class: B<Background>
214
215=item Switch: B<-background>
216
217=item Alias: B<-bg>
218
219Specifies the normal background color to use when displaying the
220widget.
221
222=item Name: B<bitmap>
223
224=item Class: B<Bitmap>
225
226=item Switch: B<-bitmap>
227
228Specifies a bitmap to display in the widget, in any of the forms
229acceptable to B<Tk_GetBitmap>.
230The exact way in which the bitmap is displayed may be affected by
231other options such as B<-anchor> or B<-justify>.
232Typically, if this option is specified then it overrides other
233options that specify a textual value to display in the widget;
234the B<-bitmap> option may be reset to an empty string to re-enable
235a text display.
236In widgets that support both B<-bitmap> and B<-image> options,
237B<-image> will usually override B<-bitmap>.
238
239=item Name: B<borderWidth>
240
241=item Class: B<BorderWidth>
242
243=item Switch: B<-borderwidth>
244
245=item Alias: B<-bd>
246
247Specifies a non-negative value indicating the width
248of the 3-D border to draw around the outside of the widget (if such a
249border is being drawn; the B<relief> option typically determines
250this). The value may also be used when drawing 3-D effects in the
251interior of the widget.
252The value may have any of the forms acceptable to B<Tk_GetPixels>.
253
254=item Name: B<cursor>
255
256=item Class: B<Cursor>
257
258=item Switch: B<-cursor>
259
260Specifies the mouse cursor to be used for the widget.
261The value may have any of the forms acceptable to B<Tk_GetCursor>.
262
263=item Name: B<dash>
264
265=item Class: B<Dash>
266
267=item Switch: B<-dash>
268
269The value may have any of the forms accepted by B<Tk_GetDash>,
270such as B<4>, B<[6,4]>, B<.>, B<->, B<-.>, or B<-..>.
271
272=item Name: B<dashoffset>
273
274=item Class: B<Dashoffset>
275
276=item Switch: B<-dashoffset>
277
278Specifies the offset in the dash list where the drawing starts.
279
280=item Name: B<disabledForeground>
281
282=item Class: B<DisabledForeground>
283
284=item Switch: B<-disabledforeground>
285
286Specifies foreground color to use when drawing a disabled element.
287If the option is specified as an empty string (which is typically the
288case on monochrome displays), disabled elements are drawn with the
289normal foreground color but they are dimmed by drawing them
290with a stippled fill pattern.
291
292=item Name: B<disabledtile>
293
294=item Class: B<Tile>
295
296=item Switch: B<-disabledtile>
297
298Specifies image to use when drawing a disabled element.
299
300=item Name: B<exportSelection>
301
302=item Class: B<ExportSelection>
303
304=item Switch: B<-exportselection>
305
306Specifies whether or not a selection in the widget should also be
307the X selection.
308The value may have any of the forms accepted by B<Tcl_GetBoolean>,
309such as B<true>, B<false>, B<0>, B<1>, B<yes>, or B<no>.
310If the selection is exported, then selecting in the widget deselects
311the current X selection, selecting outside the widget deselects any
312widget selection, and the widget will respond to selection retrieval
313requests when it has a selection. The default is usually for widgets
314to export selections.
315
316=item Name: B<font>
317
318=item Class: B<Font>
319
320=item Switch: B<-font>
321
322Specifies the font to use when drawing text inside the widget.
323
324=item Name: B<foreground>
325
326=item Class: B<Foreground>
327
328=item Switch: B<-foreground>
329
330=item Alias: B<-fg>
331
332Specifies the normal foreground color to use when displaying the widget.
333
334=item Name: B<highlightBackground>
335
336=item Class: B<HighlightBackground>
337
338=item Switch: B<-highlightbackground>
339
340Specifies the color to display in the traversal highlight region when
341the widget does not have the input focus.
342
343=item Name: B<highlightColor>
344
345=item Class: B<HighlightColor>
346
347=item Switch: B<-highlightcolor>
348
349Specifies the color to use for the traversal highlight rectangle that is
350drawn around the widget when it has the input focus.
351
352=item Name: B<highlightThickness>
353
354=item Class: B<HighlightThickness>
355
356=item Switch: B<-highlightthickness>
357
358Specifies a non-negative value indicating the width of the highlight
359rectangle to draw around the outside of the widget when it has the
360input focus.
361The value may have any of the forms acceptable to B<Tk_GetPixels>.
362If the value is zero, no focus highlight is drawn around the widget.
363
364=item Name: B<image>
365
366=item Class: B<Image>
367
368=item Switch: B<-image>
369
370Specifies an image to display in the widget, which must have been
371created with an image create. (See L<Tk::Image> for details of image creation.)
372Typically, if the B<-image> option is specified then it overrides other
373options that specify a bitmap or textual value to display in the widget;
374the B<-image> option may be reset to an empty string to re-enable
375a bitmap or text display.
376
377=item Name: B<insertBackground>
378
379=item Class: B<Foreground>
380
381=item Switch: B<-insertbackground>
382
383Specifies the color to use as background in the area covered by the
384insertion cursor. This color will normally override either the normal
385background for the widget (or the selection background if the insertion
386cursor happens to fall in the selection).
387
388=item Name: B<insertBorderWidth>
389
390=item Class: B<BorderWidth>
391
392=item Switch: B<-insertborderwidth>
393
394Specifies a non-negative value indicating the width
395of the 3-D border to draw around the insertion cursor.
396The value may have any of the forms acceptable to B<Tk_GetPixels>.
397
398=item Name: B<insertOffTime>
399
400=item Class: B<OffTime>
401
402=item Switch: B<-insertofftime>
403
404Specifies a non-negative integer value indicating the number of
405milliseconds the insertion cursor should remain ``off'' in each blink cycle.
406If this option is zero then the cursor doesn't blink: it is on
407all the time.
408
409=item Name: B<insertOnTime>
410
411=item Class: B<OnTime>
412
413=item Switch: B<-insertontime>
414
415Specifies a non-negative integer value indicating the number of
416milliseconds the insertion cursor should remain ``on'' in each blink cycle.
417
418=item Name: B<insertWidth>
419
420=item Class: B<InsertWidth>
421
422=item Switch: B<-insertwidth>
423
424Specifies a value indicating the total width of the insertion cursor.
425The value may have any of the forms acceptable to B<Tk_GetPixels>.
426If a border has been specified for the insertion
427cursor (using the B<insertBorderWidth> option), the border
428will be drawn inside the width specified by the B<insertWidth>
429option.
430
431=item Name: B<jump>
432
433=item Class: B<Jump>
434
435=item Switch: B<-jump>
436
437For widgets with a slider that can be dragged to adjust a value,
438such as scrollbars, this option determines when
439notifications are made about changes in the value.
440The option's value must be a boolean of the form accepted by
441B<Tcl_GetBoolean>.
442If the value is false, updates are made continuously as the
443slider is dragged.
444If the value is true, updates are delayed until the mouse button
445is released to end the drag; at that point a single notification
446is made (the value ``jumps'' rather than changing smoothly).
447
448=item Name: B<justify>
449
450=item Class: B<Justify>
451
452=item Switch: B<-justify>
453
454When there are multiple lines of text displayed in a widget, this
455option determines how the lines line up with each other.
456Must be one of B<left>, B<center>, or B<right>.
457B<Left> means that the lines' left edges all line up, B<center>
458means that the lines' centers are aligned, and B<right> means
459that the lines' right edges line up.
460
461=item Name: B<offset>
462
463=item Class: B<Offset>
464
465=item Switch: B<-offset>
466
467Specifies the offset of tiles (see also B<-tile> option). It can
468have two different formats B<-offset x,y> or B<-offset side>,
469where side can be B<n>, B<ne>, B<e>, B<se>, B<s>,
470B<sw>, B<w>, B<nw>, or B<center>. In the first case
471the origin is the origin of the toplevel of the current window.
472For the canvas itself and canvas objects the origin is the canvas
473origin, but putting B<#> in front of the coordinate pair
474indicates using the toplevel origin in stead. For canvas objects,
475the B<-offset> option is used for stippling as well.
476For the line and polygon canvas items you can also specify
477an index as argument, which connects the stipple or tile
478origin to one of the coordinate points of the line/polygon.
479
480=item Name: B<orient>
481
482=item Class: B<Orient>
483
484=item Switch: B<-orient>
485
486For widgets that can lay themselves out with either a horizontal
487or vertical orientation, such as scrollbars, this option specifies
488which orientation should be used. Must be either B<horizontal>
489or B<vertical> or an abbreviation of one of these.
490
491=item Name: B<padX>
492
493=item Class: B<Pad>
494
495=item Switch: B<-padx>
496
497Specifies a non-negative value indicating how much extra space
498to request for the widget in the X-direction.
499The value may have any of the forms acceptable to B<Tk_GetPixels>.
500When computing how large a window it needs, the widget will
501add this amount to the width it would normally need (as determined
502by the width of the things displayed in the widget); if the geometry
503manager can satisfy this request, the widget will end up with extra
504internal space to the left and/or right of what it displays inside.
505Most widgets only use this option for padding text: if they are
506displaying a bitmap or image, then they usually ignore padding
507options.
508
509=item Name: B<padY>
510
511=item Class: B<Pad>
512
513=item Switch: B<-pady>
514
515Specifies a non-negative value indicating how much extra space
516to request for the widget in the Y-direction.
517The value may have any of the forms acceptable to B<Tk_GetPixels>.
518When computing how large a window it needs, the widget will add
519this amount to the height it would normally need (as determined by
520the height of the things displayed in the widget); if the geometry
521manager can satisfy this request, the widget will end up with extra
522internal space above and/or below what it displays inside.
523Most widgets only use this option for padding text: if they are
524displaying a bitmap or image, then they usually ignore padding
525options.
526
527=item Name: B<relief>
528
529=item Class: B<Relief>
530
531=item Switch: B<-relief>
532
533Specifies the 3-D effect desired for the widget. Acceptable
534values are B<raised>, B<sunken>, B<flat>, B<ridge>,
535B<solid>, and B<groove>.
536The value
537indicates how the interior of the widget should appear relative
538to its exterior; for example, B<raised> means the interior of
539the widget should appear to protrude from the screen, relative to
540the exterior of the widget.
541
542=item Name: B<repeatDelay>
543
544=item Class: B<RepeatDelay>
545
546=item Switch: B<-repeatdelay>
547
548Specifies the number of milliseconds a button or key must be held
549down before it begins to auto-repeat. Used, for example, on the
550up- and down-arrows in scrollbars.
551
552=item Name: B<repeatInterval>
553
554=item Class: B<RepeatInterval>
555
556=item Switch: B<-repeatinterval>
557
558Used in conjunction with B<repeatDelay>: once auto-repeat
559begins, this option determines the number of milliseconds between
560auto-repeats.
561
562=item Name: B<selectBackground>
563
564=item Class: B<Foreground>
565
566=item Switch: B<-selectbackground>
567
568Specifies the background color to use when displaying selected
569items.
570
571=item Name: B<selectBorderWidth>
572
573=item Class: B<BorderWidth>
574
575=item Switch: B<-selectborderwidth>
576
577Specifies a non-negative value indicating the width
578of the 3-D border to draw around selected items.
579The value may have any of the forms acceptable to B<Tk_GetPixels>.
580
581=item Name: B<selectForeground>
582
583=item Class: B<Background>
584
585=item Switch: B<-selectforeground>
586
587Specifies the foreground color to use when displaying selected
588items.
589
590=item Name: B<setGrid>
591
592=item Class: B<SetGrid>
593
594=item Switch: B<-setgrid>
595
596Specifies a boolean value that determines whether this widget controls the
597resizing grid for its top-level window.
598This option is typically used in text widgets, where the information
599in the widget has a natural size (the size of a character) and it makes
600sense for the window's dimensions to be integral numbers of these units.
601These natural window sizes form a grid.
602If the B<setGrid> option is set to true then the widget will
603communicate with the window manager so that when the user interactively
604resizes the top-level window that contains the widget, the dimensions of
605the window will be displayed to the user in grid units and the window
606size will be constrained to integral numbers of grid units.
607See L<Tk::Wm/"GRIDDED GEOMETRY MANAGEMENT">
608for more details.
609
610=item Name: B<takeFocus>
611
612=item Class: B<TakeFocus>
613
614=item Switch: B<-takefocus>
615
616Determines whether the window accepts the focus during keyboard
617traversal (e.g., Tab and Shift-Tab).
618Before setting the focus to a window, the traversal scripts
619consult the value of the B<takeFocus> option.
620A value of B<0> means that the window should be skipped entirely
621during keyboard traversal.
622B<1> means that the window should receive the input
623focus as long as it is viewable (it and all of its ancestors are mapped).
624An empty value for the option means that the traversal scripts make
625the decision about whether or not to focus on the window: the current
626algorithm is to skip the window if it is
627disabled, if it has no key bindings, or if it is not viewable.
628If the value has any other form, then the traversal scripts take
629the value, append the name of the window to it (with a separator space),
630and evaluate the resulting string as a Callback.
631The script must return B<0>, B<1>, or an empty string: a
632B<0> or B<1> value specifies whether the window will receive
633the input focus, and an empty string results in the default decision
634described above.
635Note: this interpretation of the option is defined entirely by
636the Callbacks that implement traversal: the widget implementations
637ignore the option entirely, so you can change its meaning if you
638redefine the keyboard traversal scripts.
639
640=item Name: B<text>
641
642=item Class: B<Text>
643
644=item Switch: B<-text>
645
646Specifies a string to be displayed inside the widget. The way in which
647the string is displayed depends on the particular widget and may be
648determined by other options, such as B<anchor> or B<justify>.
649
650=item Name: B<textVariable>
651
652=item Class: B<Variable>
653
654=item Switch: B<-textvariable>
655
656Specifies the name of a variable. The value of the variable is a text
657string to be displayed inside the widget; if the variable value changes
658then the widget will automatically update itself to reflect the new value.
659The way in which the string is displayed in the widget depends on the
660particular widget and may be determined by other options, such as
661B<anchor> or B<justify>.
662
663=item Name: B<troughColor>
664
665=item Class: B<Background>
666
667=item Switch: B<-troughcolor>
668
669Specifies the color to use for the rectangular trough areas
670in widgets such as scrollbars and scales.
671
672=item Name: B<troughTile>
673
674=item Class: B<Tile>
675
676=item Switch: B<-troughtile>
677
678Specifies image used to display in the rectangular trough areas
679in widgets such as scrollbars and scales.
680
681=item Name: B<underline>
682
683=item Class: B<Underline>
684
685=item Switch: B<-underline>
686
687Specifies the integer index of a character to underline in the widget.
688This option is used by the default bindings to implement keyboard
689traversal for menu buttons and menu entries.
6900 corresponds to the first character of the text displayed in the
691widget, 1 to the next character, and so on.
692
693=item Name: B<wrapLength>
694
695=item Class: B<WrapLength>
696
697=item Switch: B<-wraplength>
698
699For widgets that can perform word-wrapping, this option specifies
700the maximum line length.
701Lines that would exceed this length are wrapped onto the next line,
702so that no line is longer than the specified length.
703The value may be specified in any of the standard forms for
704screen distances.
705If this value is less than or equal to 0 then no wrapping is done: lines
706will break only at newline characters in the text.
707
708=item Name: B<xScrollCommand>
709
710=item Class: B<ScrollCommand>
711
712=item Switch: B<-xscrollcommand>
713
714Specifies a callback used to communicate with horizontal
715scrollbars.
716When the view in the widget's window changes (or
717whenever anything else occurs that could change the display in a
718scrollbar, such as a change in the total size of the widget's
719contents), the widget will
720make a callback passing two numeric arguments in addition to
721any specified in the callback.
722Each of the numbers is a fraction between 0 and 1, which indicates
723a position in the document. 0 indicates the beginning of the document,
7241 indicates the end, .333 indicates a position one third the way through
725the document, and so on.
726The first fraction indicates the first information in the document
727that is visible in the window, and the second fraction indicates
728the information just after the last portion that is visible.
729Typically the
730B<xScrollCommand> option consists of the scrollbar widget object
731and the method ``set'' i.e. [B<set> =E<gt> I<$sb>]:
732this will cause the scrollbar to be updated whenever the view in the window changes.
733If this option is not specified, then no command will be executed.
734
735=item Name: B<yScrollCommand>
736
737=item Class: B<ScrollCommand>
738
739=item Switch: B<-yscrollcommand>
740
741Specifies a calback used to communicate with vertical
742scrollbars. This option is treated in the same way as the
743B<xScrollCommand> option, except that it is used for vertical
744scrollbars and is provided by widgets that support vertical scrolling.
745See the description of B<xScrollCommand> for details
746on how this option is used.
747
748=back
749
750=head1 SEE ALSO
751
752L<Tk::option|Tk::option>
753L<Tk::callbacks|Tk::callbacks>
754L<Tk::configspec|Tk::configspec>
755L<Tk_GetPixels|Tk::pTk::GetPixels>
756
757=head1 KEYWORDS
758
759class, name, standard option, switch
760
761=cut
762