blob: c529c56e4e186a70590e56868c83addf54725e6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "widget.h"
static uiStretch StretchFromDirection(uiLayoutDirection direction) {
switch (direction) {
case uiHorizontal:
return uiStretchX;
case uiVertical:
return uiStretchY;
}
assert(false);
return uiStretchNone;
}
uiLayout* uiMakeLayout(uiPtr parent, uiLayoutDirection direction) {
uiLayout* layout = UI_NEW(uiLayout);
*layout = (uiLayout){
.widget = (uiWidget){.type = uiTypeLayout,
.stretch = StretchFromDirection(direction)},
.direction = direction,
};
WidgetSetParent(uiMakeLayoutPtr(layout), parent);
return layout;
}
|