aboutsummaryrefslogtreecommitdiff
path: root/include/mgui/richtext.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/mgui/richtext.h')
-rw-r--r--include/mgui/richtext.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/mgui/richtext.h b/include/mgui/richtext.h
new file mode 100644
index 0000000..52706f5
--- /dev/null
+++ b/include/mgui/richtext.h
@@ -0,0 +1,38 @@
+#ifndef MGUI_RICHTEXT_H
+#define MGUI_RICHTEXT_H
+
+#include "widget.h"
+#include <stddef.h>
+#include <stdbool.h>
+
+typedef struct mgl_vertex mgl_vertex;
+
+typedef struct {
+ mgl_vertex *vertices;
+ size_t vertices_capacity;
+ size_t vertex_count;
+} mgui_richtext_vertex_data;
+
+typedef struct {
+ mgui_widget widget;
+ char *str;
+ size_t str_size;
+ unsigned int character_size;
+ mgl_vec2i position;
+ mgl_vec2i render_size;
+ int width;
+ mgui_richtext_vertex_data vertex_data[2];
+ bool dirty;
+} mgui_richtext;
+
+mgui_richtext* mgui_richtext_create(const char *str, size_t size, unsigned char character_size);
+mgui_widget* mgui_richtext_to_widget(mgui_richtext *list);
+mgui_richtext* mgui_widget_to_richtext(mgui_widget *widget);
+
+void mgui_richtext_set_position(mgui_richtext *self, mgl_vec2i position);
+void mgui_richtext_set_width(mgui_richtext *self, int width);
+void mgui_richtext_on_event(mgui_richtext *self, mgl_window *window, mgl_event *event);
+/* Returns the size of the widget */
+mgl_vec2i mgui_richtext_draw(mgui_richtext *self, mgl_window *window);
+
+#endif /* MGUI_RICHTEXT_H */