5 * MuCurses window attribute functions
10 * Get the background rendition attributes for a window
12 * @v *win subject window
13 * @ret ch chtype rendition representation
15 inline chtype getbkgd ( WINDOW *win ) {
20 * Turn off attributes in a window
22 * @v win subject window
23 * @v attrs attributes to enable
24 * @ret rc return status code
26 int wattroff ( WINDOW *win, int attrs ) {
32 * Turn on attributes in a window
34 * @v win subject window
35 * @v attrs attributes to enable
36 * @ret rc return status code
38 int wattron ( WINDOW *win, int attrs ) {
44 * Set attributes in a window
46 * @v win subject window
47 * @v attrs attributes to enable
48 * @ret rc return status code
50 int wattrset ( WINDOW *win, int attrs ) {
51 win->attrs = ( attrs | ( win->attrs & A_COLOR ) );
56 * Get attributes and colour pair information
58 * @v *win window to obtain information from
59 * @v *attrs address in which to store attributes
60 * @v *pair address in which to store colour pair
61 * @v *opts undefined (for future implementation)
62 * @ret rc return status cude
64 int wattr_get ( WINDOW *win, attr_t *attrs, short *pair,
65 void *opts __unused ) {
66 *attrs = win->attrs & A_ATTRIBUTES;
67 *pair = PAIR_NUMBER ( win->attrs );
72 * Turn off attributes in a window
74 * @v *win subject window
75 * @v attrs attributes to toggle
76 * @v *opts undefined (for future implementation)
77 * @ret rc return status code
79 int wattr_off ( WINDOW *win, attr_t attrs,
80 void *opts __unused ) {
81 wattroff( win, attrs );
86 * Turn on attributes in a window
88 * @v *win subject window
89 * @v attrs attributes to toggle
90 * @v *opts undefined (for future implementation)
91 * @ret rc return status code
93 int wattr_on ( WINDOW *win, attr_t attrs,
94 void *opts __unused ) {
95 wattron( win, attrs );
100 * Set attributes and colour pair information in a window
102 * @v *win subject window
103 * @v attrs attributes to set
104 * @v cpair colour pair to set
105 * @v *opts undefined (for future implementation)
106 * @ret rc return status code
108 int wattr_set ( WINDOW *win, attr_t attrs, short cpair,
109 void *opts __unused ) {
110 wattrset( win, attrs | COLOUR_PAIR ( cpair ) );
115 * Set colour pair for a window
117 * @v *win subject window
118 * @v colour_pair_number colour pair integer
119 * @v *opts undefined (for future implementation)
120 * @ret rc return status code
122 int wcolour_set ( WINDOW *win, short colour_pair_number,
123 void *opts __unused ) {
124 if ( ( unsigned short )colour_pair_number > COLOUR_PAIRS )
127 win->attrs = ( ( win->attrs & A_ATTRIBUTES ) |
128 COLOUR_PAIR ( colour_pair_number ) );