2
3
4
5
6
7
9#define _XOPEN_SOURCE_EXTENDED 1
19
20
22
23
24
25
26
30 wclrtobot(s->mwin[w]);
34
35
36
37
41 wclrtoeol(s->mwin[w]);
45
46
48
49
50
51
52
56 waddch(s->mwin[w], c);
60
61
62
63
64
65
66
70 mvwaddch(s->mwin[w], y, x, c);
74int ui_draw_text(UiSurface *s, ss_t w, uint y, uint x,
const char *text) {
77 mvwaddstr(s->mwin[w], y, x, text);
81
82
83
84
85
86
87
88int ui_draw_text_n(UiSurface *s, ss_t w, uint y, uint x,
const char *text,
int n) {
91 mvwaddnstr(s->mwin[w], y, x, text, (
int)n);
95
96
97
98
99
100
101
102
106 uint l = strlen(text);
108 char *tmp_str = (
char *)malloc(n + 1);
111 strcpy(tmp_str, text);
112 for (
int i = l; i < (
int)n; i++) {
116 mvwaddstr(s->mwin[w], y, x, tmp_str);
119 mvwaddnstr(s->mwin[w], y, x, text, (
int)n);
127
128
129
130
131
132int ui_mvwaddch(UiSurface *s, ss_t w, uint y, uint x,
const char c) {
135 mvwaddch(s->mwin[w], y, x, c);
142
143
144
145
146
150 waddstr(s->mwin[w], text);
154
155
156
157
158
159
163 waddnstr(s->mwin[w], text, m);
167
168
169
170
171
172
173
174int ui_mvwaddstr(UiSurface *s, ss_t w, uint y, uint x,
const char *text) {
177 mvwaddstr(s->mwin[w], y, x, text);
181
182
183
184
185
186
187
188
189int ui_mvwaddnstr(UiSurface *s, ss_t w, uint y, uint x,
const char *text,
int m) {
192 mvwaddnstr(s->mwin[w], y, x, text, m);
196
197
198
199
200
201
202
203
208 getmaxyx(s->mwin[w], maxy, maxx);
215 if (*str ==
'\0' || *str ==
'\n')
222 mvwaddnstr(s->mwin[w], y, x, tmp_str, m);
229
230
231
232
233
237 waddwstr(s->mwin[w], wstr);
241
242
243
244
245
246
247
248int ui_mvwaddwstr(UiSurface *s, ss_t w, uint y, uint x,
const wchar_t *wstr) {
251 mvwaddwstr(s->mwin[w], y, x, wstr);
255
256
257
258
259
260
264 waddnwstr(s->mwin[w], wstr, m);
268
269
270
271
272
273
274
275
276int ui_mvwaddnwstr(UiSurface *s, ss_t w, uint y, uint x,
const wchar_t *wstr,
int m) {
279 mvwaddnwstr(s->mwin[w], y, x, wstr, m);
286
287
288
289
290
294 wadd_wchnstr(s->mwin[w], cell, 1);
298
299
300
301
302
303
304
305int ui_mvwadd_wch(UiSurface *s, ss_t w, uint y, uint x,
const UiCell *cell) {
308 mvwadd_wch(s->mwin[w], y, x, cell);
312
313
314
315
316
318 if (!s || !cmplx_buf)
320 wadd_wchstr(s->mwin[w], cmplx_buf);
324
325
326
327
328
329
330
332 if (!s || !cmplx_buf)
334 mvwadd_wchstr(s->mwin[w], y, x, cmplx_buf);
338
339
340
341
342
343
345 if (!s || !cmplx_buf)
347 wadd_wchnstr(s->mwin[w], cmplx_buf, n);
351
352
353
354
355
356
357
358
360 if (!s || !cmplx_buf)
362 mvwadd_wchnstr(s->mwin[w], y, x, cmplx_buf, n);
366
367
369
370
373 for (
int s = 0; s <=
sfc_ptr; s++) {
#define min(x, y)
min macro evaluates two expressions, returning least result
int ui_draw_ch_yx(UiSurface *s, ss_t w, uint y, uint x, const char c)
Draw a character at a specific position in a surface window.
void ui_render()
Render the UI by updating panels and refreshing the display.
int ui_draw_text_n(UiSurface *s, ss_t w, uint y, uint x, const char *text, int m)
Draw a text string at a specific position in a surface window.
int ui_draw_text_fill(UiSurface *s, ss_t w, uint y, uint x, const char *text, int m)
Draw a text string at a specific position in a surface window, filling the remaining space with space...
int ui_draw_text(UiSurface *s, ss_t w, uint y, uint x, const char *text)
on specified window, move to y, x, add string
void ui_restore_wins()
Restore the state of all windows in the UI. This function refreshes the standard screen and all surfa...
int ui_draw_ch(UiSurface *s, ss_t w, const char c)
Draw a character in a surface window.
int ui_wclrtobot(UiSurface *s, ss_t w)
Set the style of a surface window.
int ui_wclrtoeol(UiSurface *s, ss_t w)
Clear to the end of the line in a surface window.
UiSurface * ui_surface[UI_SFC_MAX]
int ui_mvwadd_wchnstr(UiSurface *s, ss_t w, uint y, uint x, const UiCell *cmplx_buf, uint n)
Draw a complex character string at a specific position in a surface window, with a maximum length.
int ui_waddstr(UiSurface *s, ss_t w, const char *text)
Draw a text string in a surface window.
int ui_mvwaddnwstr(UiSurface *s, ss_t w, uint y, uint x, const wchar_t *wstr, int m)
Draw a wide-character string at a specific position in a surface window, with a maximum length.
int ui_waddwstr(UiSurface *s, ss_t w, const wchar_t *wstr)
Draw a wide-character string in a surface window.
int ui_mvwaddch(UiSurface *s, ss_t w, uint y, uint x, const char c)
Draw a character in a surface window.
int ui_waddnstr(UiSurface *s, ss_t w, const char *text, int m)
Draw a text string in a surface window, with a maximum length.
int ui_mvwaddnstr(UiSurface *s, ss_t w, uint y, uint x, const char *text, int m)
Draw a text string at a specific position in a surface window, with a maximum length.
int ui_mvwadd_wchstr(UiSurface *s, ss_t w, uint y, uint x, const UiCell *cmplx_buf)
Draw a complex character string at a specific position in a surface window.
int ui_mvwaddwstr(UiSurface *s, ss_t w, uint y, uint x, const wchar_t *wstr)
Draw a wide-character string at a specific position in a surface window.
int ui_mvwaddstr(UiSurface *s, ss_t w, uint y, uint x, const char *text)
Draw a text string at a specific position in a surface window.
int ui_mvwadd_wch(UiSurface *s, ss_t w, uint y, uint x, const UiCell *cell)
Draw a complex character at a specific position in a surface window.
int ui_mvwaddstr_fill(UiSurface *s, ss_t w, uint y, uint x, const char *str, int m)
Draw a text string at a specific position in a surface window, filling the remaining space with space...
int ui_wadd_wch(UiSurface *s, ss_t w, const UiCell *cell)
Draw a complex character in a surface window.
int ui_waddnwstr(UiSurface *s, ss_t w, const wchar_t *wstr, int m)
Draw a wide-character string in a surface window, with a maximum length.
int ui_wadd_wchstr(UiSurface *s, ss_t w, const UiCell *cmplx_buf)
Draw a complex character string in a surface window.
int ui_wadd_wchnstr(UiSurface *s, ss_t w, const UiCell *cmplx_buf, uint n)
Draw a complex character string in a surface window, with a maximum length.