Added WA_* attributes, and attr_* and wattr_* function families.

This commit is contained in:
William McBrine
2006-06-19 02:43:36 +00:00
parent 27319c0a5b
commit 89ae3b98a4
3 changed files with 122 additions and 4 deletions

View File

@@ -15,7 +15,7 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
/* $Id: curses.h,v 1.178 2006/06/18 23:22:42 wmcbrine Exp $ */
/* $Id: curses.h,v 1.179 2006/06/19 02:43:35 wmcbrine Exp $ */
/*----------------------------------------------------------------------*
* PDCurses *
@@ -45,7 +45,7 @@ PDCurses portable platform definitions list:
**man-end****************************************************************/
#define PDC_BUILD 2804
#define PDC_BUILD 2806
#define PDCURSES 1 /* PDCurses-only routines */
#define XOPEN 1 /* X/Open Curses routines */
#define SYSVcurses 1 /* System V Curses routines */
@@ -775,6 +775,26 @@ currently used.)
#define ATR_MSK A_ATTRIBUTES /* Obsolete */
#define ATR_NRM A_NORMAL /* Obsolete */
/* For use with attr_t -- X/Open says, "these shall be distinct", so
this is a non-conforming implementation. */
#define WA_ALTCHARSET A_ALTCHARSET
#define WA_BLINK A_BLINK
#define WA_BOLD A_BOLD
#define WA_DIM A_DIM
#define WA_INVIS A_INVIS
#define WA_LEFT A_LEFTLINE
#define WA_PROTECT A_PROTECT
#define WA_REVERSE A_REVERSE
#define WA_RIGHT A_RIGHTLINE
#define WA_STANDOUT A_STANDOUT
#define WA_UNDERLINE A_UNDERLINE
#define WA_HORIZONTAL A_NORMAL
#define WA_LOW A_NORMAL
#define WA_TOP A_NORMAL
#define WA_VERTICAL A_NORMAL
/*** Alternate character set macros ***/
/* ALTCHARSET definitions for PC from jshumate@wrdis01.robins.af.mil
@@ -1220,6 +1240,10 @@ int addstr(const char *);
int attroff(chtype);
int attron(chtype);
int attrset(chtype);
int attr_get(attr_t *, short *, void *);
int attr_off(attr_t, void *);
int attr_on(attr_t, void *);
int attr_set(attr_t, short, void *);
int baudrate(void);
int beep(void);
int bkgd(chtype);
@@ -1417,6 +1441,10 @@ int waddstr(WINDOW *, const char *);
int wattroff(WINDOW *, chtype);
int wattron(WINDOW *, chtype);
int wattrset(WINDOW *, chtype);
int wattr_get(WINDOW *, attr_t *, short *, void *);
int wattr_off(WINDOW *, attr_t, void *);
int wattr_on(WINDOW *, attr_t, void *);
int wattr_set(WINDOW *, attr_t, short, void *);
void wbkgdset(WINDOW *, chtype);
int wbkgd(WINDOW *, chtype);
int wborder(WINDOW *, chtype, chtype, chtype, chtype,

View File

@@ -193,7 +193,7 @@ FUNCTIONS
The following table lists each curses routine and the name of the
manual page on which it is described. This list is based on
System V R4 curses:
X/Open and System V R4 curses:
Curses Function Manual Page Name
@@ -204,6 +204,10 @@ FUNCTIONS
addstr addstr
attroff attr
attron attr
attr_get attr
attr_off attr
attr_on attr
attr_set attr
baudrate termattr
beep beep
bkgd bkgd
@@ -418,6 +422,10 @@ FUNCTIONS
wattroff attr
wattron attr
wattrset attr
wattr_get attr
wattr_off attr
wattr_on attr
wattr_set attr
wbkgd bkgd
wbkgdset bkgd
wborder border

View File

@@ -33,7 +33,7 @@
#undef color_set
#undef wcolor_set
RCSID("$Id: attr.c,v 1.21 2006/03/29 20:06:40 wmcbrine Exp $");
RCSID("$Id: attr.c,v 1.22 2006/06/19 02:43:36 wmcbrine Exp $");
/*man-start**************************************************************
@@ -54,6 +54,17 @@ RCSID("$Id: attr.c,v 1.21 2006/03/29 20:06:40 wmcbrine Exp $");
int color_set(short color_pair, void *opts);
int wcolor_set(WINDOW *win, short color_pair, void *opts);
int attr_get(attr_t *attrs, short *color_pair, void *opts);
int attr_off(attr_t attrs, void *opts);
int attr_on(attr_t attrs, void *opts);
int attr_set(attr_t attrs, short color_pair, void *opts);
int wattr_get(WINDOW *win, attr_t *attrs, short *color_pair,
void *opts);
int wattr_off(WINDOW *win, attr_t attrs, void *opts);
int wattr_on(WINDOW *win, attr_t attrs, void *opts);
int wattr_set(WINDOW *win, attr_t attrs, short color_pair,
void *opts);
X/Open Description:
These functions manipulate the current attributes and/or colors
of the named window. These attributes can be any combination
@@ -230,3 +241,74 @@ int wcolor_set(WINDOW *win, short color_pair, void *opts)
return OK;
}
int attr_get(attr_t *attrs, short *color_pair, void *opts)
{
PDC_LOG(("attr_get() - called\n"));
return wattr_get(stdscr, attrs, color_pair, opts);
}
int attr_off(attr_t attrs, void *opts)
{
PDC_LOG(("attr_off() - called\n"));
return wattroff(stdscr, attrs);
}
int attr_on(attr_t attrs, void *opts)
{
PDC_LOG(("attr_on() - called\n"));
return wattron(stdscr, attrs);
}
int attr_set(attr_t attrs, short color_pair, void *opts)
{
PDC_LOG(("attr_get() - called\n"));
return wattr_set(stdscr, attrs, color_pair, opts);
}
int wattr_get(WINDOW *win, attr_t *attrs, short *color_pair, void *opts)
{
PDC_LOG(("wattr_get() - called\n"));
if (win == (WINDOW *)NULL)
return ERR;
if (attrs != (attr_t *)NULL)
*attrs = win->_attrs & (A_ATTRIBUTES & ~A_COLOR);
if (color_pair != (short *)NULL)
*color_pair = PAIR_NUMBER(win->_attrs);
return OK;
}
int wattr_off(WINDOW *win, attr_t attrs, void *opts)
{
PDC_LOG(("wattr_off() - called\n"));
return wattroff(win, attrs);
}
int wattr_on(WINDOW *win, attr_t attrs, void *opts)
{
PDC_LOG(("wattr_off() - called\n"));
return wattron(win, attrs);
}
int wattr_set(WINDOW *win, attr_t attrs, short color_pair, void *opts)
{
PDC_LOG(("wattr_set() - called\n"));
if (win == (WINDOW *)NULL)
return ERR;
win->_attrs = (attrs & (A_ATTRIBUTES & ~A_COLOR)) |
COLOR_PAIR(color_pair);
return OK;
}