From 396686a09ef471499c11256b8516c2702f761060 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 8 Dec 2021 04:16:34 +0100 Subject: Destroy widgets --- include/mgui/button.h | 6 +++++- include/mgui/image.h | 1 + include/mgui/label.h | 1 + include/mgui/list.h | 1 + include/mgui/richtext.h | 1 + include/mgui/scrollview.h | 1 + include/mgui/widget.h | 1 + 7 files changed, 11 insertions(+), 1 deletion(-) (limited to 'include/mgui') diff --git a/include/mgui/button.h b/include/mgui/button.h index d9e8783..986cb9c 100644 --- a/include/mgui/button.h +++ b/include/mgui/button.h @@ -4,14 +4,18 @@ #include "widget.h" #include #include +#include typedef struct { mgui_widget widget; + char *str; + size_t str_size; mgl_rectangle background; mgl_text text; } mgui_button; -mgui_button* mgui_button_create(); +mgui_button* mgui_button_create(const char *str, size_t size, unsigned char character_size); +void mgui_button_destroy(mgui_button *button); mgui_widget* mgui_button_to_widget(mgui_button *list); mgui_button* mgui_widget_to_button(mgui_widget *widget); diff --git a/include/mgui/image.h b/include/mgui/image.h index c1072d4..8d34a7a 100644 --- a/include/mgui/image.h +++ b/include/mgui/image.h @@ -10,6 +10,7 @@ typedef struct { } mgui_image; mgui_image* mgui_image_create(const char *filepath); +void mgui_image_destroy(mgui_image *image); mgui_widget* mgui_image_to_widget(mgui_image *list); mgui_image* mgui_widget_to_image(mgui_widget *widget); diff --git a/include/mgui/label.h b/include/mgui/label.h index 920ecf9..4b66ef8 100644 --- a/include/mgui/label.h +++ b/include/mgui/label.h @@ -15,6 +15,7 @@ typedef struct { } mgui_label; mgui_label* mgui_label_create(const char *str, size_t size, unsigned char character_size); +void mgui_label_destroy(mgui_label *label); mgui_widget* mgui_label_to_widget(mgui_label *list); mgui_label* mgui_widget_to_label(mgui_widget *widget); diff --git a/include/mgui/list.h b/include/mgui/list.h index f0080c8..af1ceae 100644 --- a/include/mgui/list.h +++ b/include/mgui/list.h @@ -24,6 +24,7 @@ typedef struct { } mgui_list; mgui_list* mgui_list_create(mgui_list_direction direction); +void mgui_list_destroy(mgui_list *list); mgui_widget* mgui_list_to_widget(mgui_list *list); mgui_list* mgui_widget_to_list(mgui_widget *widget); diff --git a/include/mgui/richtext.h b/include/mgui/richtext.h index 52706f5..c0604c9 100644 --- a/include/mgui/richtext.h +++ b/include/mgui/richtext.h @@ -26,6 +26,7 @@ typedef struct { } mgui_richtext; mgui_richtext* mgui_richtext_create(const char *str, size_t size, unsigned char character_size); +void mgui_richtext_destroy(mgui_richtext *richtext); mgui_widget* mgui_richtext_to_widget(mgui_richtext *list); mgui_richtext* mgui_widget_to_richtext(mgui_widget *widget); diff --git a/include/mgui/scrollview.h b/include/mgui/scrollview.h index d394e50..1b3d109 100644 --- a/include/mgui/scrollview.h +++ b/include/mgui/scrollview.h @@ -14,6 +14,7 @@ typedef struct { } mgui_scrollview; mgui_scrollview* mgui_scrollview_create(); +void mgui_scrollview_destroy(mgui_scrollview *scrollview); mgui_widget* mgui_scrollview_to_widget(mgui_scrollview *list); mgui_scrollview* mgui_widget_to_scrollview(mgui_widget *widget); diff --git a/include/mgui/widget.h b/include/mgui/widget.h index ee3a9f1..679e4ad 100644 --- a/include/mgui/widget.h +++ b/include/mgui/widget.h @@ -29,6 +29,7 @@ struct mgui_widget { }; void mgui_widget_init(mgui_widget *self, mgui_widget_type type); +void mgui_widget_destroy(mgui_widget *widget); void mgui_widget_set_margin(mgui_widget *self, int left, int top, int right, int bottom); void mgui_widget_set_position(mgui_widget *self, mgl_vec2i position); -- cgit v1.2.3