diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-11-23 22:33:43 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-11-23 22:33:43 +0100 |
| commit | b1e857cf1471d1871a9396696b22fa531da98249 (patch) | |
| tree | 3923008a8653057698cb339faf6dcfa92e18364b /project-base/src/qui/size_container.c | |
| parent | 106bb7fcadf637cec883648916cc8d19529d6199 (diff) | |
add projbase to repo
Diffstat (limited to 'project-base/src/qui/size_container.c')
| -rw-r--r-- | project-base/src/qui/size_container.c | 29 |
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 |
