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
61

ARGUMENTS

63       Tk_Anchor anchor (in)                     One of the symbolic constants
64                                                 TK_ANCHOR_N,    TK_ANCHOR_NE,
65                                                 etc.   See   Tk_GetAnchorFro‐
66                                                 mObj(3).
67
68       Ttk_Box * cavity (in/out)                 A   rectangular  region  from
69                                                 which a parcel is allocated.
70
71       short border (in)                         Extra padding (in pixels)  to
72                                                 add uniformly to each side of
73                                                 a region.
74
75       short bottom (in)                         Extra padding (in pixels)  to
76                                                 add   to   the  bottom  of  a
77                                                 region.
78
79       Ttk_Box box (in)
80
81       Ttk_Box * box_rtn (out)                   Specifies    a    rectangular
82                                                 region.
83
84       int height (in)                           The  height  in  pixels  of a
85                                                 region.
86
87       Tcl_Interp * interp (in)                  Used to store error messages.
88
89       int left (in)                             Extra padding (in pixels)  to
90                                                 add  to  the  left  side of a
91                                                 region.
92
93       Tcl_Obj * objPtr (in)                     String value contains a  sym‐
94                                                 bolic name to be converted to
95                                                 an enumerated value  or  bit‐
96                                                 mask.  Internal rep may be be
97                                                 modified to cache correspond‐
98                                                 ing value.
99
100       Ttk_Padding padding (in)
101
102       Ttk_Padding * padding_rtn (out)           Extra  padding  to add on the
103                                                 inside 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 pixles)  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    and
133                                                 TTK_STICK_ALL  are   synonyms
134                                                 for  (TTK_FILL_X|TTK_FILL_Y).
135                                                 See also: grid(n).
136
137       Tk_Window tkwin (in)                      Window whose screen  geometry
138                                                 determines   the   conversion
139                                                 between  absolute  units  and
140                                                 pixels.
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
146                                                 region.
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
155

BOXES

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

PADDDING

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

CONVERSION ROUTINES

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

SEE ALSO

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

KEYWORDS

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