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 --- src/mgui/widget.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/mgui/widget.c') diff --git a/src/mgui/widget.c b/src/mgui/widget.c index f35ff05..195d253 100644 --- a/src/mgui/widget.c +++ b/src/mgui/widget.c @@ -25,6 +25,17 @@ void mgui_widget_set_position(mgui_widget *self, mgl_vec2i position) { } } +void mgui_widget_set_width(mgui_widget *self, int width) { + switch(self->type) { + case MGUI_WIDGET_LIST: + mgui_list_set_width(mgui_widget_to_list(self), width); + break; + case MGUI_WIDGET_BUTTON: + mgui_button_set_width(mgui_widget_to_button(self), width); + break; + } +} + void mgui_widget_on_event(mgui_widget *self, mgl_window *window, mgl_event *event) { switch(self->type) { case MGUI_WIDGET_LIST: -- cgit v1.2.3