diff options
| author | 3gg <3gg@shellblade.net> | 2026-03-25 19:59:14 -0700 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2026-03-25 19:59:14 -0700 |
| commit | 4152fbecb6ee8360575aa4c24e9cedf822f159dc (patch) | |
| tree | 9e9b9db0216a37c5867d472a65289502c459691f /src/widget/layout.c | |
| parent | 7778755c20e779554cd654ecdf7404d37b723fcc (diff) | |
Implement vertical and horizontal layouts. Use widget position properly when rendering. Toolbar, buttons and edit bars WIPmain
Diffstat (limited to 'src/widget/layout.c')
| -rw-r--r-- | src/widget/layout.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/widget/layout.c b/src/widget/layout.c new file mode 100644 index 0000000..c529c56 --- /dev/null +++ b/src/widget/layout.c | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #include "widget.h" | ||
| 2 | |||
| 3 | static uiStretch StretchFromDirection(uiLayoutDirection direction) { | ||
| 4 | switch (direction) { | ||
| 5 | case uiHorizontal: | ||
| 6 | return uiStretchX; | ||
| 7 | case uiVertical: | ||
| 8 | return uiStretchY; | ||
| 9 | } | ||
| 10 | assert(false); | ||
| 11 | return uiStretchNone; | ||
| 12 | } | ||
| 13 | |||
| 14 | uiLayout* uiMakeLayout(uiPtr parent, uiLayoutDirection direction) { | ||
| 15 | uiLayout* layout = UI_NEW(uiLayout); | ||
| 16 | |||
| 17 | *layout = (uiLayout){ | ||
| 18 | .widget = (uiWidget){.type = uiTypeLayout, | ||
| 19 | .stretch = StretchFromDirection(direction)}, | ||
| 20 | .direction = direction, | ||
| 21 | }; | ||
| 22 | WidgetSetParent(uiMakeLayoutPtr(layout), parent); | ||
| 23 | |||
| 24 | return layout; | ||
| 25 | } | ||
