summaryrefslogtreecommitdiff
path: root/client/ui_tabbar.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/ui_tabbar.c')
-rw-r--r--client/ui_tabbar.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/client/ui_tabbar.c b/client/ui_tabbar.c
new file mode 100644
index 0000000..637d2f3
--- /dev/null
+++ b/client/ui_tabbar.c
@@ -0,0 +1,33 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "strings.h"
+#include "ui.h"
+
+unsigned int g_w2_ui_tabbar_scroll = 0;
+unsigned int g_w2_ui_tabbar_lengths[W2_UI_TAB_COUNT];
+void (*g_w2_tab_ptrs[W2_UI_TAB_COUNT])(bool first);
+void (*g_w2_keyhndl_ptrs[W2_UI_TAB_COUNT])(int key);
+
+void w2_ui_tabbar_init() {
+ g_w2_tab_ptrs[W2_UI_TAB_START] = &w2_ui_tab_start;
+ g_w2_tab_ptrs[W2_UI_TAB_ERRCATCH] = &w2_ui_tab_errcatch;
+ g_w2_keyhndl_ptrs[W2_UI_TAB_START] = &w2_ui_onkey_errcatch;
+ g_w2_tab_ptrs[W2_UI_TAB_DIRC] = &w2_ui_tab_dirc;
+ g_w2_keyhndl_ptrs[W2_UI_TAB_DIRC] = &w2_ui_onkey_dirc;
+ g_w2_tab_ptrs[W2_UI_TAB_ORDERS] = &w2_ui_tab_orders;
+ g_w2_keyhndl_ptrs[W2_UI_TAB_ORDERS] = &w2_ui_onkey_orders;
+ g_w2_tab_ptrs[W2_UI_TAB_MODES] = &w2_ui_tab_modes;
+ g_w2_keyhndl_ptrs[W2_UI_TAB_MODES] = &w2_ui_onkey_modes;
+}
+
+void w2_ui_paint_tabbar() {
+ wmove(g_w2_ui_pad_tabbar, 0, 0);
+ for (unsigned int i = 0; i < W2_UI_TAB_COUNT; i++) {
+ g_w2_ui_tabbar_lengths[i] += 2 + strlen(g_w2_tab_strings[i]);
+
+ wprintw(g_w2_ui_pad_tabbar, " %c%s%c", g_w2_ui_current_tab == i ? '[' : ' ',
+ g_w2_tab_strings[i], g_w2_ui_current_tab == i ? ']' : ' ');
+ }
+ wprintw(g_w2_ui_pad_tabbar, " ");
+}