From 14770f42df291753a240def91fb488a904a909c1 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 2 Dec 2021 14:20:48 +0100 Subject: Initial commit, set up skeleton with list and button --- include/mgui/list.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 include/mgui/list.h (limited to 'include/mgui/list.h') diff --git a/include/mgui/list.h b/include/mgui/list.h new file mode 100644 index 0000000..1da326d --- /dev/null +++ b/include/mgui/list.h @@ -0,0 +1,33 @@ +#ifndef MGUI_LIST_H +#define MGUI_LIST_H + +#include "widget.h" +#include + +typedef struct mgl_window mgl_window; +typedef struct mgl_event mgl_event; + +typedef enum { + MGUI_LIST_HORIZONITAL, + MGUI_LIST_VERTICAL +} mgui_list_direction; + +typedef struct { + mgui_widget widget; + mgui_list_direction direction; + mgl_vec2i position; + mgui_widget **items; + size_t num_items; + size_t items_capacity; +} mgui_list; + +mgui_list* mgui_list_create(mgui_list_direction direction); +mgui_widget* mgui_list_to_widget(mgui_list *list); +mgui_list* mgui_widget_to_list(mgui_widget *widget); + +void mgui_list_set_position(mgui_list *self, mgl_vec2i position); +void mgui_list_append(mgui_list *self, mgui_widget *widget); +void mgui_list_on_event(mgui_list *self, mgl_window *window, mgl_event *event); +void mgui_list_draw(mgui_list *self, mgl_window *window); + +#endif /* MGUI_LIST_H */ -- cgit v1.2.3