1Geometry(3) Tk Themed Widget Geometry(3)
2
3
4
5______________________________________________________________________________
6
8 Ttk_MakeBox, Ttk_PadBox, Ttk_ExpandBox, Ttk_PackBox, Ttk_StickBox,
9 Ttk_PlaceBox, Ttk_BoxContains, Ttk_MakePadding, Ttk_UniformPadding,
10 Ttk_AddPadding, Ttk_RelievePadding, Ttk_GetPaddingFromObj, Ttk_GetBor‐
11 derFromObj, Ttk_GetStickyFromObj - Tk themed geometry utilities
12
14 #include <tkTheme.h>
15
16 Ttk_Box
17 Ttk_MakeBox(int x, int y, int width, int height);
18
19 Ttk_Box
20 Ttk_PadBox(Ttk_Box parcel, Ttk_Padding padding);
21
22 Ttk_Box
23 Ttk_ExpandBox(Ttk_Box parcel, Ttk_Padding padding);
24
25 Ttk_Box
26 Ttk_PackBox(Ttk_Box *cavity, int width, int height, Ttk_Side side);
27
28 Ttk_Box
29 Ttk_StickBox(Ttk_Box parcel, int width, int height, unsigned sticky);
30
31 Ttk_Box
32 Ttk_PlaceBox(Ttk_Box *cavity, int width, int height, Ttk_Side side, unsigned sticky);
33
34 Ttk_Box
35 Ttk_AnchorBox(Ttk_Box parcel, int width, int height, Tk_Anchor anchor);
36
37 Ttk_Padding
38 Ttk_MakePadding(short left, short top, short right, short bottom);
39
40 Ttk_Padding
41 Ttk_UniformPadding(short border);
42
43 Ttk_Padding
44 Ttk_AddPadding(Ttk_Padding padding1, Ttk_Padding padding2;
45
46 Ttk_Padding
47 Ttk_RelievePadding(Ttk_Padding padding, int relief);
48
49 int
50 Ttk_BoxContains(Ttk_Box box, int x, int y);
51
52 int
53 Ttk_GetPaddingFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Ttk_Padding *padding_rtn);
54
55 int
56 Ttk_GetBorderFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Padding *padding_rtn);
57
58 int
59 Ttk_GetStickyFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *sticky_rtn);
60
62 Tk_Anchor anchor (in) One of the symbolic constants
63 TK_ANCHOR_N, TK_ANCHOR_NE,
64 etc. See Tk_GetAnchorFro‐
65 mObj(3).
66
67 Ttk_Box * cavity (in/out) A rectangular region from
68 which a parcel is allocated.
69
70 short border (in) Extra padding (in pixels) to
71 add uniformly to each side of
72 a region.
73
74 short bottom (in) Extra padding (in pixels) to
75 add to the bottom of a
76 region.
77
78 Ttk_Box box (in)
79
80 Ttk_Box * box_rtn (out) Specifies a rectangular
81 region.
82
83 int height (in) The height in pixels of a
84 region.
85
86 Tcl_Interp * interp (in) Used to store error messages.
87
88 int left (in) Extra padding (in pixels) to
89 add to the left side of a
90 region.
91
92 Tcl_Obj * objPtr (in) String value contains a sym‐
93 bolic name to be converted to
94 an enumerated value or bit‐
95 mask. Internal rep may be be
96 modified to cache correspond‐
97 ing value.
98
99 Ttk_Padding padding (in)
100
101 Ttk_Padding * padding_rtn (out) Extra padding to add on the
102 inside of a region.
103
104 Ttk_Box parcel (in) A rectangular region, allo‐
105 cated from a cavity.
106
107 int relief (in) One of the standard Tk relief
108 options (TK_RELIEF_RAISED,
109 TK_RELIEF_SUNKEN, etc.). See
110 Tk_GetReliefFromObj.
111
112 short right (in) Extra padding (in pixles) to
113 add to the right side of a
114 region.
115
116 Ttk_Side side (in) One of TTK_SIDE_LEFT,
117 TTK_SIDE_TOP, TTK_SIDE_RIGHT,
118 or TTK_SIDE_BOTTOM.
119
120 unsigned sticky (in) A bitmask containing one or
121 more of the bits TTK_STICK_W
122 (west, or left), TTK_STICK_E
123 (east, or right, TTK_STICK_N
124 (north, or top), and
125 TTK_STICK_S (south, or bot‐
126 tom). TTK_FILL_X is defined
127 as a synonym for
128 (TTK_STICK_W|TTK_STICK_E),
129 TTK_FILL_Y is a synonym for
130 (TTK_STICK_N|TTK_STICK_S),
131 and TTK_FILL_BOTH and
132 TTK_STICK_ALL are synonyms
133 for (TTK_FILL_X|TTK_FILL_Y).
134 See also: grid(n).
135
136 Tk_Window tkwin (in) Window whose screen geometry
137 determines the conversion
138 between absolute units and
139 pixels.
140
141 short top (in) Extra padding at the top of a
142 region.
143
144 int width (in) The width in pixels of a
145 region.
146
147 int x (in) X coordinate of upper-left
148 corner of region.
149
150 int y (in) Y coordinate of upper-left
151 corner of region.
152_________________________________________________________________
153
155 The Ttk_Box structure represents a rectangular region of a window:
156 typedef struct {
157 int x;
158 int y;
159 int width;
160 int height;
161 } Ttk_Box;
162 All coordinates are relative to the window.
163
164 Ttk_MakeBox is a convenience routine that contsructs a Ttk_Box struc‐
165 ture representing a region width pixels wide, height pixels tall, at
166 the specified x, y coordinates.
167
168 Ttk_PadBox returns a new box located inside the specified parcel,
169 shrunken according to the left, top, right, and bottom margins speci‐
170 fied by padding.
171
172 Ttk_ExpandBox is the inverse of Ttk_PadBox: it returns a new box sur‐
173 rounding the specified parcel, expanded according to the left, top,
174 right, and bottom margins specified by padding.
175
176 Ttk_PackBox allocates a parcel width by height pixels wide on the spec‐
177 ified side of the cavity, and shrinks the cavity accordingly.
178
179 Ttk_StickBox places a box with the requested width and height inside
180 the parcel according to the sticky bits.
181
182 Ttk_PlaceBox combines Ttk_PackBox and Ttk_StickBox: it allocates a par‐
183 cel on the specified side of the cavity, places a box of the requested
184 size inside the parcel according to sticky, and shrinks the cavity.
185
186 Ttk_AnchorBox places a box with the requested width and height inside
187 the parcel according to the specified anchor option.
188
189 Ttk_BoxContains tests if the specified x, y coordinate lies within the
190 rectangular region box.
191
193 The Ttk_Padding structure is used to represent borders, internal pad‐
194 ding, and external margins:
195 typedef struct {
196 short left;
197 short top;
198 short right;
199 short bottom;
200 } Ttk_Padding;
201
202 Ttk_MakePadding is a convenience routine that contsructs a Ttk_Padding
203 structure with the specified left, top, right, and bottom components.
204
205 Ttk_UniformPadding constructs a Ttk_Padding structure with all compo‐
206 nents equal to the specified border.
207
208 Ttk_AddPadding adds two Ttk_Paddings together and returns a combined
209 padding containing the sum of the individual padding components.
210
211 Ttk_RelievePadding adds an extra 2 pixels of padding to padding accord‐
212 ing to the specified relief. If relief is TK_RELIEF_SUNKEN, adds two
213 pixels at the top and left so the inner region is shifted down and to
214 the left. If it is TK_RELIEF_RAISED, adds two pixels at the bottom and
215 right so the inner region is shifted up and to the right. Otherwise,
216 adds 1 pixel on all sides. This is typically used in element geometry
217 procedures to simulate a “pressed-in” look for pushbuttons.
218
220 Ttk_GetPaddingFromObj converts the string in objPtr to a Ttk_Padding
221 structure. The string representation is a list of up to four length
222 specifications “left top right bottom”. If fewer than four elements
223 are specified, bottom defaults to top, right defaults to left, and top
224 defaults to left. See Tk_GetPixelsFromObj(3) for the syntax of length
225 specifications.
226
227 Ttk_GetBorderFromObj is the same as Ttk_GetPaddingFromObj except that
228 the lengths are specified as integers (i.e., resolution-dependant val‐
229 ues like 3m are not allowed).
230
231 Ttk_GetStickyFromObj converts the string in objPtr to a sticky bitmask.
232 The string contains zero or more of the characters n, s, e, or w.
233
235 Tk_GetReliefFromObj(3), Tk_GetPixelsFromObj(3), Tk_GetAnchorFromObj(3)
236
238 geometry, padding, margins, box, region, sticky, relief
239
240
241
242Tk 8.5 Geometry(3)