1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
#include <curses.h>
/** @file
*
* MuCurses window attribute functions
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
/**
* Get the background rendition attributes for a window
*
* @v *win subject window
* @ret ch chtype rendition representation
*/
inline chtype getbkgd ( WINDOW *win ) {
return win->attrs;
}
/**
* Turn off attributes in a window
*
* @v win subject window
* @v attrs attributes to enable
* @ret rc return status code
*/
int wattroff ( WINDOW *win, int attrs ) {
win->attrs &= ~attrs;
return OK;
}
/**
* Turn on attributes in a window
*
* @v win subject window
* @v attrs attributes to enable
* @ret rc return status code
*/
int wattron ( WINDOW *win, int attrs ) {
win->attrs |= attrs;
return OK;
}
/**
* Set attributes in a window
*
* @v win subject window
* @v attrs attributes to enable
* @ret rc return status code
*/
int wattrset ( WINDOW *win, int attrs ) {
win->attrs = ( attrs | ( win->attrs & A_COLOR ) );
return OK;
}
/**
* Get attributes and colour pair information
*
* @v *win window to obtain information from
* @v *attrs address in which to store attributes
* @v *pair address in which to store colour pair
* @v *opts undefined (for future implementation)
* @ret rc return status cude
*/
int wattr_get ( WINDOW *win, attr_t *attrs, short *pair,
void *opts __unused ) {
*attrs = win->attrs & A_ATTRIBUTES;
*pair = PAIR_NUMBER ( win->attrs );
return OK;
}
/**
* Turn off attributes in a window
*
* @v *win subject window
* @v attrs attributes to toggle
* @v *opts undefined (for future implementation)
* @ret rc return status code
*/
int wattr_off ( WINDOW *win, attr_t attrs,
void *opts __unused ) {
wattroff( win, attrs );
return OK;
}
/**
* Turn on attributes in a window
*
* @v *win subject window
* @v attrs attributes to toggle
* @v *opts undefined (for future implementation)
* @ret rc return status code
*/
int wattr_on ( WINDOW *win, attr_t attrs,
void *opts __unused ) {
wattron( win, attrs );
return OK;
}
/**
* Set attributes and colour pair information in a window
*
* @v *win subject window
* @v attrs attributes to set
* @v cpair colour pair to set
* @v *opts undefined (for future implementation)
* @ret rc return status code
*/
int wattr_set ( WINDOW *win, attr_t attrs, short cpair,
void *opts __unused ) {
wattrset( win, attrs | COLOUR_PAIR ( cpair ) );
return OK;
}
/**
* Set colour pair for a window
*
* @v *win subject window
* @v colour_pair_number colour pair integer
* @v *opts undefined (for future implementation)
* @ret rc return status code
*/
int wcolour_set ( WINDOW *win, short colour_pair_number,
void *opts __unused ) {
if ( ( unsigned short )colour_pair_number > COLOUR_PAIRS )
return ERR;
win->attrs = ( ( win->attrs & A_ATTRIBUTES ) |
COLOUR_PAIR ( colour_pair_number ) );
return OK;
}
|