iPXE
winattrs.c File Reference

MuCurses window attribute functions. More...

#include <curses.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
chtype getbkgd (WINDOW *win)
 Get the background rendition attributes for a window.
int wattroff (WINDOW *win, int attrs)
 Turn off attributes in a window.
int wattron (WINDOW *win, int attrs)
 Turn on attributes in a window.
int wattrset (WINDOW *win, int attrs)
 Set attributes in a window.
int wattr_get (WINDOW *win, attr_t *attrs, short *pair, void *opts __unused)
 Get attributes and colour pair information.
int wattr_off (WINDOW *win, attr_t attrs, void *opts __unused)
 Turn off attributes in a window.
int wattr_on (WINDOW *win, attr_t attrs, void *opts __unused)
 Turn on attributes in a window.
int wattr_set (WINDOW *win, attr_t attrs, short cpair, void *opts __unused)
 Set attributes and colour pair information in a window.
int wcolour_set (WINDOW *win, short colour_pair_number, void *opts __unused)
 Set colour pair for a window.

Detailed Description

MuCurses window attribute functions.

Definition in file winattrs.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ getbkgd()

chtype getbkgd ( WINDOW * win)
inline

Get the background rendition attributes for a window.

Parameters
*winsubject window
Return values
chchtype rendition representation

Definition at line 18 of file winattrs.c.

18 {
19 return win->attrs;
20}
attr_t attrs
window attributes
Definition curses.h:94

References _curses_window::attrs.

◆ wattroff()

int wattroff ( WINDOW * win,
int attrs )

Turn off attributes in a window.

Parameters
winsubject window
attrsattributes to enable
Return values
rcreturn status code

Definition at line 29 of file winattrs.c.

29 {
30 win->attrs &= ~attrs;
31 return OK;
32}
#define OK
Definition curses.h:25

References _curses_window::attrs, and OK.

Referenced by attroff(), and wattr_off().

◆ wattron()

int wattron ( WINDOW * win,
int attrs )

Turn on attributes in a window.

Parameters
winsubject window
attrsattributes to enable
Return values
rcreturn status code

Definition at line 41 of file winattrs.c.

41 {
42 win->attrs |= attrs;
43 return OK;
44}

References _curses_window::attrs, and OK.

Referenced by attron(), and wattr_on().

◆ wattrset()

int wattrset ( WINDOW * win,
int attrs )

Set attributes in a window.

Parameters
winsubject window
attrsattributes to enable
Return values
rcreturn status code

Definition at line 53 of file winattrs.c.

53 {
54 win->attrs = ( attrs | ( win->attrs & A_COLOR ) );
55 return OK;
56}
#define A_COLOR
Definition curses.h:150

References A_COLOR, _curses_window::attrs, and OK.

Referenced by _enter_slk(), attrset(), bkgdset(), wattr_set(), wbkgdset(), wstandend(), and wstandout().

◆ wattr_get()

int wattr_get ( WINDOW * win,
attr_t * attrs,
short * pair,
void *opts __unused )

Get attributes and colour pair information.

Parameters
*winwindow to obtain information from
*attrsaddress in which to store attributes
*pairaddress in which to store colour pair
*optsundefined (for future implementation)
Return values
rcreturn status cude

Definition at line 67 of file winattrs.c.

68 {
69 *attrs = win->attrs & A_ATTRIBUTES;
70 *pair = PAIR_NUMBER ( win->attrs );
71 return OK;
72}
#define PAIR_NUMBER(attrs)
Definition curses.h:154
#define A_ATTRIBUTES
Definition curses.h:147

References __unused, A_ATTRIBUTES, _curses_window::attrs, OK, opts, and PAIR_NUMBER.

Referenced by _enter_slk().

◆ wattr_off()

int wattr_off ( WINDOW * win,
attr_t attrs,
void *opts __unused )

Turn off attributes in a window.

Parameters
*winsubject window
attrsattributes to toggle
*optsundefined (for future implementation)
Return values
rcreturn status code

Definition at line 82 of file winattrs.c.

83 {
84 wattroff( win, attrs );
85 return OK;
86}
int wattroff(WINDOW *win, int attrs)
Turn off attributes in a window.
Definition winattrs.c:29

References __unused, OK, opts, and wattroff().

◆ wattr_on()

int wattr_on ( WINDOW * win,
attr_t attrs,
void *opts __unused )

Turn on attributes in a window.

Parameters
*winsubject window
attrsattributes to toggle
*optsundefined (for future implementation)
Return values
rcreturn status code

Definition at line 96 of file winattrs.c.

97 {
98 wattron( win, attrs );
99 return OK;
100}
int wattron(WINDOW *win, int attrs)
Turn on attributes in a window.
Definition winattrs.c:41

References __unused, OK, opts, and wattron().

◆ wattr_set()

int wattr_set ( WINDOW * win,
attr_t attrs,
short cpair,
void *opts __unused )

Set attributes and colour pair information in a window.

Parameters
*winsubject window
attrsattributes to set
cpaircolour pair to set
*optsundefined (for future implementation)
Return values
rcreturn status code

Definition at line 111 of file winattrs.c.

112 {
113 wattrset( win, attrs | COLOUR_PAIR ( cpair ) );
114 return OK;
115}
#define COLOUR_PAIR(n)
Definition curses.h:152
int wattrset(WINDOW *win, int attrs)
Set attributes in a window.
Definition winattrs.c:53

References __unused, COLOUR_PAIR, OK, opts, and wattrset().

Referenced by _leave_slk().

◆ wcolour_set()

int wcolour_set ( WINDOW * win,
short colour_pair_number,
void *opts __unused )

Set colour pair for a window.

Parameters
*winsubject window
colour_pair_numbercolour pair integer
*optsundefined (for future implementation)
Return values
rcreturn status code

Definition at line 125 of file winattrs.c.

126 {
127 if ( ( unsigned short )colour_pair_number > COLOUR_PAIRS )
128 return ERR;
129
130 win->attrs = ( ( win->attrs & A_ATTRIBUTES ) |
131 COLOUR_PAIR ( colour_pair_number ) );
132 return OK;
133}
#define ERR
Definition curses.h:19
#define COLOUR_PAIRS
Definition curses.h:156

References __unused, A_ATTRIBUTES, _curses_window::attrs, COLOUR_PAIR, COLOUR_PAIRS, ERR, OK, and opts.