aboutsummaryrefslogtreecommitdiff
path: root/client/ui_tabbar.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-06-07 10:58:01 +0200
committerlonkaars <loek@pipeframe.xyz>2022-06-07 10:58:01 +0200
commit0b246d96f4928755b50a005dd954f051c717ed02 (patch)
treed6763257d11f79beb1f6c10bfc0fd7fa6ee0072d /client/ui_tabbar.c
parent9256315371ad5a67eaee80cf7453d2885a59f5c3 (diff)
implemented tab key handlers
Diffstat (limited to 'client/ui_tabbar.c')
-rw-r--r--client/ui_tabbar.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/client/ui_tabbar.c b/client/ui_tabbar.c
index 91d476f..f11d1a5 100644
--- a/client/ui_tabbar.c
+++ b/client/ui_tabbar.c
@@ -7,27 +7,17 @@
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;
-}
-
-void w2_ui_switch_tab(w2_e_ui_tabs next_tab) {
- g_w2_ui_current_tab = next_tab % W2_UI_TAB_COUNT;
- wclear(g_w2_ui_pad_body);
-}
-
-void w2_ui_tabbar_logic() {
- int ch;
- while ((ch = getch()) != -1) {
- if (ch == '\t') w2_ui_switch_tab(g_w2_ui_current_tab + 1);
- }
+ g_w2_keyhndl_ptrs[W2_UI_TAB_DIRC] = &w2_ui_onkey_dirc;
}
void w2_ui_paint_tabbar() {
- w2_ui_tabbar_logic();
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]);