aboutsummaryrefslogtreecommitdiff
path: root/ui_nwindow.h
diff options
context:
space:
mode:
Diffstat (limited to 'ui_nwindow.h')
-rw-r--r--ui_nwindow.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/ui_nwindow.h b/ui_nwindow.h
new file mode 100644
index 0000000..5a983f7
--- /dev/null
+++ b/ui_nwindow.h
@@ -0,0 +1,44 @@
+#ifndef UI_TXTWINDOW_H
+#define UI_TXTWINDOW_H 1
+
+#include <ncurses.h>
+
+
+#define INITIAL_TITLE_LEN 32
+#define INITIAL_TEXT_LEN 128
+
+struct txtwindow {
+ unsigned int y;
+ unsigned int x;
+ unsigned int width;
+ unsigned int height;
+ bool scrollable;
+ char *title;
+ size_t title_len;
+ char *text;
+ size_t text_len;
+ int (*window_func)(WINDOW *, struct txtwindow *);
+ chtype 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, 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, const char *text);
+
+void
+set_txtwindow_scrollable(struct txtwindow *a, bool scrollable);
+
+#endif