blob: 24be01b8526981481220db3d5bf121cf8ed5b5fd [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04002.\" Copyright 2019-2023,2024 Thomas E. Dickey *
3.\" Copyright 2007-2015,2017 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304.\" *
5.\" Permission is hereby granted, free of charge, to any person obtaining a *
6.\" copy of this software and associated documentation files (the *
7.\" "Software"), to deal in the Software without restriction, including *
8.\" without limitation the rights to use, copy, modify, merge, publish, *
9.\" distribute, distribute with modifications, sublicense, and/or sell *
10.\" copies of the Software, and to permit persons to whom the Software is *
11.\" furnished to do so, subject to the following conditions: *
12.\" *
13.\" The above copyright notice and this permission notice shall be included *
14.\" in all copies or substantial portions of the Software. *
15.\" *
16.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23.\" *
24.\" Except as contained in this notice, the name(s) of the above copyright *
25.\" holders shall not be used in advertising or otherwise to promote the *
26.\" sale, use or other dealings in this Software without prior written *
27.\" authorization. *
28.\"***************************************************************************
29.\"
micky3879b9f5e72025-07-08 18:04:53 -040030.\" $Id: curs_legacy.3x,v 1.32 2024/03/16 15:35:01 tom Exp $
31.TH curs_legacy 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
32.ie \n(.g \{\
33.ds `` \(lq
34.ds '' \(rq
35.\}
36.el \{\
37.ie t .ds `` ``
38.el .ds `` ""
39.ie t .ds '' ''
40.el .ds '' ""
41.\}
42.
43.de bP
44.ie n .IP \(bu 4
45.el .IP \(bu 2
46..
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053047.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040048\fB\%getattrs\fP,
49\fB\%getbegx\fP,
50\fB\%getbegy\fP,
51\fB\%getcurx\fP,
52\fB\%getcury\fP,
53\fB\%getmaxx\fP,
54\fB\%getmaxy\fP,
55\fB\%getparx\fP,
56\fB\%getpary\fP \-
57get \fIcurses\fR cursor and window coordinates or attributes (legacy)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053058.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040059.nf
60\fB#include <curses.h>
61.PP
62\fBint getattrs(const WINDOW *\fIwin\fP);
63.PP
64\fBint getbegx(const WINDOW *\fIwin\fP);
65\fBint getbegy(const WINDOW *\fIwin\fP);
66.PP
67\fBint getcurx(const WINDOW *\fIwin\fP);
68\fBint getcury(const WINDOW *\fIwin\fP);
69.PP
70\fBint getmaxx(const WINDOW *\fIwin\fP);
71\fBint getmaxy(const WINDOW *\fIwin\fP);
72.PP
73\fBint getparx(const WINDOW *\fIwin\fP);
74\fBint getpary(const WINDOW *\fIwin\fP);
75.fi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053076.SH DESCRIPTION
micky3879b9f5e72025-07-08 18:04:53 -040077These legacy functions are simpler to use
78than the X/Open \fIcurses\fP functions:
79.bP
80The \fB\%getattrs\fP function returns the same attribute data
81as \fB\%wattr_get\fP.
82.IP
83However, \fB\%getattrs\fP returns an integer (actually a \fB\%chtype\fP),
84while \fB\%wattr_get\fP returns the current color pair in a separate parameter.
85In the wide-character library configuration,
86color pairs may not fit into a \fB\%chtype\fP,
87so \fB\%wattr_get\fP is the only way to obtain the color information.
88.IP
89Because \fB\%getattrs\fP returns the attributes in a single parameter,
90it would not be possible for an application to distinguish that from
91\fBERR\fP (a \fI-1\fP).
92If the window parameter is null, \fB\%getattrs\fP
93returns \fB\%A_NORMAL\fP (zero).
94.bP
95The \fB\%getbegy\fP and \fB\%getbegx\fP functions return the same
96data as \fB\%getbegyx\fP.
97.bP
98The \fB\%getcury\fP and \fB\%getcurx\fP functions return the same
99data as \fB\%getyx\fP.
100.bP
101The \fB\%getmaxy\fP and \fB\%getmaxx\fP functions return the same
102data as \fB\%getmaxyx\fP.
103.bP
104The \fB\%getpary\fP and \fB\%getparx\fP functions return the same
105data as \fB\%getparyx\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530106.SH RETURN VALUE
micky3879b9f5e72025-07-08 18:04:53 -0400107Except as noted,
108these functions return an integer,
109or \fBERR\fP if the window parameter is null.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530110.SH NOTES
micky3879b9f5e72025-07-08 18:04:53 -0400111All of these interfaces are implemented as macros and functions.
112The macros are suppressed
113(and only the functions provided)
114in an \*(``opaque\*(''
115.I \%ncurses
116build,
117which defines the preprocessor symbol
118.BR \%NCURSES_OPAQUE .
119See section \*(``ALTERNATE CONFIGURATIONS\*('' in \fB\%ncurses\fP(3X).
120.PP
121The standard forms such as \fB\%getyx\fP
122.I must
123be implemented as macros,
124and
125(in this implementation)
126are defined in terms of the functions described here,
127to avoid reliance on internal details of the \fI\%WINDOW\fP structure.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530128.SH PORTABILITY
129These functions were supported on Version 7, BSD or System V implementations.
micky3879b9f5e72025-07-08 18:04:53 -0400130None of those implementations checked the window parameter.
131.PP
132The \fB\%getattrs\fP function and macro are defined to return a (signed) integer
133for compatibility with those implementations
134although an unsigned type would have been more appropriate.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530135.SH SEE ALSO
micky3879b9f5e72025-07-08 18:04:53 -0400136\fB\%curses\fP(3X),
137\fB\%curs_getyx\fP(3X),
138\fB\%curs_opaque\fP(3X)