1Geometry(3)                    Tk Themed Widget                    Geometry(3)
2
3
4
5______________________________________________________________________________
6

NAME

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

SYNOPSIS

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

ARGUMENTS

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 re‐
76                                                 gion.
77
78       Ttk_Box box (in)                          Specifies a  rectangular  re‐
79                                                 gion.
80
81       Ttk_Box * box_rtn (out)                   A rectangular region.
82
83       int height (in)                           The height in pixels of a re‐
84                                                 gion.
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 re‐
90                                                 gion.
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)                  Extra  padding  to add on the
100                                                 inside of a region.
101
102       Ttk_Padding * padding_rtn (out)           Padding present in the inside
103                                                 of a region.
104
105       Ttk_Box parcel (in)                       A  rectangular  region, allo‐
106                                                 cated from a cavity.
107
108       int relief (in)                           One of the standard Tk relief
109                                                 options    (TK_RELIEF_RAISED,
110                                                 TK_RELIEF_SUNKEN, etc.).  See
111                                                 Tk_GetReliefFromObj.
112
113       short right (in)                          Extra  padding (in pixels) to
114                                                 add to the right  side  of  a
115                                                 region.
116
117       Ttk_Side side (in)                        One     of     TTK_SIDE_LEFT,
118                                                 TTK_SIDE_TOP, TTK_SIDE_RIGHT,
119                                                 or TTK_SIDE_BOTTOM.
120
121       unsigned sticky (in)                      A  bitmask  containing one or
122                                                 more of the bits  TTK_STICK_W
123                                                 (west,  or left), TTK_STICK_E
124                                                 (east, or right), TTK_STICK_N
125                                                 (north,    or    top),    and
126                                                 TTK_STICK_S (south,  or  bot‐
127                                                 tom).   TTK_FILL_X is defined
128                                                 as     a     synonym      for
129                                                 (TTK_STICK_W|TTK_STICK_E),
130                                                 TTK_FILL_Y is a  synonym  for
131                                                 (TTK_STICK_N|TTK_STICK_S),
132                                                 and  TTK_FILL_BOTH is a  syn‐
133                                                 onym                      for
134                                                 (TTK_FILL_X|TTK_FILL_Y).  See
135                                                 also: grid(n).
136
137       Tk_Window tkwin (in)                      Window  whose screen geometry
138                                                 determines the conversion be‐
139                                                 tween absolute units and pix‐
140                                                 els.
141
142       short top (in)                            Extra padding at the top of a
143                                                 region.
144
145       int width (in)                            The  width in pixels of a re‐
146                                                 gion.
147
148       int x (in)                                X  coordinate  of  upper-left
149                                                 corner of region.
150
151       int y (in)                                Y  coordinate  of  upper-left
152                                                 corner of region.
153______________________________________________________________________________
154

BOXES

156       The Ttk_Box structure represents a rectangular region of a window:
157              typedef struct {
158                  int x;
159                  int y;
160                  int width;
161                  int height;
162              } Ttk_Box;
163       All coordinates are relative to the window.
164
165       Ttk_MakeBox is a convenience routine that constructs a  Ttk_Box  struc‐
166       ture  representing  a  region width pixels wide, height pixels tall, at
167       the specified x, y coordinates.
168
169       Ttk_PadBox returns a new  box  located  inside  the  specified  parcel,
170       shrunken  according  to the left, top, right, and bottom margins speci‐
171       fied by padding.
172
173       Ttk_ExpandBox is the inverse of Ttk_PadBox: it returns a new  box  sur‐
174       rounding  the  specified  parcel, expanded  according to the left, top,
175       right, and bottom margins specified by padding.
176
177       Ttk_PackBox allocates a parcel width by height pixels wide on the spec‐
178       ified side of the cavity, and shrinks the cavity accordingly.
179
180       Ttk_StickBox  places  a  box with the requested width and height inside
181       the parcel according to the sticky bits.
182
183       Ttk_PlaceBox combines Ttk_PackBox and Ttk_StickBox: it allocates a par‐
184       cel  on the specified side of the cavity, places a box of the requested
185       size inside the parcel according to sticky, and shrinks the cavity.
186
187       Ttk_AnchorBox places a box with the requested width and  height  inside
188       the parcel according to the specified anchor option.
189
190       Ttk_BoxContains  tests if the specified x, y coordinate lies within the
191       rectangular region box.
192

PADDDING

194       The Ttk_Padding structure is used to represent borders,  internal  pad‐
195       ding, and external margins:
196              typedef struct {
197                  short left;
198                  short top;
199                  short right;
200                  short bottom;
201              } Ttk_Padding;
202
203       Ttk_MakePadding  is a convenience routine that constructs a Ttk_Padding
204       structure with the specified left, top, right, and bottom components.
205
206       Ttk_UniformPadding constructs a Ttk_Padding structure with  all  compo‐
207       nents equal to the specified border.
208
209       Ttk_AddPadding  adds  two  Ttk_Paddings together and returns a combined
210       padding containing the sum of the individual padding components.
211
212       Ttk_RelievePadding adds an extra 2 pixels of padding to padding accord‐
213       ing  to  the specified relief.  If relief is TK_RELIEF_SUNKEN, adds two
214       pixels at the top and left so the inner region is shifted down  and  to
215       the left.  If it is TK_RELIEF_RAISED, adds two pixels at the bottom and
216       right so the inner region is shifted up and to the  right.   Otherwise,
217       adds  1 pixel on all sides.  This is typically used in element geometry
218       procedures to simulate a “pressed-in” look for pushbuttons.
219

CONVERSION ROUTINES

221       Ttk_GetPaddingFromObj converts the string in objPtr  to  a  Ttk_Padding
222       structure.   The  string  representation is a list of up to four length
223       specifications “left top right bottom”.  If fewer  than  four  elements
224       are  specified, bottom defaults to top, right defaults to left, and top
225       defaults to left.  See Tk_GetPixelsFromObj(3) for the syntax of  length
226       specifications.
227
228       Ttk_GetBorderFromObj  is  the same as Ttk_GetPaddingFromObj except that
229       the lengths are specified as integers (i.e., resolution-dependent  val‐
230       ues like 3m are not allowed).
231
232       Ttk_GetStickyFromObj converts the string in objPtr to a sticky bitmask.
233       The string contains zero or more of the characters n, s, e, or w.
234

SEE ALSO

236       Tk_GetReliefFromObj(3), Tk_GetPixelsFromObj(3), Tk_GetAnchorFromObj(3)
237

KEYWORDS

239       geometry, padding, margins, box, region, sticky, relief
240
241
242
243Tk                                    8.5                          Geometry(3)
Impressum