<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>
