diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-12-02 16:48:23 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-12-02 16:48:23 +0100 |
commit | 9644f3c05b808a3cac3892aae36ffca2cce9357d (patch) | |
tree | 6f4b575c3e7fc21bea91a9721291aa8f97aa1c9c /tests | |
parent | df3eb74930491458f97a3328a68bf8526fef3caf (diff) |
Resize list widgets to the list width for vertical lists
Diffstat (limited to 'tests')
-rw-r--r-- | tests/main.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/main.c b/tests/main.c index 79afbea..5f07558 100644 --- a/tests/main.c +++ b/tests/main.c @@ -9,16 +9,19 @@ int main() { return 1; mgl_window window; - if(mgl_window_create(&window, "mgl", &(mgl_window_create_params){ .size = {1280, 720} }) != 0) + if(mgl_window_create(&window, "mgl", &(mgl_window_create_params){ .size = { 1280, 720 } }) != 0) return 1; - mgui_list *list = mgui_list_create(MGUI_LIST_VERTICAL); + mgui_list *list = mgui_list_create(MGUI_LIST_VERTICAL, (mgl_vec2i){ 1280, 720 }); mgui_list_append(list, mgui_button_to_widget(mgui_button_create())); mgui_list_append(list, mgui_button_to_widget(mgui_button_create())); mgl_event event; while(mgl_window_is_open(&window)) { while(mgl_window_poll_event(&window, &event)) { + if(event.type == MGL_EVENT_RESIZED) { + mgui_list_set_size(list, (mgl_vec2i){ event.size.width, event.size.height }); + } mgui_list_on_event(list, &window, &event); } |