archie/tk3.6/doc/GetAnchor.3
2024-05-27 16:13:40 +02:00

78 lines
3.0 KiB
Groff

'\"
'\" Copyright (c) 1990 The Regents of the University of California.
'\" All rights reserved.
'\"
'\" Permission is hereby granted, without written agreement and without
'\" license or royalty fees, to use, copy, modify, and distribute this
'\" documentation for any purpose, provided that the above copyright
'\" notice and the following two paragraphs appear in all copies.
'\"
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'\"
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
'\"
'\" $Header: /user6/ouster/wish/man/RCS/GetAnchor.3,v 1.4 93/04/01 09:41:23 ouster Exp $ SPRITE (Berkeley)
'\"
.so man.macros
.HS Tk_GetAnchor tkc
.BS
.SH NAME
Tk_GetAnchor, Tk_NameOfAnchor \- translate between strings and anchor positions
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
.sp
Tk_Anchor
\fBTk_GetAnchor(\fIinterp, string, anchorPtr\fB)\fR
.sp
char *
\fBTk_NameOfAnchor(\fIanchor\fB)\fR
.SH ARGUMENTS
.AS "Tk_Anchor" *anchorPtr
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
.AP char *string in
String containing name of anchor point: one of ``n'', ``ne'', ``e'', ``se'',
``s'', ``sw'', ``w'', ``nw'', or ``center''.
.AP int *anchorPtr out
Pointer to location in which to store anchor position corresponding to
\fIstring\fR.
.AP Tk_Anchor anchor in
Anchor position, e.g. \fBTCL_ANCHOR_CENTER\fR.
.BE
.SH DESCRIPTION
.PP
\fBTk_GetAnchor\fR places in \fI*anchorPtr\fR an anchor position
(enumerated type \fBTk_Anchor\fR)
corresponding to \fIstring\fR, which will be one of
\fBTK_ANCHOR_N\fR, \fBTK_ANCHOR_NE\fR, \fBTK_ANCHOR_E\fR, \fBTK_ANCHOR_SE\fR,
\fBTK_ANCHOR_S\fR, \fBTK_ANCHOR_SW\fR, \fBTK_ANCHOR_W\fR, \fBTK_ANCHOR_NW\fR,
or \fBTK_ANCHOR_CENTER\fR.
Anchor positions are typically used for indicating a point on an object
that will be used to position that object, e.g. \fBTK_ANCHOR_N\fR means
position the top center point of the object at a particular place.
.PP
Under normal circumstances the return value is \fBTCL_OK\fR and
\fIinterp\fR is unused.
If \fIstring\fR doesn't contain a valid anchor position
or an abbreviation of one of these names, then an error message is
stored in \fIinterp->result\fR, \fBTCL_ERROR\fR is returned, and
\fI*anchorPtr\fR is unmodified.
.PP
\fBTk_NameOfAnchor\fR is the logical inverse of \fBTk_GetAnchor\fR.
Given an anchor position such as \fBTK_ANCHOR_N\fR it returns a
statically-allocated string corresponding to \fIanchor\fR.
If \fIanchor\fR isn't a legal anchor value, then
``unknown anchor position'' is returned.
.SH KEYWORDS
anchor position