66 lines
2.5 KiB
C
66 lines
2.5 KiB
C
/* date = June 24th 2023 9:43 pm */
|
|
|
|
#ifndef VN_UI_UTILS_H
|
|
#define VN_UI_UTILS_H
|
|
|
|
//- sixten: Rows and columns.
|
|
inline void UI_RowBegin(u32 Flags = 0, string Name = StrLit(""));
|
|
inline void UI_RowEnd(void);
|
|
inline void UI_ColumnBegin(u32 Flags = 0, string Name = StrLit(""));
|
|
inline void UI_ColumnEnd(void);
|
|
|
|
#define UI_Row(...) DeferLoop(UI_RowBegin(__VA_ARGS__), UI_RowEnd())
|
|
#define UI_Column(...) DeferLoop(UI_ColumnBegin(__VA_ARGS__), UI_ColumnEnd())
|
|
|
|
//- sixten: Compositions
|
|
inline void UI_PushAxisSize(axis2 Axis, ui_size Size);
|
|
inline void UI_PopAxisSize(axis2 Axis);
|
|
inline void UI_SetNextAxisSize(axis2 Axis, ui_size Size);
|
|
|
|
#define UI_AxisSize(Axis, Size) DeferLoop(UI_PushAxisSize(Axis, Size), UI_PopAxisSize(Axis))
|
|
|
|
#define UI_WidthFill UI_Width(UI_Percent(1, 0))
|
|
#define UI_HeightFill UI_Height(UI_Percent(1, 0))
|
|
|
|
#define UI_Size(Width, Height) UI_Width(Width) UI_Height(Height)
|
|
#define UI_PushSize(Width, Height) UI_PushWidth(Width); UI_PushHeight(Height)
|
|
#define UI_PopSize() UI_PopWidth(); UI_PopHeight()
|
|
#define UI_SetNextSize(Width, Height) UI_SetNextWidth(Width); UI_SetNextHeight(Height)
|
|
|
|
#define UI_Offset(x, y) UI_OffsetX(x) UI_OffsetY(y)
|
|
#define UI_PushOffset(x, y) UI_PushOffsetX(x); UI_PushOffsetY(y)
|
|
#define UI_PopOffset() UI_PopOffsetX(); UI_PopOffsetY()
|
|
#define UI_SetNextOffset(x, y) UI_SetNextOffsetX(x); UI_SetNextOffsetY(y)
|
|
|
|
#define UI_FixedP(Value) UI_FixedX(Value.x) UI_FixedY(Value.y)
|
|
#define UI_SetNextFixedP(Value) UI_SetNextFixedX((Value).x); UI_SetNextFixedY((Value).y)
|
|
|
|
//- sixten: Spacing
|
|
static ui_box *UI_NamedSpacer(ui_size Size, string String);
|
|
static ui_box *UI_NamedSpacerF(ui_size Size, char *Format, ...);
|
|
|
|
#define UI_Padding(Size) DeferLoop(UI_Spacer(Size), UI_Spacer(Size))
|
|
|
|
#define UI_FillPadding UI_Padding(UI_Percent(1, 0))
|
|
|
|
//- sixten: Scrollable regions
|
|
static void UI_ScrollBegin(r32 *X, r32 *Y, ui_box_flags Flags=UI_BoxFlag_Clip|UI_BoxFlag_DrawBorder, string Name = StrLit("Scrollable Region Container"));
|
|
static void UI_ScrollEnd(r32 *X, r32 *Y, ui_box_flags Flags=UI_BoxFlag_Clip|UI_BoxFlag_DrawBorder, string Name = StrLit("Scrollable Region Container"));
|
|
|
|
#define UI_Scroll(...) DeferLoop(UI_ScrollBegin(__VA_ARGS__), UI_ScrollEnd(__VA_ARGS__))
|
|
|
|
//- sixten: Common widgets
|
|
static ui_box *UI_Label(string String);
|
|
static ui_box *UI_LabelF(char *Format, ...);
|
|
|
|
static ui_signal UI_Button(string String);
|
|
static ui_signal UI_ButtonF(char *Format, ...);
|
|
|
|
static ui_signal UI_Checkbox(b32 *Checked, string String);
|
|
|
|
static r32 UI_Slider(r32 Value, range1_r32 Range);
|
|
|
|
static void UI_TooltipLabel(string Label, v2 P);
|
|
|
|
#endif //VN_UI_UTILS_H
|