aboutsummaryrefslogtreecommitdiff
path: root/ui_nwindow.h
blob: ee2b810f4d1c13db5cc8564d7e3863179e9e65e4 (plain)
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
#ifndef UI_TXTWINDOW_H
#define UI_TXTWINDOW_H 1

#include <ncurses.h>


#define INITIAL_TITLE_LEN 32

struct txtwindow {
  unsigned int y;
  unsigned int x;
  unsigned int width;
  unsigned int height;
  bool scrollable;
  char *title;
  size_t title_len;
  char **text;
  int (*window_func)(WINDOW *, struct txtwindow *);
  chtype attrs;
  chtype text_attrs;
};

typedef int (*window_func)(WINDOW *, struct txtwindow *);

struct txtwindow *
init_txtwindow(unsigned int, unsigned int y, unsigned int width, unsigned int height, chtype attrs, chtype text_attrs, window_func cb_update);

void
free_txtwindow(struct txtwindow *a);

int
txtwindow_cb(WINDOW *win, void *data, bool timedout);

void
register_txtwindow(struct txtwindow *a);

void
set_txtwindow_text(struct txtwindow *a, char *text);

void
set_txtwindow_scrollable(struct txtwindow *a, bool scrollable); 

void
set_txtwindow_title(struct txtwindow *a, const char *title);

#endif