aboutsummaryrefslogtreecommitdiff
path: root/client/ui.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.c
parent9256315371ad5a67eaee80cf7453d2885a59f5c3 (diff)
implemented tab key handlers
Diffstat (limited to 'client/ui.c')
-rw-r--r--client/ui.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/client/ui.c b/client/ui.c
index 41a392f..5f649e0 100644
--- a/client/ui.c
+++ b/client/ui.c
@@ -29,10 +29,26 @@ void w2_wmvaddnstr(WINDOW *win, unsigned int y, unsigned int x, char *str, unsig
waddnstr(win, str, len);
}
+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_key_handler() {
+ int ch;
+ void (*current_mode_key_handler)() = g_w2_keyhndl_ptrs[g_w2_ui_current_tab];
+ return;
+ while ((ch = getch()) != -1) {
+ if (ch == '\t') w2_ui_switch_tab(g_w2_ui_current_tab + 1);
+ else if (current_mode_key_handler != NULL) (*current_mode_key_handler)(ch);
+ }
+}
+
void w2_ui_main() {
g_w2_ui_width = getmaxx(g_w2_ui_win);
g_w2_ui_height = getmaxy(g_w2_ui_win);
+ w2_ui_key_handler();
w2_ui_paint();
}
@@ -46,7 +62,6 @@ void w2_ui_paint() {
prefresh(g_w2_ui_pad_tabbar, 0, 0, 2, 0, 2, g_w2_ui_width - 1);
prefresh(g_w2_ui_pad_body, W2_MAX(0, g_w2_ui_pad_body_scroll), 0,
4 - W2_MIN(0, g_w2_ui_pad_body_scroll), 0, g_w2_ui_height - 2, g_w2_ui_width - 1);
- // wrefresh(g_w2_ui_win);
}
void w2_ui_paint_statusbar() {