1Compound(3)           User Contributed Perl Documentation          Compound(3)
2
3
4

NAME

6       Tk::Compound - Create multi-line compound images.
7

SYNOPSIS

9           use Tk::Compound;
10           $image = $widget->Compound(name,options);
11           $image->Line(options);
12           $image->Text(options);
13           $image->Bitmap(options);
14           $image->Image(options);
15           $image->Space(options);
16

DESCRIPTION

18       Compound image types can be used to create images that consists of
19       multiple horizontal lines; each line is composed of a series of items
20       (texts, bitmaps, images or spaces) arranged from left to right.
21       Compound images are mainly used to embed complex drawings into widgets
22       that support the -image option. As shown in the EXAMPLE section below,
23       a compound image can be used to display a bitmap and a text string
24       simutaneously in a Tk Button widget.
25
26       Compound images can only be used on windows on the same display as, and
27       with the same pixel depth and visual as the $widget used to create
28       them.
29

CREATING COMPOUND IMAGES

31       Compounds are created using $widget->Compound.  Compounds support the
32       following options:
33
34       -background => color
35           Specifies the background color of the compound image. This color is
36           also used as the default background color for the bitmap items in
37           the compound image.
38
39       -borderwidth => pixels
40           Specifies a non-negative value indicating the width of the 3-D
41           border drawn around the compound image.
42
43       -font => font
44           Specifies the default font for the text items in the compound
45           image.
46
47       -foreground => color
48           Specifies the default foreground color for the bitmap and text
49           items in the compound image.
50
51       -padx => value
52           Specifies a non-negative value indicating how much extra space to
53           request for the compound image in the X-direction. The value may
54           have any of the forms acceptable to Tk_GetPixels(3).
55
56       -pady => value
57           Specifies a non-negative value indicating how much extra space to
58           request for the compound image in the Y-direction.
59
60       -relief => value
61           Specifies the 3-D effect desired for the background of the compound
62           image. Acceptable values are raised, sunken, flat, ridge, and
63           groove.
64
65       -showbackground => value
66           Specifies whether the background and the 3D borders should be
67           drawn.  Must be a valid boolean value. By default the background is
68           not drawn and the compound image appears to have a transparent
69           background.
70

IMAGE COMMAND

72       When a compound image is created, Tk also creates a new object.  This
73       object supports the configure and cget methods described in Tk::options
74       which can be used to enquire and modify the options described above.
75
76       The object also supports the following methods:
77
78       $compound->Line?(option = value ...>)?
79           Creates a new line at the bottom of the compound image. Lines
80           support the following options:
81
82           -anchor value
83               Specifies how the line should be aligned along the horizontal
84               axis.  When the values are w, sw or nw, the line is aligned to
85               the left. When the values are c, s or n, the line is aligned to
86               the middle.  When the values are e, se or ne, the line is
87               aligned to the right.
88
89           -padx => value
90               Specifies a non-negative value indicating how much extra space
91               to request for this line in the X-direction.
92
93       $compound->Itemtype?(option = value ...>)?
94           Creates a new item of the type Itemtype at the end of the last line
95           of the compound image. All types of items support these following
96           common options:
97
98           -anchor value
99               Specifies how the item should be aligned along the vertical
100               axis. When the values are n, nw or ne, the item is aligned to
101               the top of the line. When the values are c, w or e, the item is
102               aligned to the middle of the line.  When the values are s, se
103               or sw, the item is aligned to the bottom of the line.
104
105           -padx => value
106               Specifies a non-negative value indicating how much extra space
107               to request for this item in the X-direction.
108
109           -pady => value
110               Specifies a non-negative value indicating how much extra space
111               to request for this item in the Y-direction.
112
113           item-type can be any of the following:
114       $compound->Bitmap?(option = value ...>)?
115           Creates a new bitmap item of at the end of the last line of the
116           compound image. Additional options accepted by the bitmap type are:
117
118           -background => color
119               Specifies the background color of the bitmap item.
120
121           -bitmap => name
122               Specifies a bitmap to display in this item, in any of the forms
123               acceptable to Tk_GetBitmap(3).
124
125           -foreground => color
126               Specifies the foreground color of the bitmap item.
127
128       $compound->Image?(option = value ...>)?
129           Creates a new image item of at the end of the last line of the
130           compound image. Additional options accepted by the image type are:
131
132           -image => name
133               Specifies an image to display in this item. name must have been
134               created with the image create command.
135
136       $compound->Space?(option = value ...>)?
137           Creates a new space item of at the end of the last line of the
138           compound image. Space items do not display anything. They just acts
139           as space holders that add additional spaces between items inside a
140           compound image. Additional options accepted by the image type are:
141
142           -width => value
143               Specifies the width of this space. The value may have any of
144               the forms acceptable to Tk_GetPixels(3).
145
146           -height => value
147               Specifies the height of this space. The value may have any of
148               the forms acceptable to Tk_GetPixels(3).
149
150       $compound->Text?(option = value ...>)?
151           Creates a new text item of at the end of the last line of the
152           compound image. Additional options accepted by the text type are:
153
154           -background => color
155               Specifies the background color of the text item.
156
157           -font => name
158               Specifies the font to be used for this text item.
159
160           -foreground => color
161               Specifies the foreground color of the text item.
162
163           -justify value
164               When there are multiple lines of text displayed in a text item,
165               this option determines how the lines line up with each other.
166               value must be one of left, center, or right.  Left means that
167               the lines' left edges all line up, center means that the lines'
168               centers are aligned, and right means that the lines' right
169               edges line up.
170
171           -text => string
172               Specifies a text string to display in this text item.
173
174           -underline value
175               Specifies the integer index of a character to underline in the
176               text item. 0 corresponds to the first character of the text
177               displayed in the text item, 1 to the next character, and so on.
178
179           -wraplength value
180               This option specifies the maximum line length of the label
181               string on this text item. If the line length of the label
182               string exceeds this length, it is wrapped onto the next line,
183               so that no line is longer than the specified length. The value
184               may be specified in any of the standard forms for screen
185               distances. If this value is less than or equal to 0 then no
186               wrapping is done: lines will break only at newline characters
187               in the text.
188

EXAMPLE

190       The following example creates a compound image with a bitmap and a text
191       string and places this image into a Button(n) widget. Notice that the
192       image must be created using the widget that it resides in.
193
194         my $b = $parent->Button;
195         my $c = $b->Compound;
196         $b->configure(-image => $c);
197         $c->Line;
198         $c->Bitmap(-bitmap => 'warning');
199         $c->Space(-width => 8);
200         $c->Text(-text => "Warning", -underline => 0);
201         $b->pack;
202

KEYWORDS

204       image(n), Tix(n)
205
206
207
208perl v5.38.0                      2023-07-21                       Compound(3)
Impressum