aboutsummaryrefslogtreecommitdiff
path: root/libgui/inc
diff options
context:
space:
mode:
authorMarvin Borner2020-10-25 12:09:38 +0100
committerMarvin Borner2020-10-25 12:09:38 +0100
commitf83d5e4b8e315f2b17f0c8bf390bf967f02f5837 (patch)
tree5b31cb17c5f5c5b0b438ecfe40af2bf9730411d7 /libgui/inc
parentffb2c74435ad0e313b7c33ae1f00f02824bb6fc0 (diff)
Added buttons
Diffstat (limited to 'libgui/inc')
-rw-r--r--libgui/inc/gfx.h1
-rw-r--r--libgui/inc/gui.h27
2 files changed, 24 insertions, 4 deletions
diff --git a/libgui/inc/gfx.h b/libgui/inc/gfx.h
index 342fe84..fe48ac2 100644
--- a/libgui/inc/gfx.h
+++ b/libgui/inc/gfx.h
@@ -37,6 +37,7 @@
#define WF_NO_FOCUS (1 << 0)
#define WF_NO_DRAG (1 << 1)
#define WF_NO_RESIZE (1 << 2)
+#define WF_RELATIVE (1 << 3)
enum message_type { WM_NEW_CONTEXT = EVENT_MAX + 1, WM_REDRAW, WM_KEYBOARD };
diff --git a/libgui/inc/gui.h b/libgui/inc/gui.h
index 565bcf6..ea1e40e 100644
--- a/libgui/inc/gui.h
+++ b/libgui/inc/gui.h
@@ -6,20 +6,39 @@
#include <def.h>
#include <gfx.h>
+#include <list.h>
#define MAX_CHILDS 100
+enum element_type { GUI_TYPE_CONTAINER, GUI_TYPE_BUTTON, GUI_TYPE_TEXTBOX };
+
+struct element_button {
+ const char *text;
+ u32 color;
+};
+
+struct element_textbox {
+ const char *text;
+ u32 color;
+};
+
struct element {
- struct context *ctx;
+ enum element_type type;
+ u32 window_id;
+ struct context *ctx; // Coordinates are relative to container
+ struct list *childs;
+ void *data; // Who needs static types anyways :)
};
struct window {
+ u32 id;
const char *title;
- struct element *childs[MAX_CHILDS];
+ struct list *childs;
struct context *ctx;
};
-// TODO: Remove window return (internal)
-struct window *gui_init(const char *title, u32 width, u32 height);
+struct element *gui_init(const char *title, u32 width, u32 height);
+struct element *gui_add_button(struct element *container, int x, int y, u32 width, u32 height,
+ const char *text, u32 color);
#endif