From 9644f3c05b808a3cac3892aae36ffca2cce9357d Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 2 Dec 2021 16:48:23 +0100 Subject: Resize list widgets to the list width for vertical lists --- tests/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests') 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); } -- cgit v1.2.3