4
5
6
7
8
9
10
11
14
15
16
17
18
19
25
26
27
28
29
30
31
38
39
40
41
42
43
44
48 wchar_t wstr[2] = {L'\0', L'\0'};
52 attrs |= style
->bold ? WA_BOLD : 0;
53 attrs |= style
->dim ? WA_DIM : 0;
54 attrs |= style
->italic ? WA_ITALIC : 0;
56 attrs |= style
->blink ? WA_BLINK : 0;
58 attrs |= style
->invis ? WA_INVIS : 0;
59 setcchar(&cc, wstr, attrs, cpx,
nullptr);
64
65
66
67
68
69
70
71
79
80
81
82
83
84
85
86
87
93 wbkgdset(s
->win, (chtype)(fill_ch ? fill_ch :
' '));
98
99
100
101
102
103
104
105
106
107
108
109int ui_draw_text(UiSurface *s,
int y,
int x,
const UiStyle *style,
const char *text) {
114 mvwaddstr(s
->win, y, x, text);
119
120
121
122
123
124
125
126
127
128
129
130
131
132int ui_draw_text_n(UiSurface *s,
int y,
int x,
const UiStyle *style,
const char *text, size_t n) {
137 mvwaddnstr(s
->win, y, x, text, (
int)n);
142
143
144
145
146
147
148
149
150
151
152
153int ui_draw_hline(UiSurface *s,
int y,
int x,
int len,
const UiStyle *style) {
158 mvwhline(s
->win, y, x, 0, len);
163
164
165
166
167
168
169
170
171
172
173
174int ui_draw_vline(UiSurface *s,
int y,
int x,
int len,
const UiStyle *style) {
179 mvwvline(s
->win, y, x, 0, len);
184
185
186
187
188
189
190
191
192
193
204 box(s
->win,
'|',
'-');
215
216
217
218
219
220
221
222
223
224
225
231 mvwaddstr(s
->win, 0, x, title);
int ui_draw_vline(UiSurface *s, int y, int x, int len, const UiStyle *style)
Draw a vertical line on a UiSurface.This function uses the ncurses mvwvline function to draw a vertic...
int ui_draw_border(UiSurface *s, UiBorderKind kind, const UiStyle *style)
Draw a border around a UiSurface.This function draws a border around the UiSurface's window based on ...
int ui_ncurses_style_apply(WINDOW *win, const UiStyle *style)
Apply a UiStyle to an ncurses window.This function sets the appropriate attributes (bold,...
int ui_surface_set_base(UiSurface *s, const UiStyle *style, uint32_t fill_ch)
Set the base fill character and style for a UiSurface.This function sets the background fill characte...
int ui_draw_box_title(UiSurface *s, int x, const UiStyle *style, const char *title)
Draw a title on the top border of a UiSurface.This function draws the provided title string at the sp...
int ui_draw_text_n(UiSurface *s, int y, int x, const UiStyle *style, const char *text, size_t n)
Draw a specified number of characters from a string on a UiSurface.This function is similar to ui_dra...
int ui_draw_text(UiSurface *s, int y, int x, const UiStyle *style, const char *text)
Draw text on a UiSurface at a specified position with a given style.This function uses the ncurses mv...
int ui_surface_set_style(UiSurface *s, const UiStyle *style)
Set the style for a UiSurface.This function applies the given UiStyle to the ncurses window associate...
int ui_ncurses_color_pair_from_style(const UiStyle *style)
Convert an RGB value (0-255) to a 1000-based value for ncurses.Ncurses uses a 1000-based color system...
int ui_draw_hline(UiSurface *s, int y, int x, int len, const UiStyle *style)
Draw a horizontal line on a UiSurface.This function uses the ncurses mvwhline function to draw a hori...