aboutsummaryrefslogtreecommitdiff
path: root/src/ui_txtwindow.h
diff options
context:
space:
mode:
authortoni <toni@devlap.local>2015-11-16 20:07:03 +0100
committertoni <toni@devlap.local>2015-11-16 20:07:03 +0100
commit99dfc48c542ec59c9541faa33c8895bfa471089b (patch)
tree1bbe30ef83d50bc79fde1ff32d78d3f8b9836255 /src/ui_txtwindow.h
parent7bd71541d76cd5f23b91981f6d0a19d490926356 (diff)
- ui_nwindow.c renamed to better ui_txtwindow.c
- better ui_txtwindow.c
Diffstat (limited to 'src/ui_txtwindow.h')
-rw-r--r--src/ui_txtwindow.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/ui_txtwindow.h b/src/ui_txtwindow.h
new file mode 100644
index 0000000..913cd99
--- /dev/null
+++ b/src/ui_txtwindow.h
@@ -0,0 +1,53 @@
+#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; ui_thrd_force_update()
+
+struct txtwindow {
+ unsigned int y;
+ unsigned int x;
+ unsigned int width;
+ unsigned int height;
+ bool active;
+ char *title;
+ size_t title_len;
+ char **text;
+ int (*window_func)(WINDOW *, struct txtwindow *);
+ chtype attrs;
+ chtype text_attrs;
+ void *userptr;
+};
+
+typedef int (*window_func)(WINDOW *, struct txtwindow *);
+
+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);
+
+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);
+
+#endif