From 4152fbecb6ee8360575aa4c24e9cedf822f159dc Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Wed, 25 Mar 2026 19:59:14 -0700 Subject: Implement vertical and horizontal layouts. Use widget position properly when rendering. Toolbar, buttons and edit bars WIP --- src/widget/widget.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/widget/widget.h') diff --git a/src/widget/widget.h b/src/widget/widget.h index db11164..7482d38 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -13,9 +13,16 @@ DEF_LIST(Widget, uiWidget*) typedef struct uiWidget { uiWidgetType type; uiRect rect; + uiStretch stretch; + uiPtr parent; Widget_list children; } uiWidget; +typedef struct uiLayout { + uiWidget widget; + uiLayoutDirection direction; +} uiLayout; + typedef struct uiButton { uiWidget widget; string text; @@ -30,6 +37,11 @@ typedef struct uiLabel { string text; } uiLabel; +typedef struct uiEdit { + uiWidget widget; + string text; +} uiEdit; + typedef struct uiScrollbar { int width; int height; // Total height: handle plus scrollable area. @@ -45,7 +57,6 @@ typedef struct uiTable { uiWidget widget; int rows; int cols; - int height; // Height in pixels. int* widths; // Width, in pixels, for each column. uiCell* header; // If non-null, row of 'cols' header cells. uiCell** cells; // Array of 'rows' rows, each of 'cols' cells. @@ -57,6 +68,7 @@ typedef struct uiTable { } flags; } uiTable; +void WidgetSetParent(uiPtr child, uiPtr parent); void DestroyWidget(uiWidget** ppWidget); /// Set the scrollbar handle's y-coordinate, which is clipped to the scrollbar's -- cgit v1.2.3