summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c57
1 files changed, 37 insertions, 20 deletions
diff --git a/src/main.c b/src/main.c
index ace9802..1a4ce8a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,28 +2,45 @@
#include <stdio.h>
#include <unistd.h>
-void on_button_click(MOUSE_ACTION mouse_action) {
- printf("hello");
- sleep(1);
-}
+bool is_clicked = false;
+
+void on_button_click(MOUSE_ACTION mouse_action) { is_clicked = !is_clicked; }
WIDGET *ui_build(TUI *tui) {
- return tui_make_box(
- -1, -1,
- tui_make_row(tui_make_widget_array(
- 3,
- tui_make_box(
- 8, 2,
- tui_make_button(tui_make_text("Hello, World!", COLOR_BLUE),
- on_button_click),
- COLOR_YELLOW),
- tui_make_box(
- 8, 2,
- tui_make_button(tui_make_text("Hello, World!", COLOR_RED),
- on_button_click),
- COLOR_BLUE),
- tui_make_text("Hello, World!", COLOR_RED), 1)),
- COLOR_MAGENTA);
+ if (is_clicked) {
+ return tui_make_box(
+ -1, -1,
+ tui_make_column(tui_make_widget_array(
+ 2, tui_make_box(0, 12, NULL, COLOR_NO_COLOR),
+ tui_make_row(tui_make_widget_array(
+ 2, tui_make_box(50, 0, NULL, COLOR_NO_COLOR),
+ tui_make_box(
+ 20, 3,
+ tui_make_column(tui_make_widget_array(
+ 2,
+ tui_make_text(
+ "This is the second page",
+ COLOR_BLUE),
+ tui_make_button(tui_make_text(" Back", COLOR_RED),
+ on_button_click))),
+
+ COLOR_WHITE))))),
+ COLOR_MAGENTA);
+ } else {
+ return tui_make_box(
+ -1, -1,
+ tui_make_column(tui_make_widget_array(
+ 2, tui_make_box(0, 12, NULL, COLOR_NO_COLOR),
+ tui_make_row(tui_make_widget_array(
+ 2, tui_make_box(50, 0, NULL, COLOR_NO_COLOR),
+ tui_make_button(
+ tui_make_box(
+ 16, 3,
+ tui_make_text("\nClick here", COLOR_BLUE),
+ COLOR_WHITE),
+ on_button_click))))),
+ COLOR_MAGENTA);
+ }
}
int main() {