| 1 |
# Copyright (c) 1990 The Regents of the University of California. |
| 2 |
# Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 3 |
# See the file "license.terms" for information on usage and redistribution |
| 4 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 5 |
# |
| 6 |
# |
| 7 |
|
| 8 |
=head1 NAME |
| 9 |
|
| 10 |
Tk_GetAnchor, Tk_NameOfAnchor - translate between strings and anchor positions |
| 11 |
|
| 12 |
=for category C Programming |
| 13 |
|
| 14 |
=head1 SYNOPSIS |
| 15 |
|
| 16 |
B<#include E<lt>tk.hE<gt>> |
| 17 |
|
| 18 |
int |
| 19 |
B<Tk_GetAnchor(>I<interp, string, anchorPtr>B<)> |
| 20 |
|
| 21 |
char * |
| 22 |
B<Tk_NameOfAnchor(>I<anchor>B<)> |
| 23 |
|
| 24 |
=head1 ARGUMENTS |
| 25 |
|
| 26 |
=over 4 |
| 27 |
|
| 28 |
=item Tcl_Interp *interp (in) |
| 29 |
|
| 30 |
Interpreter to use for error reporting. |
| 31 |
|
| 32 |
=item char *string (in) |
| 33 |
|
| 34 |
String containing name of anchor point: one of ``n'', ``ne'', ``e'', ``se'', |
| 35 |
``s'', ``sw'', ``w'', ``nw'', or ``center''. |
| 36 |
|
| 37 |
=item int *anchorPtr (out) |
| 38 |
|
| 39 |
Pointer to location in which to store anchor position corresponding to |
| 40 |
I<string>. |
| 41 |
|
| 42 |
=item Tk_Anchor anchor (in) |
| 43 |
|
| 44 |
Anchor position, e.g. B<TCL_ANCHOR_CENTER>. |
| 45 |
|
| 46 |
=back |
| 47 |
|
| 48 |
=head1 DESCRIPTION |
| 49 |
|
| 50 |
B<Tk_GetAnchor> places in I<*anchorPtr> an anchor position |
| 51 |
(enumerated type B<Tk_Anchor>) |
| 52 |
corresponding to I<string>, which will be one of |
| 53 |
B<TK_ANCHOR_N>, B<TK_ANCHOR_NE>, B<TK_ANCHOR_E>, B<TK_ANCHOR_SE>, |
| 54 |
B<TK_ANCHOR_S>, B<TK_ANCHOR_SW>, B<TK_ANCHOR_W>, B<TK_ANCHOR_NW>, |
| 55 |
or B<TK_ANCHOR_CENTER>. |
| 56 |
Anchor positions are typically used for indicating a point on an object |
| 57 |
that will be used to position that object, e.g. B<TK_ANCHOR_N> means |
| 58 |
position the top center point of the object at a particular place. |
| 59 |
|
| 60 |
Under normal circumstances the return value is B<TCL_OK> and |
| 61 |
I<interp> is unused. |
| 62 |
If I<string> doesn't contain a valid anchor position |
| 63 |
or an abbreviation of one of these names, then an error message is |
| 64 |
stored in I<interp-E<gt>result>, B<TCL_ERROR> is returned, and |
| 65 |
I<*anchorPtr> is unmodified. |
| 66 |
|
| 67 |
B<Tk_NameOfAnchor> is the logical inverse of B<Tk_GetAnchor>. |
| 68 |
Given an anchor position such as B<TK_ANCHOR_N> it returns a |
| 69 |
statically-allocated string corresponding to I<anchor>. |
| 70 |
If I<anchor> isn't a legal anchor value, then |
| 71 |
``unknown anchor position'' is returned. |
| 72 |
|
| 73 |
=head1 KEYWORDS |
| 74 |
|
| 75 |
anchor position |