Debian Codegraph @

pod/Compound.pod

raw
1 # Copyright (c) 1996, Expert Interface Technologies
2 # See the file "license.terms" for information on usage and redistribution
3 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
4 #
5 # The file man.macros and some of the macros used by this file are
6 # copyrighted: (c) 1990 The Regents of the University of California.
7 # (c) 1994-1995 Sun Microsystems, Inc.
8 # The license terms of the Tcl/Tk distrobution are in the file
9 # license.tcl.
10
11 =head1 NAME
12
13 Tk::Compound - Create multi-line compound images.
14
15 =for category Tk Image Classes
16
17 =head1 SYNOPSIS
18
19 use Tk::Compound;
20 $image = $widget->Compound(name,options);
21 $image->Line(options);
22 $image->Text(options);
23 $image->Bitmap(options);
24 $image->Image(options);
25 $image->Space(options);
26
27 =for comment
28 This paragraph used to be written different, but perldoc 3.14 cannot
29 display this paragraph.
30 S< >use Tk::Compound;
31 S< >I<$image> = I<$widget>-E<gt>B<Compound>?(I<name>??,I<options>?)
32 S< >I<$image>-E<gt>B<Line>?(I<options>?)
33 S< >I<$image>-E<gt>B<Text>?(I<options>?)
34 S< >I<$image>-E<gt>B<Bitmap>?(I<options>?)
35 S< >I<$image>-E<gt>B<Image>?(I<options>?)
36 S< >I<$image>-E<gt>B<Space>?(I<options>?)
37
38 =head1 DESCRIPTION
39
40 Compound image types can be used to create images that consists of
41 multiple horizontal lines; each line is composed of a series of items
42 (texts, bitmaps, images or spaces) arranged from left to
43 right. Compound images are mainly used to embed complex drawings into
44 widgets that support the B<-image> option. As shown in the EXAMPLE
45 section below, a compound image can be used to display a bitmap and a
46 text string simutaneously in a Tk B<Button> widget.
47
48 Compound images can only be used on windows on the same display as, and
49 with the same pixel depth and visual as the I<$widget> used to create them.
50
51 =head1 CREATING COMPOUND IMAGES
52
53 Compounds are created using I<$widget>-E<gt>B<Compound>.
54 Compounds support the following I<options>:
55
56 =over 4
57
58 =item B<-background> =E<gt> I<color>
59
60 Specifies the background color of the compound image. This color is
61 also used as the default background color for the bitmap items in the
62 compound image.
63
64 =item B<-borderwidth> =E<gt> I<pixels>
65
66 Specifies a non-negative value indicating the width of the 3-D border
67 drawn around the compound image.
68
69 =item B<-font> =E<gt> I<font>
70
71 Specifies the default font for the text items in the compound image.
72
73 =item B<-foreground> =E<gt> I<color>
74
75 Specifies the default foreground color for the bitmap and text items
76 in the compound image.
77
78 =item B<-padx> =E<gt> I<value>
79
80 Specifies a non-negative value indicating how much extra space to
81 request for the compound image in the X-direction. The I<value> may
82 have any of the forms acceptable to B<Tk_GetPixels(3)>.
83
84 =item B<-pady> =E<gt> I<value>
85
86 Specifies a non-negative value indicating how much extra space to
87 request for the compound image in the Y-direction.
88
89 =item B<-relief> =E<gt> I<value>
90
91 Specifies the 3-D effect desired for the background of the compound
92 image. Acceptable values are B<raised>, B<sunken>, B<flat>,
93 B<ridge>, and B<groove>.
94
95 =item B<-showbackground> =E<gt> I<value>
96
97 Specifies whether the background and the 3D borders should be drawn.
98 Must be a valid boolean value. By default the background is not drawn
99 and the compound image appears to have a transparent background.
100
101
102 =back
103
104 =head1 IMAGE COMMAND
105
106 When a compound image is created, Tk also creates a new object.
107 This object supports the B<configure> and B<cget> methods
108 described in L<Tk::options> which can be used to enquire and
109 modify the options described above.
110
111 The object also supports the following methods:
112
113 =over 4
114
115 =item I<$compound>-E<gt>B<Line>?(I<option => value ...>)?
116
117 Creates a new line at the bottom of the compound image. Lines support
118 the following I<options>:
119
120 =over 4
121
122 =item B<-anchor> value
123
124 Specifies how the line should be aligned along the horizontal axis.
125 When the values are B<w>, B<sw> or B<nw>, the line is aligned
126 to the left. When the values are B<c>, B<s> or B<n>, the line
127 is aligned to the middle. When the values are B<e>, B<se> or
128 B<ne>, the line is aligned to the right.
129
130 =item B<-padx> =E<gt> I<value>
131
132 Specifies a non-negative value indicating how much extra space to
133 request for this line in the X-direction.
134
135 =back
136
137 =item I<$compound>-E<gt>I<Itemtype>?(I<option => value ...>)?
138
139 Creates a new item of the type I<Itemtype> at the end of the last
140 line of the compound image. All types of items support
141 these following common I<options>:
142
143 =over 4
144
145 =item B<-anchor> value
146
147 Specifies how the item should be aligned along the vertical axis. When
148 the values are B<n>, B<nw> or B<ne>, the item is aligned to
149 the top of the line. When the values are B<c>, B<w> or B<e>,
150 the item is aligned to the middle of the line. When the values are
151 B<s>, B<se> or B<sw>, the item is aligned to the bottom of
152 the line.
153
154 =item B<-padx> =E<gt> I<value>
155
156 Specifies a non-negative value indicating how much extra space to
157 request for this item in the X-direction.
158
159 =item B<-pady> =E<gt> I<value>
160
161 Specifies a non-negative value indicating how much extra space to
162 request for this item in the Y-direction.
163
164 =item I<item-type> can be any of the following:
165
166 =back
167
168 =item I<$compound>-E<gt>B<Bitmap>?(I<option => value ...>)?
169
170 Creates a new bitmap item of at the end of the last
171 line of the compound image. Additional I<options> accepted by the
172 bitmap type are:
173
174 =over 4
175
176 =item B<-background> =E<gt> I<color>
177
178 Specifies the background color of the bitmap item.
179
180 =item B<-bitmap> =E<gt> I<name>
181
182 Specifies a bitmap to display in this item, in any of the forms
183 acceptable to B<Tk_GetBitmap(3)>.
184
185 =item B<-foreground> =E<gt> I<color>
186
187 Specifies the foreground color of the bitmap item.
188
189 =back
190
191 =item I<$compound>-E<gt>B<Image>?(I<option => value ...>)?
192
193 Creates a new image item of at the end of the last
194 line of the compound image. Additional I<options> accepted by the
195 image type are:
196
197 =over 4
198
199 =item B<-image> =E<gt> I<name>
200
201 Specifies an image to display in this item. I<name>
202 must have been created with the B<image create> command.
203
204 =back
205
206 =item I<$compound>-E<gt>B<Space>?(I<option => value ...>)?
207
208 Creates a new space item of at the end of the last line of the
209 compound image. Space items do not display anything. They just acts as
210 space holders that add additional spaces between items inside a
211 compound image. Additional I<options> accepted by the image type
212 are:
213
214 =over 4
215
216 =item B<-width> =E<gt> I<value>
217
218 Specifies the width of this space. The I<value> may have any of the
219 forms acceptable to B<Tk_GetPixels(3)>.
220
221 =item B<-height> =E<gt> I<value>
222
223 Specifies the height of this space. The I<value> may have any of
224 the forms acceptable to B<Tk_GetPixels(3)>.
225
226 =back
227
228 =item I<$compound>-E<gt>B<Text>?(I<option => value ...>)?
229
230 Creates a new text item of at the end of the last line of the compound
231 image. Additional I<options> accepted by the text type are:
232
233 =over 4
234
235 =item B<-background> =E<gt> I<color>
236
237 Specifies the background color of the text item.
238
239 =item B<-font> =E<gt> I<name>
240
241 Specifies the font to be used for this text item.
242
243 =item B<-foreground> =E<gt> I<color>
244
245 Specifies the foreground color of the text item.
246
247 =item B<-justify> I<value>
248
249 When there are multiple lines of text displayed in a text item, this
250 option determines how the lines line up with each other. I<value>
251 must be one of B<left>, B<center>, or B<right>. B<Left>
252 means that the lines' left edges all line up, B<center> means that
253 the lines' centers are aligned, and B<right> means that the lines'
254 right edges line up.
255
256 =item B<-text> =E<gt> I<string>
257
258 Specifies a text string to display in this text item.
259
260 =item B<-underline> I<value>
261
262 Specifies the integer index of a character to underline in the text
263 item. 0 corresponds to the first character of the text displayed in
264 the text item, 1 to the next character, and so on.
265
266 =item B<-wraplength> I<value>
267
268 This option specifies the maximum line length of the label string on
269 this text item. If the line length of the label string exceeds this
270 length, it is wrapped onto the next line, so that no line is longer
271 than the specified length. The value may be specified in any of the
272 standard forms for screen distances. If this value is less than or
273 equal to 0 then no wrapping is done: lines will break only at newline
274 characters in the text.
275
276 =back
277
278 =back
279
280 =head1 EXAMPLE
281
282 The following example creates a compound image with a bitmap and a
283 text string and places this image into a B<Button(n)>
284 widget. Notice that the image must be created using the widget
285 that it resides in.
286
287 my $b = $parent->Button;
288 my $c = $b->Compound;
289 $b->configure(-image => $c);
290 $c->Line;
291 $c->Bitmap(-bitmap => 'warning');
292 $c->Space(-width => 8);
293 $c->Text(-text => "Warning", -underline => 0);
294 $b->pack;
295
296 =head1 KEYWORDS
297
298 image(n), Tix(n)