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
|
#ifndef UI_TXTWINDOW_H
#define UI_TXTWINDOW_H 1
#include <ncurses.h>
#include "ui.h"
#define INITIAL_TITLE_LEN 32
#define set_txtwindow_active(wnd, activate) wnd->active = activate;
#define set_txtwindow_blink(wnd, blink) wnd->title_blink = blink;
struct txtwindow;
typedef int (*window_func)(WINDOW *, struct txtwindow *, bool);
struct txtwindow {
unsigned int y;
unsigned int x;
unsigned int width;
unsigned int height;
bool active;
char *title;
bool title_blink;
size_t title_len;
char **text;
window_func window_func;
chtype attrs;
chtype text_attrs;
};
struct txtwindow *
init_txtwindow(unsigned int x, unsigned int y, unsigned int width, unsigned int height, window_func cb_update);
struct txtwindow *
init_txtwindow_centered(unsigned int width, unsigned int height, window_func cb_update);
void
free_txtwindow(struct txtwindow *a);
void
register_txtwindow(struct txtwindow *a);
void
set_txtwindow_text(struct txtwindow *a, char *text);
size_t
get_txtwindow_rows(struct txtwindow *a);
size_t
get_txtwindow_textlen(size_t row_index, struct txtwindow *a);
void
set_txtwindow_title(struct txtwindow *a, const char *title);
void
set_txtwindow_color(struct txtwindow *a, chtype wnd, chtype txt);
void
set_txtwindow_pos(struct txtwindow *a, unsigned int x, unsigned int y);
void
set_txtwindow_dim(struct txtwindow *a, unsigned int w, unsigned int h);
#endif
|