Added the *chgat() family. This completes the list of attr_t functions,

except for those that also involve cchar_t. To Do: Test; document.
This commit is contained in:
William McBrine
2006-06-19 04:40:06 +00:00
parent d344b88e7c
commit 2fdfa68655
3 changed files with 72 additions and 3 deletions

View File

@@ -15,7 +15,7 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
/* $Id: curses.h,v 1.181 2006/06/19 03:36:38 wmcbrine Exp $ */
/* $Id: curses.h,v 1.182 2006/06/19 04:40:05 wmcbrine Exp $ */
/*----------------------------------------------------------------------*
* PDCurses *
@@ -1252,6 +1252,7 @@ int border(chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype);
int box(WINDOW *, chtype, chtype);
bool can_change_color(void);
int cbreak(void);
int chgat(int, attr_t, short, const void *);
int clearok(WINDOW *, bool);
int clear(void);
int clrtobot(void);
@@ -1320,6 +1321,7 @@ int mvaddchnstr(int, int, const chtype *, int);
int mvaddchstr(int, int, const chtype *);
int mvaddnstr(int, int, const char *, int);
int mvaddstr(int, int, const char *);
int mvchgat(int, int, int, attr_t, short, const void *);
int mvcur(int, int, int, int);
int mvdelch(int, int);
int mvderwin(WINDOW *, int, int);
@@ -1343,6 +1345,7 @@ int mvwaddchstr(WINDOW *, int, int, const chtype *);
int mvwaddch(WINDOW *, int, int, const chtype);
int mvwaddnstr(WINDOW *, int, int, const char *, int);
int mvwaddstr(WINDOW *, int, int, const char *);
int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);
int mvwdelch(WINDOW *, int, int);
int mvwgetch(WINDOW *, int, int);
int mvwgetnstr(WINDOW *, int, int, char *, int);
@@ -1455,6 +1458,7 @@ void wbkgdset(WINDOW *, chtype);
int wbkgd(WINDOW *, chtype);
int wborder(WINDOW *, chtype, chtype, chtype, chtype,
chtype, chtype, chtype, chtype);
int wchgat(WINDOW *, int, attr_t, short, const void *);
int wclear(WINDOW *);
int wclrtobot(WINDOW *);
int wclrtoeol(WINDOW *);

View File

@@ -216,6 +216,7 @@ FUNCTIONS
box border
can_change_color color
cbreak inopts
chgat attr
clear clear
clearok outopts
clrtobot clear
@@ -290,6 +291,7 @@ FUNCTIONS
mvaddchstr addchstr
mvaddnstr addstr
mvaddstr addstr
mvchgat attr
mvcur terminfo
mvdelch delch
mvderwin window
@@ -310,10 +312,10 @@ FUNCTIONS
mvwaddchstr addchstr
mvwaddnstr addstr
mvwaddstr addstr
mvwchgat attr
mvwdelch delch
mvwgetch getch
mvwgetnstr getstr
wgetnstr getstr
mvwin window
mvwinch inch
mvwinchnstr inchstr
@@ -444,6 +446,7 @@ FUNCTIONS
wdeleteln deleteln
wechochar addch
werase clear
wchgat attr
wgetch getch
wgetnstr getstr
wgetstr getstr

View File

@@ -33,7 +33,7 @@
#undef color_set
#undef wcolor_set
RCSID("$Id: attr.c,v 1.22 2006/06/19 02:43:36 wmcbrine Exp $");
RCSID("$Id: attr.c,v 1.23 2006/06/19 04:40:06 wmcbrine Exp $");
/*man-start**************************************************************
@@ -65,6 +65,14 @@ RCSID("$Id: attr.c,v 1.22 2006/06/19 02:43:36 wmcbrine Exp $");
int wattr_set(WINDOW *win, attr_t attrs, short color_pair,
void *opts);
int chgat(int n, attr_t attr, short color, const void *opts);
int mvchgat(int y, int x, int n, attr_t attr, short color,
const void *opts);
int mvwchgat(WINDOW *win, int y, int x, int n, attr_t attr,
short color, const void *opts);
int wchgat(WINDOW *win, int n, attr_t attr, short color,
const void *opts);
X/Open Description:
These functions manipulate the current attributes and/or colors
of the named window. These attributes can be any combination
@@ -312,3 +320,57 @@ int wattr_set(WINDOW *win, attr_t attrs, short color_pair, void *opts)
return OK;
}
int chgat(int n, attr_t attr, short color, const void *opts)
{
PDC_LOG(("wchgat() - called\n"));
return wchgat(stdscr, n, attr, color, opts);
}
int mvchgat(int y, int x, int n, attr_t attr, short color, const void *opts)
{
PDC_LOG(("mvchgat() - called\n"));
if (move(y, x) == ERR)
return ERR;
return wchgat(stdscr, n, attr, color, opts);
}
int mvwchgat(WINDOW *win, int y, int x, int n, attr_t attr,
short color, const void *opts)
{
PDC_LOG(("mvwchgat() - called\n"));
if (wmove(win, y, x) == ERR)
return ERR;
return wchgat(win, n, attr, color, opts);
}
int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts)
{
chtype newattr, tmp;
int basey, basex, imax, ic;
if (win == (WINDOW *)NULL)
return ERR;
newattr = (attr & A_ATTRIBUTES) | COLOR_PAIR(color);
basey = win->_cury;
basex = win->_curx;
imax = win->_maxx - win->_curx;
if (n > 0)
imax = ((imax < n) ? imax : n);
for (ic = 0; ic < imax; ic++)
{
tmp = (win->_y[basey][basex + ic] & A_CHARTEXT) | newattr;
win->_y[basey][basex + ic] = tmp;
}
return OK;
}