From b1e857cf1471d1871a9396696b22fa531da98249 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 23 Nov 2024 22:33:43 +0100 Subject: add projbase to repo --- project-base/src/qui/size_container.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 project-base/src/qui/size_container.c (limited to 'project-base/src/qui/size_container.c') 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 -- cgit v1.2.3-70-g09d2