summaryrefslogtreecommitdiff
path: root/project-base/src/qui/size_container.c
diff options
context:
space:
mode:
Diffstat (limited to 'project-base/src/qui/size_container.c')
-rw-r--r--project-base/src/qui/size_container.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/project-base/src/qui/size_container.c b/project-base/src/qui/size_container.c
new file mode 100644
index 0000000..f5b7a90
--- /dev/null
+++ b/project-base/src/qui/size_container.c
@@ -0,0 +1,29 @@
+void _qui_update_size_container(qui_widget* el) {
+}
+
+void _qui_render_size_container(qui_widget* el) {
+ qui_size_container* data = (qui_size_container*)el->data;
+ renderer->render_rectangle(el->x, el->y, el->width, el->height, active_ui_style.widget_panel_background);
+ if (data->direction == TOP) {
+ renderer->render_rectangle(el->x, el->y, el->width, DRAG_BAR_SIZE, active_ui_style.widget_resize_bar_background);
+ renderer->render_rectangle(el->x, el->y, el->width, 1, active_ui_style.widget_border_outter_static);
+ }
+}
+
+qui_widget* qui_create_size_container(qui_widget* qui, u8 dir, u16 start_size)
+{
+ log_assert(qui->type == WIDGET_VERTICAL_LAYOUT, "Size container can only be added to vertical or horizontal layout");
+ log_assert(dir == TOP, "Only TOP direction is supported");
+ qui_widget* wg = _qui_create_empty_widget(qui);
+ qui_size_container* data = mem_alloc(sizeof(qui_size_container));
+ data->direction = dir;
+ wg->data = (u8*)data;
+ wg->type = WIDGET_SIZE_CONTAINER;
+ if (qui && qui->type == WIDGET_VERTICAL_LAYOUT) {
+ wg->height = start_size;
+ }
+ else {
+ log_assert(0, "Sized container must be placed in vertical or horizontal layout");
+ }
+ return wg;
+} \ No newline at end of file