diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-12-04 01:37:07 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-12-04 01:37:07 +0100 |
commit | d3a5b3d579e30ce02afd5e270dfdd511af195c31 (patch) | |
tree | 7d5aaa9d8289e7f8af2d62f796336f207375b610 /src/mgui/widget.c | |
parent | 9644f3c05b808a3cac3892aae36ffca2cce9357d (diff) |
Add image
Diffstat (limited to 'src/mgui/widget.c')
-rw-r--r-- | src/mgui/widget.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mgui/widget.c b/src/mgui/widget.c index 195d253..63bc97b 100644 --- a/src/mgui/widget.c +++ b/src/mgui/widget.c @@ -1,6 +1,10 @@ #include "../../include/mgui/widget.h" #include "../../include/mgui/list.h" #include "../../include/mgui/button.h" +#include "../../include/mgui/label.h" +#include "../../include/mgui/image.h" + +/* TODO: Use margin */ void mgui_widget_init(mgui_widget *self, mgui_widget_type type) { self->type = type; @@ -22,6 +26,12 @@ void mgui_widget_set_position(mgui_widget *self, mgl_vec2i position) { case MGUI_WIDGET_BUTTON: mgui_button_set_position(mgui_widget_to_button(self), position); break; + case MGUI_WIDGET_LABEL: + mgui_label_set_position(mgui_widget_to_label(self), position); + break; + case MGUI_WIDGET_IMAGE: + mgui_image_set_position(mgui_widget_to_image(self), position); + break; } } @@ -33,6 +43,12 @@ void mgui_widget_set_width(mgui_widget *self, int width) { case MGUI_WIDGET_BUTTON: mgui_button_set_width(mgui_widget_to_button(self), width); break; + case MGUI_WIDGET_LABEL: + mgui_label_set_width(mgui_widget_to_label(self), width); + break; + case MGUI_WIDGET_IMAGE: + mgui_image_set_width(mgui_widget_to_image(self), width); + break; } } @@ -44,6 +60,12 @@ void mgui_widget_on_event(mgui_widget *self, mgl_window *window, mgl_event *even case MGUI_WIDGET_BUTTON: mgui_button_on_event(mgui_widget_to_button(self), window, event); break; + case MGUI_WIDGET_LABEL: + mgui_label_on_event(mgui_widget_to_label(self), window, event); + break; + case MGUI_WIDGET_IMAGE: + mgui_image_on_event(mgui_widget_to_image(self), window, event); + break; } } @@ -53,6 +75,10 @@ mgl_vec2i mgui_widget_draw(mgui_widget *self, mgl_window *window) { return mgui_list_draw(mgui_widget_to_list(self), window); case MGUI_WIDGET_BUTTON: return mgui_button_draw(mgui_widget_to_button(self), window); + case MGUI_WIDGET_LABEL: + return mgui_label_draw(mgui_widget_to_label(self), window); + case MGUI_WIDGET_IMAGE: + return mgui_image_draw(mgui_widget_to_image(self), window); } return (mgl_vec2i){ 0, 0 }; } |