vn/code/generated/vn_generated_ui.cpp

565 lines
14 KiB
C++

inline void UI_PushParent(ui_box * Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.ParentStackUsed + 1 < ArrayCount(UI->Stacks.ParentStack));
UI->Stacks.ParentStack[UI->Stacks.ParentStackUsed++] = Element;
}
inline void UI_PopParent(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.ParentStackUsed > 0);
--UI->Stacks.ParentStackUsed;
}
inline void UI_SetNextParent(ui_box * Element)
{
ui *UI = UI_GetState();
UI_PushParent(Element);
UI->Stacks.AutoPopParent = true;
}
inline ui_box * UI_FirstParent(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.ParentStack[0]);
}
inline ui_box * UI_TopParent(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.ParentStack[UI->Stacks.ParentStackUsed - 1]);
}
#define UI_Parent(Element) DeferLoop(UI_PushParent(Element), UI_PopParent())
inline void UI_PushWidth(ui_size Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.WidthStackUsed + 1 < ArrayCount(UI->Stacks.WidthStack));
UI->Stacks.WidthStack[UI->Stacks.WidthStackUsed++] = Element;
}
inline void UI_PopWidth(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.WidthStackUsed > 0);
--UI->Stacks.WidthStackUsed;
}
inline void UI_SetNextWidth(ui_size Element)
{
ui *UI = UI_GetState();
UI_PushWidth(Element);
UI->Stacks.AutoPopWidth = true;
}
inline ui_size UI_FirstWidth(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.WidthStack[0]);
}
inline ui_size UI_TopWidth(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.WidthStack[UI->Stacks.WidthStackUsed - 1]);
}
#define UI_Width(Element) DeferLoop(UI_PushWidth(Element), UI_PopWidth())
inline void UI_PushHeight(ui_size Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.HeightStackUsed + 1 < ArrayCount(UI->Stacks.HeightStack));
UI->Stacks.HeightStack[UI->Stacks.HeightStackUsed++] = Element;
}
inline void UI_PopHeight(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.HeightStackUsed > 0);
--UI->Stacks.HeightStackUsed;
}
inline void UI_SetNextHeight(ui_size Element)
{
ui *UI = UI_GetState();
UI_PushHeight(Element);
UI->Stacks.AutoPopHeight = true;
}
inline ui_size UI_FirstHeight(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.HeightStack[0]);
}
inline ui_size UI_TopHeight(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.HeightStack[UI->Stacks.HeightStackUsed - 1]);
}
#define UI_Height(Element) DeferLoop(UI_PushHeight(Element), UI_PopHeight())
inline void UI_PushFixedX(r32 Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.FixedXStackUsed + 1 < ArrayCount(UI->Stacks.FixedXStack));
UI->Stacks.FixedXStack[UI->Stacks.FixedXStackUsed++] = Element;
}
inline void UI_PopFixedX(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.FixedXStackUsed > 0);
--UI->Stacks.FixedXStackUsed;
}
inline void UI_SetNextFixedX(r32 Element)
{
ui *UI = UI_GetState();
UI_PushFixedX(Element);
UI->Stacks.AutoPopFixedX = true;
}
inline r32 UI_FirstFixedX(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.FixedXStack[0]);
}
inline r32 UI_TopFixedX(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.FixedXStack[UI->Stacks.FixedXStackUsed - 1]);
}
#define UI_FixedX(Element) DeferLoop(UI_PushFixedX(Element), UI_PopFixedX())
inline void UI_PushFixedY(r32 Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.FixedYStackUsed + 1 < ArrayCount(UI->Stacks.FixedYStack));
UI->Stacks.FixedYStack[UI->Stacks.FixedYStackUsed++] = Element;
}
inline void UI_PopFixedY(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.FixedYStackUsed > 0);
--UI->Stacks.FixedYStackUsed;
}
inline void UI_SetNextFixedY(r32 Element)
{
ui *UI = UI_GetState();
UI_PushFixedY(Element);
UI->Stacks.AutoPopFixedY = true;
}
inline r32 UI_FirstFixedY(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.FixedYStack[0]);
}
inline r32 UI_TopFixedY(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.FixedYStack[UI->Stacks.FixedYStackUsed - 1]);
}
#define UI_FixedY(Element) DeferLoop(UI_PushFixedY(Element), UI_PopFixedY())
inline void UI_PushTextColor(v4 Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.TextColorStackUsed + 1 < ArrayCount(UI->Stacks.TextColorStack));
UI->Stacks.TextColorStack[UI->Stacks.TextColorStackUsed++] = Element;
}
inline void UI_PopTextColor(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.TextColorStackUsed > 0);
--UI->Stacks.TextColorStackUsed;
}
inline void UI_SetNextTextColor(v4 Element)
{
ui *UI = UI_GetState();
UI_PushTextColor(Element);
UI->Stacks.AutoPopTextColor = true;
}
inline v4 UI_FirstTextColor(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.TextColorStack[0]);
}
inline v4 UI_TopTextColor(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.TextColorStack[UI->Stacks.TextColorStackUsed - 1]);
}
#define UI_TextColor(Element) DeferLoop(UI_PushTextColor(Element), UI_PopTextColor())
inline void UI_PushBackgroundColor(v4 Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.BackgroundColorStackUsed + 1 < ArrayCount(UI->Stacks.BackgroundColorStack));
UI->Stacks.BackgroundColorStack[UI->Stacks.BackgroundColorStackUsed++] = Element;
}
inline void UI_PopBackgroundColor(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.BackgroundColorStackUsed > 0);
--UI->Stacks.BackgroundColorStackUsed;
}
inline void UI_SetNextBackgroundColor(v4 Element)
{
ui *UI = UI_GetState();
UI_PushBackgroundColor(Element);
UI->Stacks.AutoPopBackgroundColor = true;
}
inline v4 UI_FirstBackgroundColor(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.BackgroundColorStack[0]);
}
inline v4 UI_TopBackgroundColor(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.BackgroundColorStack[UI->Stacks.BackgroundColorStackUsed - 1]);
}
#define UI_BackgroundColor(Element) DeferLoop(UI_PushBackgroundColor(Element), UI_PopBackgroundColor())
inline void UI_PushBorderColor(v4 Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.BorderColorStackUsed + 1 < ArrayCount(UI->Stacks.BorderColorStack));
UI->Stacks.BorderColorStack[UI->Stacks.BorderColorStackUsed++] = Element;
}
inline void UI_PopBorderColor(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.BorderColorStackUsed > 0);
--UI->Stacks.BorderColorStackUsed;
}
inline void UI_SetNextBorderColor(v4 Element)
{
ui *UI = UI_GetState();
UI_PushBorderColor(Element);
UI->Stacks.AutoPopBorderColor = true;
}
inline v4 UI_FirstBorderColor(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.BorderColorStack[0]);
}
inline v4 UI_TopBorderColor(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.BorderColorStack[UI->Stacks.BorderColorStackUsed - 1]);
}
#define UI_BorderColor(Element) DeferLoop(UI_PushBorderColor(Element), UI_PopBorderColor())
inline void UI_PushBorderThickness(r32 Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.BorderThicknessStackUsed + 1 < ArrayCount(UI->Stacks.BorderThicknessStack));
UI->Stacks.BorderThicknessStack[UI->Stacks.BorderThicknessStackUsed++] = Element;
}
inline void UI_PopBorderThickness(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.BorderThicknessStackUsed > 0);
--UI->Stacks.BorderThicknessStackUsed;
}
inline void UI_SetNextBorderThickness(r32 Element)
{
ui *UI = UI_GetState();
UI_PushBorderThickness(Element);
UI->Stacks.AutoPopBorderThickness = true;
}
inline r32 UI_FirstBorderThickness(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.BorderThicknessStack[0]);
}
inline r32 UI_TopBorderThickness(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.BorderThicknessStack[UI->Stacks.BorderThicknessStackUsed - 1]);
}
#define UI_BorderThickness(Element) DeferLoop(UI_PushBorderThickness(Element), UI_PopBorderThickness())
inline void UI_PushLayoutAxis(axis2 Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.LayoutAxisStackUsed + 1 < ArrayCount(UI->Stacks.LayoutAxisStack));
UI->Stacks.LayoutAxisStack[UI->Stacks.LayoutAxisStackUsed++] = Element;
}
inline void UI_PopLayoutAxis(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.LayoutAxisStackUsed > 0);
--UI->Stacks.LayoutAxisStackUsed;
}
inline void UI_SetNextLayoutAxis(axis2 Element)
{
ui *UI = UI_GetState();
UI_PushLayoutAxis(Element);
UI->Stacks.AutoPopLayoutAxis = true;
}
inline axis2 UI_FirstLayoutAxis(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.LayoutAxisStack[0]);
}
inline axis2 UI_TopLayoutAxis(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.LayoutAxisStack[UI->Stacks.LayoutAxisStackUsed - 1]);
}
#define UI_LayoutAxis(Element) DeferLoop(UI_PushLayoutAxis(Element), UI_PopLayoutAxis())
inline void UI_PushCornerRadius(r32 Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.CornerRadiusStackUsed + 1 < ArrayCount(UI->Stacks.CornerRadiusStack));
UI->Stacks.CornerRadiusStack[UI->Stacks.CornerRadiusStackUsed++] = Element;
}
inline void UI_PopCornerRadius(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.CornerRadiusStackUsed > 0);
--UI->Stacks.CornerRadiusStackUsed;
}
inline void UI_SetNextCornerRadius(r32 Element)
{
ui *UI = UI_GetState();
UI_PushCornerRadius(Element);
UI->Stacks.AutoPopCornerRadius = true;
}
inline r32 UI_FirstCornerRadius(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.CornerRadiusStack[0]);
}
inline r32 UI_TopCornerRadius(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.CornerRadiusStack[UI->Stacks.CornerRadiusStackUsed - 1]);
}
#define UI_CornerRadius(Element) DeferLoop(UI_PushCornerRadius(Element), UI_PopCornerRadius())
inline void UI_PushFont(font_id Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.FontStackUsed + 1 < ArrayCount(UI->Stacks.FontStack));
UI->Stacks.FontStack[UI->Stacks.FontStackUsed++] = Element;
}
inline void UI_PopFont(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.FontStackUsed > 0);
--UI->Stacks.FontStackUsed;
}
inline void UI_SetNextFont(font_id Element)
{
ui *UI = UI_GetState();
UI_PushFont(Element);
UI->Stacks.AutoPopFont = true;
}
inline font_id UI_FirstFont(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.FontStack[0]);
}
inline font_id UI_TopFont(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.FontStack[UI->Stacks.FontStackUsed - 1]);
}
#define UI_Font(Element) DeferLoop(UI_PushFont(Element), UI_PopFont())
inline void UI_PushFontSize(r32 Element)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.FontSizeStackUsed + 1 < ArrayCount(UI->Stacks.FontSizeStack));
UI->Stacks.FontSizeStack[UI->Stacks.FontSizeStackUsed++] = Element;
}
inline void UI_PopFontSize(void)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.FontSizeStackUsed > 0);
--UI->Stacks.FontSizeStackUsed;
}
inline void UI_SetNextFontSize(r32 Element)
{
ui *UI = UI_GetState();
UI_PushFontSize(Element);
UI->Stacks.AutoPopFontSize = true;
}
inline r32 UI_FirstFontSize(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.FontSizeStack[0]);
}
inline r32 UI_TopFontSize(void)
{
ui *UI = UI_GetState();
return(UI->Stacks.FontSizeStack[UI->Stacks.FontSizeStackUsed - 1]);
}
#define UI_FontSize(Element) DeferLoop(UI_PushFontSize(Element), UI_PopFontSize())
inline void UI_ApplyStyles(ui_box *Box)
{
ui *UI = UI_GetState();
Assert(UI->Stacks.ParentStackUsed > 0);
Box->Parent = UI->Stacks.ParentStack[UI->Stacks.ParentStackUsed - 1];
if(UI->Stacks.AutoPopParent)
{
UI_PopParent();
UI->Stacks.AutoPopParent = false;
}
Assert(UI->Stacks.WidthStackUsed > 0);
Box->SemanticSize[Axis2_X] = UI->Stacks.WidthStack[UI->Stacks.WidthStackUsed - 1];
if(UI->Stacks.AutoPopWidth)
{
UI_PopWidth();
UI->Stacks.AutoPopWidth = false;
}
Assert(UI->Stacks.HeightStackUsed > 0);
Box->SemanticSize[Axis2_Y] = UI->Stacks.HeightStack[UI->Stacks.HeightStackUsed - 1];
if(UI->Stacks.AutoPopHeight)
{
UI_PopHeight();
UI->Stacks.AutoPopHeight = false;
}
Assert(UI->Stacks.FixedXStackUsed > 0);
Box->FixedP.E[Axis2_X] = UI->Stacks.FixedXStack[UI->Stacks.FixedXStackUsed - 1];
if(UI->Stacks.AutoPopFixedX)
{
UI_PopFixedX();
UI->Stacks.AutoPopFixedX = false;
}
Assert(UI->Stacks.FixedYStackUsed > 0);
Box->FixedP.E[Axis2_Y] = UI->Stacks.FixedYStack[UI->Stacks.FixedYStackUsed - 1];
if(UI->Stacks.AutoPopFixedY)
{
UI_PopFixedY();
UI->Stacks.AutoPopFixedY = false;
}
Assert(UI->Stacks.TextColorStackUsed > 0);
Box->TextColor = UI->Stacks.TextColorStack[UI->Stacks.TextColorStackUsed - 1];
if(UI->Stacks.AutoPopTextColor)
{
UI_PopTextColor();
UI->Stacks.AutoPopTextColor = false;
}
Assert(UI->Stacks.BackgroundColorStackUsed > 0);
Box->BackgroundColor = UI->Stacks.BackgroundColorStack[UI->Stacks.BackgroundColorStackUsed - 1];
if(UI->Stacks.AutoPopBackgroundColor)
{
UI_PopBackgroundColor();
UI->Stacks.AutoPopBackgroundColor = false;
}
Assert(UI->Stacks.BorderColorStackUsed > 0);
Box->BorderColor = UI->Stacks.BorderColorStack[UI->Stacks.BorderColorStackUsed - 1];
if(UI->Stacks.AutoPopBorderColor)
{
UI_PopBorderColor();
UI->Stacks.AutoPopBorderColor = false;
}
Assert(UI->Stacks.BorderThicknessStackUsed > 0);
Box->BorderThickness = UI->Stacks.BorderThicknessStack[UI->Stacks.BorderThicknessStackUsed - 1];
if(UI->Stacks.AutoPopBorderThickness)
{
UI_PopBorderThickness();
UI->Stacks.AutoPopBorderThickness = false;
}
Assert(UI->Stacks.LayoutAxisStackUsed > 0);
Box->LayoutAxis = UI->Stacks.LayoutAxisStack[UI->Stacks.LayoutAxisStackUsed - 1];
if(UI->Stacks.AutoPopLayoutAxis)
{
UI_PopLayoutAxis();
UI->Stacks.AutoPopLayoutAxis = false;
}
Assert(UI->Stacks.CornerRadiusStackUsed > 0);
Box->CornerRadius = UI->Stacks.CornerRadiusStack[UI->Stacks.CornerRadiusStackUsed - 1];
if(UI->Stacks.AutoPopCornerRadius)
{
UI_PopCornerRadius();
UI->Stacks.AutoPopCornerRadius = false;
}
Assert(UI->Stacks.FontStackUsed > 0);
Box->Font = UI->Stacks.FontStack[UI->Stacks.FontStackUsed - 1];
if(UI->Stacks.AutoPopFont)
{
UI_PopFont();
UI->Stacks.AutoPopFont = false;
}
Assert(UI->Stacks.FontSizeStackUsed > 0);
Box->FontSize = UI->Stacks.FontSizeStack[UI->Stacks.FontSizeStackUsed - 1];
if(UI->Stacks.AutoPopFontSize)
{
UI_PopFontSize();
UI->Stacks.AutoPopFontSize = false;
}
}