summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2022-02-25 11:17:36 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2022-03-01 17:10:24 +0100
commitbfa0029f3e734ce5fda6e96dc74ed4f4a96556f6 (patch)
treecaecd3747ac536fce057c812f9f59e9c30659119
parent0365e093104248439c6df595fcf38d102b2c2fb9 (diff)
Added simple test menu
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--src/messenger_cli.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/messenger_cli.c b/src/messenger_cli.c
index 97ab83d..558170f 100644
--- a/src/messenger_cli.c
+++ b/src/messenger_cli.c
@@ -49,8 +49,11 @@ run (void *cls, char* const* args,
getmaxyx(stdscr, my, mx);
WINDOW *win = newwin(15, 30, by + (my - by - 15) / 2, bx + (mx - bx - 30) / 2);
-
- char c;
+ keypad(win, TRUE);
+
+ int selected = 0;
+
+ int c;
do {
getbegyx(stdscr, by, bx);
getmaxyx(stdscr, my, mx);
@@ -76,8 +79,20 @@ run (void *cls, char* const* args,
box(win, 0, 0);
wmove(win, 1, 1);
- wprintw(win, "%d %d, %d %d", bx, by, mx, my);
+ wprintw(win, "%d %d, %d %d | %d %d", bx, by, mx, my, c, KEY_DOWN);
+
+ const int attrs_select = A_BOLD;
+ for (int i = 0; i < 5; i++) {
+ if (i == selected) wattron(win, attrs_select);
+
+ wmove(win, i+2, 1);
+ wprintw(win, "Option %d", i+1);
+
+ if (i == selected) wattroff(win, attrs_select);
+ }
+
+ wmove(win, 7, 1);
c = wgetch(win);
}
else
@@ -85,6 +100,9 @@ run (void *cls, char* const* args,
c = getch();
}
+ if (KEY_UP == c) selected = (selected > 0? selected - 1 : 0);
+ else if (KEY_DOWN == c) selected = (selected < 4? selected + 1 : 4);
+
clear();
refresh();
} while (c != 'q');