aboutsummaryrefslogtreecommitdiff
path: root/src/mgui/widget.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-12-02 16:48:23 +0100
committerdec05eba <dec05eba@protonmail.com>2021-12-02 16:48:23 +0100
commit9644f3c05b808a3cac3892aae36ffca2cce9357d (patch)
tree6f4b575c3e7fc21bea91a9721291aa8f97aa1c9c /src/mgui/widget.c
parentdf3eb74930491458f97a3328a68bf8526fef3caf (diff)
Resize list widgets to the list width for vertical lists
Diffstat (limited to 'src/mgui/widget.c')
-rw-r--r--src/mgui/widget.c11
1 files changed, 11 insertions, 0 deletions
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: