Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man3 / Tk::DItem.3
CommitLineData
86530b38
AT
1.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "DITEM 1"
132.TH DITEM 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation"
133.SH "NAME"
134Tk::DItem \- Tix Display Items
135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS"
137.SH "DESCRIPTION"
138.IX Header "DESCRIPTION"
139The Tix \fBDisplay Items\fR and \fBDisplay Types\fR are devised to
140solve a general problem: many Tix widgets (both existing and planned
141ones) display many items of many types simultaneously.
142.PP
143For example, a hierarchical listbox widget (see Tk::HList) can display
144items
145of images, plain text and subwindows in the form of a
146hierarchy. Another widget, the tabular listbox widget (see Tk::TList)
147also displays items of the
148same types, although it arranges the items in a tabular form. Yet
149another widget, the spreadsheet widget (see Tk::TixGrid),
150also displays similar types
151items, but in yet another format.
152.PP
153In these examples, the display items in different widgets are only
154different in how they are arranged by the \fBhost widget\fR. In Tix,
155display items are clearly separated from the host widgets. The
156advantage is two\-fold: first, the creation and configuration of
157display items become uniform across different host widgets. Second,
158new display item types can be added without the need to modify the
159existing host widgets.
160.PP
161In a way, Tix display items are similar to the items inside Tk
162the canvas widget. However, unlike the Tix display items, the canvas
163items are not independent of the canvas widget; this makes it
164impossible to use the canvas items inside other types of \s-1TK\s0 widgets.
165.PP
166The appearance of a display item is controlled by a set of
167\&\fIattributes\fR. It is observed that each the attributes usually fall
168into one of two categroies: ``\fIindividual\fR'' or
169``\fIcollective\fR''. For example, the text items inside a HList widget
170may all display a different text string; however, in most cases, the
171text items share the same color, font and spacing. Instead of keeping
172a duplicated version of the same attributes inside each display item,
173it will be advantageous to put the collective attributes in a
174special object called a \fBdisplay style\fR. First, there is the space
175concern: a host widget may have many thousands of items; keeping
176dupilcated attributes will be very wasteful. Second, when it becomes
177necessary to change a collective attribute, such as changing all the
178text items' foreground color to red, it will be more efficient to
179change only the display style object than to modify all the text
180items one by one.
181.PP
182The attributes of the a display item are thus stored in two places: it
183has a set of \fBitem options\fR to store its individual attributes. Each
184display item is also associated with a \fIdisplay style\fR, which specifies
185the collective attributes of all items associated with itself.
186.PP
187The division between the individual and collective attributes are
188fixed and cannot be changed. Thus, when it becomes necessary for some
189items to differ in their collective attributes, two or more \fBdisplay styles\fR
190can be used. For example, suppose you want to display two
191columns of text items inside an HList widget, one column in red and
192the other in blue. You can create a TextStyle object called ``$red''
193which defines a red foreground, and another called ``$blue'', which
194defines a blue foreground. You can then associate all text items of
195the first column to ``$red'' and the second column to ``$blue''
196.SH "DISPLAY ITEM TYPES AND OPTIONS"
197.IX Header "DISPLAY ITEM TYPES AND OPTIONS"
198Currently there are three types of display items: \fBtext\fR,
199\&\fBimagetext\fR and \fIwindow\fR.
200.SH "IMAGETEXT ITEMS"
201.IX Header "IMAGETEXT ITEMS"
202Display items of the type \fBimagetext\fR are used to display an image
203together with a text string. Imagetext items support the following options:
204.Sh "Imagetext Item Options"
205.IX Subsection "Imagetext Item Options"
206.IP "Name: \fBbitmap\fR" 4
207.IX Item "Name: bitmap"
208.PD 0
209.IP "Class: \fBBitmap\fR" 4
210.IX Item "Class: Bitmap"
211.IP "Switch: \fB\-bitmap\fR" 4
212.IX Item "Switch: -bitmap"
213.PD
214Specifies the bitmap to display in the item.
215.IP "Name: \fBimage\fR" 4
216.IX Item "Name: image"
217.PD 0
218.IP "Class: \fBImage\fR" 4
219.IX Item "Class: Image"
220.IP "Switch: \fB\-image\fR" 4
221.IX Item "Switch: -image"
222.PD
223Specifies the image to display in the item. When both the
224\&\fB\-bitmap\fR and \fB\-image\fR options are specified, only the image
225will be displayed.
226.IP "Name: \fBimageTextStyle\fR" 4
227.IX Item "Name: imageTextStyle"
228.PD 0
229.IP "Class: \fBImageTextStyle\fR" 4
230.IX Item "Class: ImageTextStyle"
231.IP "Switch: \fB\-style\fR" 4
232.IX Item "Switch: -style"
233.PD
234Specifies the display style to use for this item. Must be the
235name of a \fBimagetext\fR display style that has already be created with
236\&\fBItemStyle\fR.
237.IP "Name: \fBshowImage\fR" 4
238.IX Item "Name: showImage"
239.PD 0
240.IP "Class: \fBShowImage\fR" 4
241.IX Item "Class: ShowImage"
242.IP "Switch: \fB\-showimage\fR" 4
243.IX Item "Switch: -showimage"
244.PD
245A Boolean value that specifies whether the image/bitmap should be
246displayed.
247.IP "Name: \fBshowText\fR" 4
248.IX Item "Name: showText"
249.PD 0
250.IP "Class: \fBShowText\fR" 4
251.IX Item "Class: ShowText"
252.IP "Switch: \fB\-showtext\fR" 4
253.IX Item "Switch: -showtext"
254.PD
255A Boolean value that specifies whether the text string should be
256displayed.
257.IP "Name: \fBtext\fR" 4
258.IX Item "Name: text"
259.PD 0
260.IP "Class: \fBText\fR" 4
261.IX Item "Class: Text"
262.IP "Switch: \fB\-text\fR" 4
263.IX Item "Switch: -text"
264.PD
265Specifies the text string to display in the item.
266.IP "Name: \fBunderline\fR" 4
267.IX Item "Name: underline"
268.PD 0
269.IP "Class: \fBUnderline\fR" 4
270.IX Item "Class: Underline"
271.IP "Switch: \fB\-underline\fR" 4
272.IX Item "Switch: -underline"
273.PD
274Specifies the integer index of a character to underline in the text
275string in the item. 0 corresponds to the first character of the text
276displayed in the widget, 1 to the next character, and so on.
277.Sh "Imagetext Style Options"
278.IX Subsection "Imagetext Style Options"
279The style information of \fBimagetext\fR items are stored in the
280\&\fBimagetext\fR display style. The following options are supported:
281.PP
282\&\fB\s-1STANDARD\s0 \s-1OPTIONS\s0\fR
283.PP
284\&\fB\-activebackground\fR \fB\-activeforeground\fR
285\&\fB\-anchor\fR \fB\-background\fR
286\&\fB\-disabledbackground\fR \fB\-disabledforeground\fR
287\&\fB\-foreground\fR \fB\-font\fR
288\&\fB\-justify\fR \fB\-padx\fR
289\&\fB\-pady\fR \fB\-selectbackground\fR
290\&\fB\-selectforeground\fR \fB\-wraplength\fR
291.PP
292See Tk::options for details of the standard options.
293.PP
294\&\fBSTYLE-SPECIFIC \s-1OPTIONS\s0\fR
295.IP "Name: \fBgap\fR" 4
296.IX Item "Name: gap"
297.PD 0
298.IP "Class: \fBGap\fR" 4
299.IX Item "Class: Gap"
300.IP "Switch: \fB\-gap\fR" 4
301.IX Item "Switch: -gap"
302.PD
303Specifies the distance between the bitmap/image and the text string,
304in number of pixels.
305.IP "Name: \fBtextAnchor\fR" 4
306.IX Item "Name: textAnchor"
307.PD 0
308.IP "Class: \fBTextAnchor\fR" 4
309.IX Item "Class: TextAnchor"
310.IP "Switch: \fB\-textanchor\fR" 4
311.IX Item "Switch: -textanchor"
312.PD
313The anchor position on the image to which text part is attached.
314This is a perl/Tk addition. Defaults to \fBe\fR for compatibility with standard
315Tix. The interesting cases are
316.RS 4
317.IP "\fBn\fR" 8
318.IX Item "n"
319Text is centred above the image.
320.IP "\fBs\fR" 8
321.IX Item "s"
322Text is centred below the image
323.IP "\fBe\fR" 8
324.IX Item "e"
325Text is centred to right of the image.
326.IP "\fBw\fR" 8
327.IX Item "w"
328Text is centred to left of the image.
329.IP "\fBc\fR" 8
330.IX Item "c"
331Text is centred over the image.
332.RE
333.RS 4
334.Sp
335The \fBsw\fR, \fBse\fR, \fBne\fR, and b<nw> cases look rather odd.
336.Sp
337To get items to line up correctly it will usually be necessary
338to specify \fB\-anchor\fR as well. e.g. with default \fBe\fR then anchoring
339item as a whole \fBw\fR lines images up down left with text stuck to right side.
340.RE
341.SH "TEXT ITEMS"
342.IX Header "TEXT ITEMS"
343Display items of the type \fBtext\fR are used to display a text string
344in a widget. Text items support the following options:
345.Sh "Text Item Options"
346.IX Subsection "Text Item Options"
347.IP "Name: \fBtextStyle\fR" 4
348.IX Item "Name: textStyle"
349.PD 0
350.IP "Class: \fBTextStyle\fR" 4
351.IX Item "Class: TextStyle"
352.IP "Switch: \fB\-style\fR" 4
353.IX Item "Switch: -style"
354.PD
355Specifies the display style to use for this text item. Must be the
356name of a \fBtext\fR display style that has already be created with
357\&\fBItemStyle\fR.
358.IP "Name: \fBtext\fR" 4
359.IX Item "Name: text"
360.PD 0
361.IP "Class: \fBText\fR" 4
362.IX Item "Class: Text"
363.IP "Switch: \fB\-text\fR" 4
364.IX Item "Switch: -text"
365.PD
366Specifies the text string to display in the item.
367.IP "Name: \fBunderline\fR" 4
368.IX Item "Name: underline"
369.PD 0
370.IP "Class: \fBUnderline\fR" 4
371.IX Item "Class: Underline"
372.IP "Switch: \fB\-underline\fR" 4
373.IX Item "Switch: -underline"
374.PD
375Specifies the integer index of a character to underline in the item.
3760 corresponds to the first character of the text displayed in the
377widget, 1 to the next character, and so on.
378.Sh "Text Style Options"
379.IX Subsection "Text Style Options"
380\&\fB\s-1STANDARD\s0 \s-1OPTIONS\s0\fR
381.PP
382\&\fB\-activebackground\fR \fB\-activeforeground\fR
383\&\fB\-anchor\fR \fB\-background\fR
384\&\fB\-disabledbackground\fR \fB\-disabledforeground\fR
385\&\fB\-foreground\fR \fB\-font\fR
386\&\fB\-justify\fR \fB\-padx\fR
387\&\fB\-pady\fR \fB\-selectbackground\fR
388\&\fB\-selectforeground\fR \fB\-wraplength\fR
389.PP
390See Tk::options for details of the standard options.
391.SH "WINDOW ITEMS"
392.IX Header "WINDOW ITEMS"
393Display items of the type \fIwindow\fR are used to display a
394sub-window in a widget. \fBWindow\fR items support the following
395options:
396.Sh "Window Item Options"
397.IX Subsection "Window Item Options"
398.IP "Name: \fBwindowStyle\fR" 4
399.IX Item "Name: windowStyle"
400.PD 0
401.IP "Class: \fBWindowStyle\fR" 4
402.IX Item "Class: WindowStyle"
403.IP "Switch: \fB\-style\fR" 4
404.IX Item "Switch: -style"
405.PD
406Specifies the display style to use for this window item. Must be the
407name of a \fIwindow\fR display style that has already be created with
408the \fBItemStyle\fR method.
409.IP "Name: \fBwindow\fR" 4
410.IX Item "Name: window"
411.PD 0
412.IP "Class: \fBWindow\fR" 4
413.IX Item "Class: Window"
414.IP "Switch: \fB\-window\fR" 4
415.IX Item "Switch: -window"
416.IP "Alias: \fB\-widget\fR" 4
417.IX Item "Alias: -widget"
418.PD
419Specifies the sub-window to display in the item.
420.Sh "Window Style Options"
421.IX Subsection "Window Style Options"
422\&\fB\s-1STYLE\s0 \s-1STANDARD\s0 \s-1OPTIONS\s0\fR
423.PP
424\&\fB\-anchor\fR \fB\-padx\fR \fB\-pady\fR
425.PP
426See Tk::options for details of the standard options.
427.SH "CREATING DISPLAY ITEMS"
428.IX Header "CREATING DISPLAY ITEMS"
429Display items do not exist on their and thus they cannot be created
430independently of the widgets they reside in. As a rule, display items
431are created by special methods of their ``host'' widgets. For
432example, the HList widgets has a method \fBitem\fR which can be used
433to create new display items. The following code creates a new text
434item at the third column of the entry foo inside an HList widget:
435.PP
436.Vb 3
437\& my $hlist = $parent->HList(-columns=>3);
438\& $hlist->add('foo');
439\& $hlist->itemCreate('foo', 2, -itemtype=>'text', -text=>'Hello');
440.Ve
441.PP
442The \fBitemCreate\fR method of the HList widget accepts a variable
443number of arguments. The special argument \fB\-itemtype\fR specifies
444which type of display item to create. Options that are valid for this
445type of display items can then be specified by one or more
446\&\fIoption-value\fR pairs.
447.PP
448After the display item is created, they can then be configured or
449destroyed using the methods provided by the host widget. For example,
450the HList widget has the methods \fBitemConfigure\fR, \fBitemCget\fR
451and \fBitemDelete\fR for accessing the display items.
452.SH "CREATING AND MANIPULATING ITEM STYLES"
453.IX Header "CREATING AND MANIPULATING ITEM STYLES"
454Item styles are created with \fBItemStyle\fR:
455.SH "SYNOPSIS"
456.IX Header "SYNOPSIS"
457\&\ \fI$widget\fR\->\fBItemStyle\fR(\fIitemType\fR ?,\fB\-stylename\fR=>\fIname\fR? ?,\fB\-refwindow\fR=>\fIpathName\fR? ?,\fIoption\fR=>\fIvalue\fR, ...>?);
458.PP
459\&\fIitemType\fR must be one of the existing display items types such as
460\&\fBtext\fR, \fBimagetext\fR, \fBwindow\fR or any new types added by
461the user. Additional arguments can be given in one or more
462\&\fIoption-value\fR pairs. \fIoption\fR can be any of the valid option
463for this display style or any of the following:
464.IP "\fB\-stylename\fR => \fIname\fR" 4
465.IX Item "-stylename => name"
466Specifies a name for this style. If unspecified, then a default name
467will be chosen for this style.
468.IP "\fB\-refwindow\fR => \fI$otherwidget\fR" 4
469.IX Item "-refwindow => $otherwidget"
470Specifies a window to use for determine the default values of the
471display type. If unspecified, the \fI$widget\fR will be used. Default
472values for the display types can be set via the options database. The
473following example sets the \fB\-disablebackground\fR and
474\&\fB\-disabledforeground\fR options of a \fBtext\fR display style via
475the option database:
476.Sp
477.Vb 3
478\& $widget->optionAdd('*table.list*disabledForeground' => 'blue');
479\& $widget->optionAdd('*table.list*disabledBackground' => 'darkgray');
480\& $widget->ItemStyle('text', -refwindow => $table_list, -fg => 'red');
481.Ve
482.Sp
483By using the option database to set the options of the display styles,
484we can advoid hard-coding the option values and give the user more
485flexibility in customization. See Tk::option for a detailed description
486of the option database.
487.SH "STYLE METHODS"
488.IX Header "STYLE METHODS"
489The \fBItemStyle\fR method creates an object.
490This object supports the \fBconfigure\fR and \fBcget\fR methods
491described in Tk::options which can be used to enquire and
492modify the options described above.
493.PP
494The following additional methods are available for item styles:
495.IP "\fI$style\fR\->\fBdelete\fR" 4
496.IX Item "$style->delete"
497Destroy this display style object.
498.SH "EXAMPLE"
499.IX Header "EXAMPLE"
500The following example creates two columns of data in a HList
501widget. The first column is in red and the second column in blue. The
502colors of the columns are controlled by two different \fBtext\fR
503styles. Also, the anchor and font of the second column is chosen so
504that the income data is aligned properly.
505.PP
506.Vb 4
507\& use strict;
508\& use Tk;
509\& use Tk::HList;
510\& use Tk::ItemStyle;
511.Ve
512.PP
513.Vb 1
514\& my $mw = MainWindow->new();
515.Ve
516.PP
517.Vb 1
518\& my $hlist = $mw->HList(-columns=>2)->pack;
519.Ve
520.PP
521.Vb 2
522\& my $red = $hlist->ItemStyle('text', -foreground=>'#800000');
523\& my $blue = $hlist->ItemStyle('text', -foreground=>'#000080', -anchor=>'e');
524.Ve
525.PP
526.Vb 9
527\& my $e;
528\& foreach ([Joe => '$10,000'], [Peter => '$20,000'],
529\& [Raj => '$90,000'], [Zinh => '$0']) {
530\& $e = $hlist->addchild("");
531\& $hlist->itemCreate($e, 0, -itemtype=>'text',
532\& -text=>$_->[0], -style=>$red );
533\& $hlist->itemCreate($e, 1, -itemtype=>'text',
534\& -text=>$_->[1], -style=>$blue);
535\& }
536.Ve
537.PP
538.Vb 1
539\& Tk::MainLoop;
540.Ve
541.SH "SEE ALSO"
542.IX Header "SEE ALSO"
543Tk::HList
544Tk::TixGrid
545Tk::TList
546.SH "KEYWORDS"
547.IX Header "KEYWORDS"
548display item, display style, item style