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/widget.h | |
| 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/widget.h')
| -rw-r--r-- | src/widget/widget.h | 14 |
1 files changed, 13 insertions, 1 deletions
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*) | |||
| 13 | typedef struct uiWidget { | 13 | typedef struct uiWidget { |
| 14 | uiWidgetType type; | 14 | uiWidgetType type; |
| 15 | uiRect rect; | 15 | uiRect rect; |
| 16 | uiStretch stretch; | ||
| 17 | uiPtr parent; | ||
| 16 | Widget_list children; | 18 | Widget_list children; |
| 17 | } uiWidget; | 19 | } uiWidget; |
| 18 | 20 | ||
| 21 | typedef struct uiLayout { | ||
| 22 | uiWidget widget; | ||
| 23 | uiLayoutDirection direction; | ||
| 24 | } uiLayout; | ||
| 25 | |||
| 19 | typedef struct uiButton { | 26 | typedef struct uiButton { |
| 20 | uiWidget widget; | 27 | uiWidget widget; |
| 21 | string text; | 28 | string text; |
| @@ -30,6 +37,11 @@ typedef struct uiLabel { | |||
| 30 | string text; | 37 | string text; |
| 31 | } uiLabel; | 38 | } uiLabel; |
| 32 | 39 | ||
| 40 | typedef struct uiEdit { | ||
| 41 | uiWidget widget; | ||
| 42 | string text; | ||
| 43 | } uiEdit; | ||
| 44 | |||
| 33 | typedef struct uiScrollbar { | 45 | typedef struct uiScrollbar { |
| 34 | int width; | 46 | int width; |
| 35 | int height; // Total height: handle plus scrollable area. | 47 | int height; // Total height: handle plus scrollable area. |
| @@ -45,7 +57,6 @@ typedef struct uiTable { | |||
| 45 | uiWidget widget; | 57 | uiWidget widget; |
| 46 | int rows; | 58 | int rows; |
| 47 | int cols; | 59 | int cols; |
| 48 | int height; // Height in pixels. | ||
| 49 | int* widths; // Width, in pixels, for each column. | 60 | int* widths; // Width, in pixels, for each column. |
| 50 | uiCell* header; // If non-null, row of 'cols' header cells. | 61 | uiCell* header; // If non-null, row of 'cols' header cells. |
| 51 | uiCell** cells; // Array of 'rows' rows, each of 'cols' cells. | 62 | uiCell** cells; // Array of 'rows' rows, each of 'cols' cells. |
| @@ -57,6 +68,7 @@ typedef struct uiTable { | |||
| 57 | } flags; | 68 | } flags; |
| 58 | } uiTable; | 69 | } uiTable; |
| 59 | 70 | ||
| 71 | void WidgetSetParent(uiPtr child, uiPtr parent); | ||
| 60 | void DestroyWidget(uiWidget** ppWidget); | 72 | void DestroyWidget(uiWidget** ppWidget); |
| 61 | 73 | ||
| 62 | /// Set the scrollbar handle's y-coordinate, which is clipped to the scrollbar's | 74 | /// Set the scrollbar handle's y-coordinate, which is clipped to the scrollbar's |
