File: Geometry.tmml

package info (click to toggle)
tile 0.8.2-2.1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 3,152 kB
  • ctags: 3,093
  • sloc: ansic: 18,144; tcl: 4,607; makefile: 398; sh: 71
file content (379 lines) | stat: -rw-r--r-- 10,819 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
<manpage cat="fun" id="Geometry" title="Geometry" version="0.2">
<!-- This file was automatically generated.  DO NOT EDIT (yet)! -->
<!-- 
     Copyright (c) 2004 Joe English
    
     RCS: @(#) Geometry.3,v 1.7 2004/12/11 00:36:36 jenglish Exp
 -->
<?TROFF.TH title="Geometry" section="3" date="0.2" source="tile" manual="Tile Widget Set" ?>
<namesection>
<title>geometry</title>
<name>Ttk_MakeBox</name>
<name>Ttk_PadBox</name>
<name>Ttk_ExpandBox</name>
<name>Ttk_PackBox</name>
<name>Ttk_StickBox</name>
<name>Ttk_PlaceBox</name>
<name>Ttk_BoxContains</name>
<name>Ttk_MakePadding</name>
<name>Ttk_UniformPadding</name>
<name>Ttk_AddPadding</name>
<name>Ttk_RelievePadding</name>
<name>Ttk_GetPaddingFromObj</name>
<name>Ttk_GetBorderFromObj</name>
<name>Ttk_GetStickyFromObj</name>
<desc>Geometry utilities</desc>
</namesection>
<synopsis>
<syntax>
<b>#include &lt;tkTheme.h&gt;</b>

Ttk_Box
<b>Ttk_MakeBox</b>(int <m>x</m>, int <m>y</m>, int <m>width</m>, int <m>height</m>);

Ttk_Box
<b>Ttk_PadBox</b>(Ttk_Box <m>parcel</m>, Ttk_Padding <m>padding</m>);

Ttk_Box
<b>Ttk_ExpandBox</b>(Ttk_Box <m>parcel</m>, Ttk_Padding <m>padding</m>);

Ttk_Box
<b>Ttk_PackBox</b>(Ttk_Box *<m>cavity</m>, int <m>width</m>, int <m>height</m>, Ttk_Side <m>side</m>);

Ttk_Box
<b>Ttk_StickBox</b>(Ttk_Box <m>parcel</m>, int <m>width</m>, int <m>height</m>, unsigned <m>sticky</m>);

Ttk_Box
<b>Ttk_PlaceBox</b>(Ttk_Box *<m>cavity</m>, int <m>width</m>, int <m>height</m>, Ttk_Side <m>side</m>, unsigned <m>sticky</m>);

Ttk_Box
<b>Ttk_AnchorBox</b>(Ttk_Box <m>parcel</m>, int <m>width</m>, int <m>height</m>, Tk_Anchor <m>anchor</m>);

Ttk_Padding
<b>Ttk_MakePadding</b>(short <m>left</m>, short <m>top</m>, short <m>right</m>, short <m>bottom</m>);

Ttk_Padding
<b>Ttk_UniformPadding</b>(short <m>border</m>);

Ttk_Padding
<b>Ttk_AddPadding</b>(Ttk_Padding <m>padding1</m>, Ttk_Padding <m>padding2</m>;

Ttk_Padding 
<b>Ttk_RelievePadding</b>(Ttk_Padding <m>padding</m>, int <m>relief</m>);

int
<b>Ttk_BoxContains</b>(Ttk_Box <m>box</m>, int <m>x</m>, int <m>y</m>);

int
<b>Ttk_GetPaddingFromObj</b>(
    Tcl_Interp *<m>interp</m>, Tk_Window <m>tkwin</m>,
    Tcl_Obj *<m>objPtr</m>, Ttk_Padding *<m>padding_rtn</m>);

int
<b>Ttk_GetBorderFromObj</b>(
    Tcl_Interp *<m>interp</m>, Tcl_Obj *<m>objPtr</m>, Ttk_Padding *<m>padding_rtn</m>);

int
<b>Ttk_GetStickyFromObj</b>(Tcl_Interp *<m>interp</m>, Tcl_Obj *<m>objPtr</m>, int *<m>sticky_rtn</m>);
</syntax>
</synopsis>
<section>
<title>ARGUMENTS</title>
<arglist>
<argdef>
<argtype>Tk_Anchor</argtype>
<name>anchor</name>
<argmode>in</argmode>
<desc>One of the symbolic constants <b>TK_ANCHOR_N</b>, <b>TK_ANCHOR_NE</b>,
etc.  See <i>Tk_GetAnchorFromObj(3)</i>.
</desc>
</argdef>
<argdef>
<argtype>Ttk_Box *</argtype>
<name>cavity</name>
<argmode>in/out</argmode>
<desc>A rectangular region from which a parcel is allocated.
</desc>
</argdef>
<argdef>
<argtype>short</argtype>
<name>border</name>
<argmode>in</argmode>
<desc>Extra padding (in pixels) to add uniformly to each side of a region.
</desc>
</argdef>
<argdef>
<argtype>short</argtype>
<name>bottom</name>
<argmode>in</argmode>
<desc>Extra padding (in pixels) to add to the bottom of a region.
</desc>
</argdef>
<argdef>
<argtype>Ttk_Box</argtype>
<name>box</name>
<argmode>in</argmode>
<desc/>
</argdef>
<argdef>
<argtype>Ttk_Box *</argtype>
<name>box_rtn</name>
<argmode>out</argmode>
<desc>Specifies a rectangular region.
</desc>
</argdef>
<argdef>
<argtype>int</argtype>
<name>height</name>
<argmode>in</argmode>
<desc>The height in pixels of a region.
</desc>
</argdef>
<argdef>
<argtype>Tcl_Interp *</argtype>
<name>interp</name>
<argmode>in</argmode>
<desc>Used to store error messages.
</desc>
</argdef>
<argdef>
<argtype>int</argtype>
<name>left</name>
<argmode>in</argmode>
<desc>Extra padding (in pixels) to add to the left side of a region.
</desc>
</argdef>
<argdef>
<argtype>Tcl_Obj *</argtype>
<name>objPtr</name>
<argmode>in</argmode>
<desc>String value contains a symbolic name 
to be converted to an enumerated value or bitmask.
Internal rep may be be modified to cache corresponding value.
</desc>
</argdef>
<argdef>
<argtype>Ttk_Padding</argtype>
<name>padding</name>
<argmode>in</argmode>
<desc/>
</argdef>
<argdef>
<argtype>Ttk_Padding *</argtype>
<name>padding_rtn</name>
<argmode>out</argmode>
<desc>Extra padding to add on the inside of a region.
</desc>
</argdef>
<argdef>
<argtype>Ttk_Box</argtype>
<name>parcel</name>
<argmode>in</argmode>
<desc>A rectangular region, allocated from a cavity.
</desc>
</argdef>
<argdef>
<argtype>int</argtype>
<name>relief</name>
<argmode>in</argmode>
<desc>One of the standard Tk relief options 
(TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, etc.).  
See <fun>Tk_GetReliefFromObj</fun>.
</desc>
</argdef>
<argdef>
<argtype>short</argtype>
<name>right</name>
<argmode>in</argmode>
<desc>Extra padding (in pixles) to add to the right side of a region.
</desc>
</argdef>
<argdef>
<argtype>Ttk_Side</argtype>
<name>side</name>
<argmode>in</argmode>
<desc>One of <b>TTK_SIDE_LEFT</b>, <b>TTK_SIDE_TOP</b>, 
<b>TTK_SIDE_RIGHT</b>, or <b>TTK_SIDE_BOTTOM</b>.
</desc>
</argdef>
<argdef>
<argtype>unsigned</argtype>
<name>sticky</name>
<argmode>in</argmode>
<desc>A bitmask containing one or more of the bits
<b>TTK_STICK_W</b> (west, or left), 
<b>TTK_STICK_E</b> (east, or right, 
<b>TTK_STICK_N</b> (north, or top), and
<b>TTK_STICK_S</b> (south, or bottom).
<b>TTK_FILL_X</b> is defined as a synonym for (TTK_STICK_W|TTK_STICK_E),
<b>TTK_FILL_Y</b> is a synonym for (TTK_STICK_N|TTK_STICK_S),
and  <b>TTK_FILL_BOTH</b> and <b>TTK_STICK_ALL</b>
are synonyms for (TTK_FILL_X|TTK_FILL_Y).
See also: <i>grid(n)</i>.
</desc>
</argdef>
<argdef>
<argtype>Tk_Window</argtype>
<name>tkwin</name>
<argmode>in</argmode>
<desc>Window whose screen geometry determines 
the conversion between absolute units and pixels.
</desc>
</argdef>
<argdef>
<argtype>short</argtype>
<name>top</name>
<argmode>in</argmode>
<desc>Extra padding at the top of a region.
</desc>
</argdef>
<argdef>
<argtype>int</argtype>
<name>width</name>
<argmode>in</argmode>
<desc>The width in pixels of a region.
</desc>
</argdef>
<argdef>
<argtype>int</argtype>
<name>x</name>
<argmode>in</argmode>
<desc>X coordinate of upper-left corner of region.
</desc>
</argdef>
<argdef>
<argtype>int</argtype>
<name>y</name>
<argmode>in</argmode>
<desc>Y coordinate of upper-left corner of region.
</desc>
</argdef>
</arglist>
</section>


<section>
<title>BOXES</title>
<p>The <b>Ttk_Box</b> structure represents a rectangular region of a window: 
</p>
<syntax cat="type" name="Ttk_Box" scope="global">
typedef struct 	{
    int x;
    int y;
    int width;
    int height;
} Ttk_Box;
</syntax>
<p>All coordinates are relative to the window.
</p>
<p><b>Ttk_MakeBox</b> is a convenience routine that contsructs
a <b>Ttk_Box</b> structure representing a region <i>width</i> pixels
wide, <i>height</i> pixels tall, at the specified <i>x, y</i> coordinates.
</p>
<p><b>Ttk_PadBox</b> returns a new box located inside the specified <i>parcel</i>,
shrunken according to the left, top, right, and bottom margins 
specified by <i>padding</i>.
</p>
<p><b>Ttk_ExpandBox</b> is the inverse of <b>Ttk_PadBox</b>:
it returns a new box surrounding the specified <i>parcel</i>,
expanded  according to the left, top, right, and bottom margins 
specified by <i>padding</i>.
</p>
<p><b>Ttk_PackBox</b> allocates a parcel <i>width</i> by <i>height</i>
pixels wide on the specified <i>side</i> of the <i>cavity</i>,
and shrinks the <i>cavity</i> accordingly.
</p>
<p><b>Ttk_StickBox</b> places a box with the requested <i>width</i>
and <i>height</i> inside the <i>parcel</i> according to the 
<i>sticky</i> bits.
</p>
<p><b>Ttk_PlaceBox</b> combines <b>Ttk_PackBox</b> and <b>Ttk_StickBox</b>:
it allocates a parcel on the specified <i>side</i> of the <i>cavity</i>,
places a box of the requested size inside the parcel according to <i>sticky</i>,
and shrinks the <i>cavity</i>.
</p>
<p><b>Ttk_AnchorBox</b> places a box with the requested <i>width</i>
and <i>height</i> inside the <i>parcel</i> according to the
specified <i>anchor</i> option.
</p>
<p><b>Ttk_BoxContains</b> tests if the specified <i>x, y</i> coordinate
lies within the rectangular region <i>box</i>.
</p>
</section>
<section>
<title>PADDDING</title>
<p>The <b>Ttk_Padding</b> structure is used to represent 
borders, internal padding, and external margins:
</p>
<syntax cat="type" name="Ttk_Padding" scope="global">
typedef struct {
    short left;
    short top;
    short right;
    short bottom;
} Ttk_Padding;
</syntax>
<p><b>Ttk_MakePadding</b> is a convenience routine that contsructs
a <b>Ttk_Padding</b> structure with the specified left, top, right, and bottom
components.  
</p>
<p><b>Ttk_UniformPadding</b> constructs a <b>Ttk_Padding</b> structure
with all components equal to the specified <i>border</i>.
</p>
<p><b>Ttk_AddPadding</b> adds two <b>Ttk_Padding</b>s together
and returns a combined padding containing the sum of the
individual padding components.
</p>
<p><b>Ttk_RelievePadding</b> 
adds an extra 2 pixels of padding to <i>padding</i>
according to the specified <i>relief</i>.
If <i>relief</i> is <b>TK_RELIEF_SUNKEN</b>, 
adds two pixels at the top and left
so the inner region is shifted down and to the left.
If it is <b>TK_RELIEF_RAISED</b>, adds two pixels
at the bottom and right so 
the inner region is shifted up and to the right.
Otherwise, adds 1 pixel on all sides.
This is typically used in element geometry procedures to simulate 
a "pressed-in" look for pushbuttons.

</p>
</section>
<section>
<title>CONVERSION ROUTINES</title>
<p><b>Ttk_GetPaddingFromObj</b> converts the string in <i>objPtr</i>
to a <b>Ttk_Padding</b> structure.
The string representation is a list of 
up to four length specifications 
<i>"left top right bottom"</i>.  
If fewer than four elements are specified, 
<i>bottom</i> defaults to <i>top</i>,
<i>right</i> defaults to <i>left</i>, and 
<i>top</i> defaults to <i>left</i>.
See <b>Tk_GetPixelsFromObj(3)</b> for the syntax of length specifications.
</p>
<p><b>Ttk_GetBorderFromObj</b> is the same as <b>Ttk_GetPaddingFromObj</b>
except that the lengths are specified as integers 
(i.e., resolution-dependant values like <i>3m</i> are not allowed).
</p>
<p><b>Ttk_GetStickyFromObj</b> converts the string in <i>objPtr</i>
to a <i>sticky</i> bitmask.  The string contains zero or more
of the characters <b>n</b>, <b>s</b>, <b>e</b>, or <b>w</b>.

</p>
</section>
<seealso>
<ref>Tk_GetReliefFromObj(3)</ref>
<ref>Tk_GetPixelsFromObj(3)</ref>
<ref>Tk_GetAnchorFromObj(3)</ref>
</seealso>
<keywords>
<keyword>geometry</keyword>
<keyword>padding</keyword>
<keyword>margins</keyword>
<keyword>box</keyword>
<keyword>region</keyword>
<keyword>sticky</keyword>
<keyword>relief</keyword>
</keywords>
</manpage>