diff options
author | Marvin Borner | 2020-10-25 13:20:35 +0100 |
---|---|---|
committer | Marvin Borner | 2020-10-25 13:20:35 +0100 |
commit | c9f89174b9ce73ed93bfad14d57b8f1a43db6bf6 (patch) | |
tree | 8a9fc5d2b7ac66b42b15521c421573db520d7d6b /apps/window.c | |
parent | f83d5e4b8e315f2b17f0c8bf390bf967f02f5837 (diff) |
Added gui event loop and onclick listener
Diffstat (limited to 'apps/window.c')
-rw-r--r-- | apps/window.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/apps/window.c b/apps/window.c index 601f187..ffd860d 100644 --- a/apps/window.c +++ b/apps/window.c @@ -8,19 +8,22 @@ #include <print.h> #include <str.h> +void on_click() +{ + print("CLICK!\n"); +} + int main() { print("[test context loaded]\n"); struct element *container = gui_init("test", 0, 0); - gui_add_button(container, 10, 10, 100, 20, "hallo", COLOR_RED); + struct element_button *button = + gui_add_button(container, 10, 10, 100, 20, "hallo", COLOR_RED); + + button->on_click = on_click; + + gui_event_loop(container); - struct message *msg; - while (1) { - if (!(msg = msg_receive())) { - yield(); - continue; - } - } return 0; } |