Added 2 new functions and a macro:
- getparx - getpary - getparyx (macro) Also minor tweak to the man page to correct grammar on a couple of items.
This commit is contained in:
parent
9ad1f29f64
commit
23231c1a0e
|
@ -527,6 +527,31 @@ until a newline or EOF is encountered.
|
|||
The newline stripped off the string.
|
||||
\*(Es
|
||||
.Ds
|
||||
.Fn getparx "WINDOW *win"
|
||||
.De
|
||||
Returns the x location of the given subwindow relative to the parent
|
||||
window. If the window is not a subwindow then -1 is returned.
|
||||
.Ds
|
||||
.Fn getpary "WINDOW *win"
|
||||
.De
|
||||
Returns the y location of the given subwindow relative to the parent
|
||||
window. If the window is not a subwindow then -1 is returned.
|
||||
.Ds
|
||||
.Fn getpary "WINDOW *win" "int y" "int x"
|
||||
Is a macro that sets the
|
||||
.Vn y
|
||||
and
|
||||
.Vn x
|
||||
parameters to the respective coordinates of the top left hand corner
|
||||
of the subwindow relative to the parent window. If the given window
|
||||
.Vn win
|
||||
is not a subwindow then both
|
||||
.Vn y
|
||||
and
|
||||
.Vn x
|
||||
will be set to -1.
|
||||
.De
|
||||
.Ds
|
||||
.Fn gettmode ""
|
||||
.De
|
||||
Get the tty stats.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: curses.3,v 1.33 2001/10/08 10:45:13 blymn Exp $
|
||||
.\" $NetBSD: curses.3,v 1.34 2001/10/14 12:36:09 blymn Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1985, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -152,9 +152,9 @@ relative to
|
|||
.Em win
|
||||
.It getcurx(win) get current x position on
|
||||
.Em win
|
||||
.It getbegy(win) get start y position on
|
||||
.It getbegy(win) get start y position of
|
||||
.Em win
|
||||
.It getbegx(win) get start x position on
|
||||
.It getbegx(win) get start x position of
|
||||
.Em win
|
||||
.It getmaxy(win) get maximum y position on
|
||||
.Em win
|
||||
|
@ -162,6 +162,15 @@ relative to
|
|||
.Em win
|
||||
.It getnstr(str, len) get a string of maximun len characters through
|
||||
.Em stdscr
|
||||
.It getpary(win) get start y position of subwindow
|
||||
.Em win
|
||||
relative to parent.
|
||||
.It getparx(win) get start x position of subwindow
|
||||
.Em win
|
||||
relative to parent.
|
||||
.It getparyx(win, y, x) set y and x to position of subwindow
|
||||
.Em win
|
||||
relative to parent.
|
||||
.It getstr(str) get a string through
|
||||
.Em stdscr
|
||||
.It gettmode() get tty modes
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: curses.h,v 1.60 2001/10/08 10:45:13 blymn Exp $ */
|
||||
/* $NetBSD: curses.h,v 1.61 2001/10/14 12:36:09 blymn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -608,6 +608,7 @@ __END_DECLS
|
|||
#define getyx(w, y, x) (y) = getcury(w), (x) = getcurx(w)
|
||||
#define getbegyx(w, y, x) (y) = getbegy(w), (x) = getbegx(w)
|
||||
#define getmaxyx(w, y, x) (y) = getmaxy(w), (x) = getmaxx(w)
|
||||
#define getparyx(w, y, x) (y) = getpary(w), (x) = getparx(w)
|
||||
|
||||
/* Public function prototypes. */
|
||||
__BEGIN_DECLS
|
||||
|
@ -642,6 +643,8 @@ int getbegy(WINDOW *);
|
|||
int getbegx(WINDOW *);
|
||||
int getmaxy(WINDOW *);
|
||||
int getmaxx(WINDOW *);
|
||||
int getpary(WINDOW *);
|
||||
int getparx(WINDOW *);
|
||||
int gettmode(void);
|
||||
bool has_colors(void);
|
||||
bool has_ic(void);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: getyx.c,v 1.3 2000/04/24 14:09:43 blymn Exp $ */
|
||||
/* $NetBSD: getyx.c,v 1.4 2001/10/14 12:36:09 blymn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: getyx.c,v 1.3 2000/04/24 14:09:43 blymn Exp $");
|
||||
__RCSID("$NetBSD: getyx.c,v 1.4 2001/10/14 12:36:09 blymn Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -46,6 +46,40 @@ __RCSID("$NetBSD: getyx.c,v 1.3 2000/04/24 14:09:43 blymn Exp $");
|
|||
#include "curses.h"
|
||||
#include "curses_private.h"
|
||||
|
||||
/*
|
||||
* getpary --
|
||||
* Get the y postion of the window relative to the parent window
|
||||
* return -1 if not a subwindow.
|
||||
*/
|
||||
int
|
||||
getpary(WINDOW *win)
|
||||
{
|
||||
if (win == NULL)
|
||||
return -1;
|
||||
|
||||
if (win->orig == NULL)
|
||||
return -1;
|
||||
|
||||
return (win->begy - win->orig->begy);
|
||||
}
|
||||
|
||||
/*
|
||||
* getparx --
|
||||
* Get the x postion of the window relative to the parent window
|
||||
* return -1 if not a subwindow.
|
||||
*/
|
||||
int
|
||||
getparx(WINDOW *win)
|
||||
{
|
||||
if (win == NULL)
|
||||
return -1;
|
||||
|
||||
if (win->orig == NULL)
|
||||
return -1;
|
||||
|
||||
return (win->begx - win->orig->begx);
|
||||
}
|
||||
|
||||
/*
|
||||
* getcury --
|
||||
* Get current y position on window.
|
||||
|
|
Loading…
Reference in New Issue