mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-05 05:18:40 +00:00
work on tag-based styling
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#define UI_PrefHeight(v) DeferLoop(ui_push_pref_height(v), ui_pop_pref_height())
|
||||
#define UI_PermissionFlags(v) DeferLoop(ui_push_permission_flags(v), ui_pop_permission_flags())
|
||||
#define UI_Flags(v) DeferLoop(ui_push_flags(v), ui_pop_flags())
|
||||
#define UI_OmitFlags(v) DeferLoop(ui_push_omit_flags(v), ui_pop_omit_flags())
|
||||
#define UI_FocusHot(v) DeferLoop(ui_push_focus_hot(v), ui_pop_focus_hot())
|
||||
#define UI_FocusActive(v) DeferLoop(ui_push_focus_active(v), ui_pop_focus_active())
|
||||
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
|
||||
@@ -45,13 +46,13 @@ internal UI_Size ui_top_pref_width(void) { UI_StackTopImpl(ui_state, PrefWidth,
|
||||
internal UI_Size ui_top_pref_height(void) { UI_StackTopImpl(ui_state, PrefHeight, pref_height) }
|
||||
internal UI_PermissionFlags ui_top_permission_flags(void) { UI_StackTopImpl(ui_state, PermissionFlags, permission_flags) }
|
||||
internal UI_BoxFlags ui_top_flags(void) { UI_StackTopImpl(ui_state, Flags, flags) }
|
||||
internal UI_BoxFlags ui_top_omit_flags(void) { UI_StackTopImpl(ui_state, OmitFlags, omit_flags) }
|
||||
internal UI_FocusKind ui_top_focus_hot(void) { UI_StackTopImpl(ui_state, FocusHot, focus_hot) }
|
||||
internal UI_FocusKind ui_top_focus_active(void) { UI_StackTopImpl(ui_state, FocusActive, focus_active) }
|
||||
internal U32 ui_top_fastpath_codepoint(void) { UI_StackTopImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
internal UI_Key ui_top_group_key(void) { UI_StackTopImpl(ui_state, GroupKey, group_key) }
|
||||
internal F32 ui_top_transparency(void) { UI_StackTopImpl(ui_state, Transparency, transparency) }
|
||||
internal UI_Palette* ui_top_palette(void) { UI_StackTopImpl(ui_state, Palette, palette) }
|
||||
internal String8 ui_top_tag(void) { UI_StackTopImpl(ui_state, Tag, tag) }
|
||||
internal F32 ui_top_squish(void) { UI_StackTopImpl(ui_state, Squish, squish) }
|
||||
internal OS_Cursor ui_top_hover_cursor(void) { UI_StackTopImpl(ui_state, HoverCursor, hover_cursor) }
|
||||
internal FNT_Tag ui_top_font(void) { UI_StackTopImpl(ui_state, Font, font) }
|
||||
@@ -75,13 +76,13 @@ internal UI_Size ui_bottom_pref_width(void) { UI_StackBottomImpl(ui_state, PrefW
|
||||
internal UI_Size ui_bottom_pref_height(void) { UI_StackBottomImpl(ui_state, PrefHeight, pref_height) }
|
||||
internal UI_PermissionFlags ui_bottom_permission_flags(void) { UI_StackBottomImpl(ui_state, PermissionFlags, permission_flags) }
|
||||
internal UI_BoxFlags ui_bottom_flags(void) { UI_StackBottomImpl(ui_state, Flags, flags) }
|
||||
internal UI_BoxFlags ui_bottom_omit_flags(void) { UI_StackBottomImpl(ui_state, OmitFlags, omit_flags) }
|
||||
internal UI_FocusKind ui_bottom_focus_hot(void) { UI_StackBottomImpl(ui_state, FocusHot, focus_hot) }
|
||||
internal UI_FocusKind ui_bottom_focus_active(void) { UI_StackBottomImpl(ui_state, FocusActive, focus_active) }
|
||||
internal U32 ui_bottom_fastpath_codepoint(void) { UI_StackBottomImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
internal UI_Key ui_bottom_group_key(void) { UI_StackBottomImpl(ui_state, GroupKey, group_key) }
|
||||
internal F32 ui_bottom_transparency(void) { UI_StackBottomImpl(ui_state, Transparency, transparency) }
|
||||
internal UI_Palette* ui_bottom_palette(void) { UI_StackBottomImpl(ui_state, Palette, palette) }
|
||||
internal String8 ui_bottom_tag(void) { UI_StackBottomImpl(ui_state, Tag, tag) }
|
||||
internal F32 ui_bottom_squish(void) { UI_StackBottomImpl(ui_state, Squish, squish) }
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void) { UI_StackBottomImpl(ui_state, HoverCursor, hover_cursor) }
|
||||
internal FNT_Tag ui_bottom_font(void) { UI_StackBottomImpl(ui_state, Font, font) }
|
||||
@@ -105,13 +106,13 @@ internal UI_Size ui_push_pref_width(UI_Size v) { UI_StackPushImpl(ui_state, Pref
|
||||
internal UI_Size ui_push_pref_height(UI_Size v) { UI_StackPushImpl(ui_state, PrefHeight, pref_height, UI_Size, v) }
|
||||
internal UI_PermissionFlags ui_push_permission_flags(UI_PermissionFlags v) { UI_StackPushImpl(ui_state, PermissionFlags, permission_flags, UI_PermissionFlags, v) }
|
||||
internal UI_BoxFlags ui_push_flags(UI_BoxFlags v) { UI_StackPushImpl(ui_state, Flags, flags, UI_BoxFlags, v) }
|
||||
internal UI_BoxFlags ui_push_omit_flags(UI_BoxFlags v) { UI_StackPushImpl(ui_state, OmitFlags, omit_flags, UI_BoxFlags, v) }
|
||||
internal UI_FocusKind ui_push_focus_hot(UI_FocusKind v) { UI_StackPushImpl(ui_state, FocusHot, focus_hot, UI_FocusKind, v) }
|
||||
internal UI_FocusKind ui_push_focus_active(UI_FocusKind v) { UI_StackPushImpl(ui_state, FocusActive, focus_active, UI_FocusKind, v) }
|
||||
internal U32 ui_push_fastpath_codepoint(U32 v) { UI_StackPushImpl(ui_state, FastpathCodepoint, fastpath_codepoint, U32, v) }
|
||||
internal UI_Key ui_push_group_key(UI_Key v) { UI_StackPushImpl(ui_state, GroupKey, group_key, UI_Key, v) }
|
||||
internal F32 ui_push_transparency(F32 v) { UI_StackPushImpl(ui_state, Transparency, transparency, F32, v) }
|
||||
internal UI_Palette* ui_push_palette(UI_Palette* v) { UI_StackPushImpl(ui_state, Palette, palette, UI_Palette* , v) }
|
||||
internal String8 ui_push_tag(String8 v) { UI_StackPushImpl(ui_state, Tag, tag, String8, v) }
|
||||
internal F32 ui_push_squish(F32 v) { UI_StackPushImpl(ui_state, Squish, squish, F32, v) }
|
||||
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v) { UI_StackPushImpl(ui_state, HoverCursor, hover_cursor, OS_Cursor, v) }
|
||||
internal FNT_Tag ui_push_font(FNT_Tag v) { UI_StackPushImpl(ui_state, Font, font, FNT_Tag, v) }
|
||||
@@ -135,13 +136,13 @@ internal UI_Size ui_pop_pref_width(void) { UI_StackPopImpl(ui_state, PrefWidth,
|
||||
internal UI_Size ui_pop_pref_height(void) { UI_StackPopImpl(ui_state, PrefHeight, pref_height) }
|
||||
internal UI_PermissionFlags ui_pop_permission_flags(void) { UI_StackPopImpl(ui_state, PermissionFlags, permission_flags) }
|
||||
internal UI_BoxFlags ui_pop_flags(void) { UI_StackPopImpl(ui_state, Flags, flags) }
|
||||
internal UI_BoxFlags ui_pop_omit_flags(void) { UI_StackPopImpl(ui_state, OmitFlags, omit_flags) }
|
||||
internal UI_FocusKind ui_pop_focus_hot(void) { UI_StackPopImpl(ui_state, FocusHot, focus_hot) }
|
||||
internal UI_FocusKind ui_pop_focus_active(void) { UI_StackPopImpl(ui_state, FocusActive, focus_active) }
|
||||
internal U32 ui_pop_fastpath_codepoint(void) { UI_StackPopImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
internal UI_Key ui_pop_group_key(void) { UI_StackPopImpl(ui_state, GroupKey, group_key) }
|
||||
internal F32 ui_pop_transparency(void) { UI_StackPopImpl(ui_state, Transparency, transparency) }
|
||||
internal UI_Palette* ui_pop_palette(void) { UI_StackPopImpl(ui_state, Palette, palette) }
|
||||
internal String8 ui_pop_tag(void) { UI_StackPopImpl(ui_state, Tag, tag) }
|
||||
internal F32 ui_pop_squish(void) { UI_StackPopImpl(ui_state, Squish, squish) }
|
||||
internal OS_Cursor ui_pop_hover_cursor(void) { UI_StackPopImpl(ui_state, HoverCursor, hover_cursor) }
|
||||
internal FNT_Tag ui_pop_font(void) { UI_StackPopImpl(ui_state, Font, font) }
|
||||
@@ -165,13 +166,13 @@ internal UI_Size ui_set_next_pref_width(UI_Size v) { UI_StackSetNextImpl(ui_stat
|
||||
internal UI_Size ui_set_next_pref_height(UI_Size v) { UI_StackSetNextImpl(ui_state, PrefHeight, pref_height, UI_Size, v) }
|
||||
internal UI_PermissionFlags ui_set_next_permission_flags(UI_PermissionFlags v) { UI_StackSetNextImpl(ui_state, PermissionFlags, permission_flags, UI_PermissionFlags, v) }
|
||||
internal UI_BoxFlags ui_set_next_flags(UI_BoxFlags v) { UI_StackSetNextImpl(ui_state, Flags, flags, UI_BoxFlags, v) }
|
||||
internal UI_BoxFlags ui_set_next_omit_flags(UI_BoxFlags v) { UI_StackSetNextImpl(ui_state, OmitFlags, omit_flags, UI_BoxFlags, v) }
|
||||
internal UI_FocusKind ui_set_next_focus_hot(UI_FocusKind v) { UI_StackSetNextImpl(ui_state, FocusHot, focus_hot, UI_FocusKind, v) }
|
||||
internal UI_FocusKind ui_set_next_focus_active(UI_FocusKind v) { UI_StackSetNextImpl(ui_state, FocusActive, focus_active, UI_FocusKind, v) }
|
||||
internal U32 ui_set_next_fastpath_codepoint(U32 v) { UI_StackSetNextImpl(ui_state, FastpathCodepoint, fastpath_codepoint, U32, v) }
|
||||
internal UI_Key ui_set_next_group_key(UI_Key v) { UI_StackSetNextImpl(ui_state, GroupKey, group_key, UI_Key, v) }
|
||||
internal F32 ui_set_next_transparency(F32 v) { UI_StackSetNextImpl(ui_state, Transparency, transparency, F32, v) }
|
||||
internal UI_Palette* ui_set_next_palette(UI_Palette* v) { UI_StackSetNextImpl(ui_state, Palette, palette, UI_Palette* , v) }
|
||||
internal String8 ui_set_next_tag(String8 v) { UI_StackSetNextImpl(ui_state, Tag, tag, String8, v) }
|
||||
internal F32 ui_set_next_squish(F32 v) { UI_StackSetNextImpl(ui_state, Squish, squish, F32, v) }
|
||||
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v) { UI_StackSetNextImpl(ui_state, HoverCursor, hover_cursor, OS_Cursor, v) }
|
||||
internal FNT_Tag ui_set_next_font(FNT_Tag v) { UI_StackSetNextImpl(ui_state, Font, font, FNT_Tag, v) }
|
||||
|
||||
@@ -16,6 +16,7 @@ typedef struct UI_PrefWidthNode UI_PrefWidthNode; struct UI_PrefWidthNode{UI_Pre
|
||||
typedef struct UI_PrefHeightNode UI_PrefHeightNode; struct UI_PrefHeightNode{UI_PrefHeightNode *next; UI_Size v;};
|
||||
typedef struct UI_PermissionFlagsNode UI_PermissionFlagsNode; struct UI_PermissionFlagsNode{UI_PermissionFlagsNode *next; UI_PermissionFlags v;};
|
||||
typedef struct UI_FlagsNode UI_FlagsNode; struct UI_FlagsNode{UI_FlagsNode *next; UI_BoxFlags v;};
|
||||
typedef struct UI_OmitFlagsNode UI_OmitFlagsNode; struct UI_OmitFlagsNode{UI_OmitFlagsNode *next; UI_BoxFlags v;};
|
||||
typedef struct UI_FocusHotNode UI_FocusHotNode; struct UI_FocusHotNode{UI_FocusHotNode *next; UI_FocusKind v;};
|
||||
typedef struct UI_FocusActiveNode UI_FocusActiveNode; struct UI_FocusActiveNode{UI_FocusActiveNode *next; UI_FocusKind v;};
|
||||
typedef struct UI_FastpathCodepointNode UI_FastpathCodepointNode; struct UI_FastpathCodepointNode{UI_FastpathCodepointNode *next; U32 v;};
|
||||
@@ -49,6 +50,7 @@ UI_PrefWidthNode pref_width_nil_stack_top;\
|
||||
UI_PrefHeightNode pref_height_nil_stack_top;\
|
||||
UI_PermissionFlagsNode permission_flags_nil_stack_top;\
|
||||
UI_FlagsNode flags_nil_stack_top;\
|
||||
UI_OmitFlagsNode omit_flags_nil_stack_top;\
|
||||
UI_FocusHotNode focus_hot_nil_stack_top;\
|
||||
UI_FocusActiveNode focus_active_nil_stack_top;\
|
||||
UI_FastpathCodepointNode fastpath_codepoint_nil_stack_top;\
|
||||
@@ -81,6 +83,7 @@ state->pref_width_nil_stack_top.v = ui_px(250.f, 1.f);\
|
||||
state->pref_height_nil_stack_top.v = ui_px(30.f, 1.f);\
|
||||
state->permission_flags_nil_stack_top.v = UI_PermissionFlag_All;\
|
||||
state->flags_nil_stack_top.v = 0;\
|
||||
state->omit_flags_nil_stack_top.v = 0;\
|
||||
state->focus_hot_nil_stack_top.v = UI_FocusKind_Null;\
|
||||
state->focus_active_nil_stack_top.v = UI_FocusKind_Null;\
|
||||
state->fastpath_codepoint_nil_stack_top.v = 0;\
|
||||
@@ -115,6 +118,7 @@ struct { UI_PrefWidthNode *top; UI_Size bottom_val; UI_PrefWidthNode *free; U64
|
||||
struct { UI_PrefHeightNode *top; UI_Size bottom_val; UI_PrefHeightNode *free; U64 gen; B32 auto_pop; } pref_height_stack;\
|
||||
struct { UI_PermissionFlagsNode *top; UI_PermissionFlags bottom_val; UI_PermissionFlagsNode *free; U64 gen; B32 auto_pop; } permission_flags_stack;\
|
||||
struct { UI_FlagsNode *top; UI_BoxFlags bottom_val; UI_FlagsNode *free; U64 gen; B32 auto_pop; } flags_stack;\
|
||||
struct { UI_OmitFlagsNode *top; UI_BoxFlags bottom_val; UI_OmitFlagsNode *free; U64 gen; B32 auto_pop; } omit_flags_stack;\
|
||||
struct { UI_FocusHotNode *top; UI_FocusKind bottom_val; UI_FocusHotNode *free; U64 gen; B32 auto_pop; } focus_hot_stack;\
|
||||
struct { UI_FocusActiveNode *top; UI_FocusKind bottom_val; UI_FocusActiveNode *free; U64 gen; B32 auto_pop; } focus_active_stack;\
|
||||
struct { UI_FastpathCodepointNode *top; U32 bottom_val; UI_FastpathCodepointNode *free; U64 gen; B32 auto_pop; } fastpath_codepoint_stack;\
|
||||
@@ -147,6 +151,7 @@ state->pref_width_stack.top = &state->pref_width_nil_stack_top; state->pref_widt
|
||||
state->pref_height_stack.top = &state->pref_height_nil_stack_top; state->pref_height_stack.bottom_val = ui_px(30.f, 1.f); state->pref_height_stack.free = 0; state->pref_height_stack.auto_pop = 0;\
|
||||
state->permission_flags_stack.top = &state->permission_flags_nil_stack_top; state->permission_flags_stack.bottom_val = UI_PermissionFlag_All; state->permission_flags_stack.free = 0; state->permission_flags_stack.auto_pop = 0;\
|
||||
state->flags_stack.top = &state->flags_nil_stack_top; state->flags_stack.bottom_val = 0; state->flags_stack.free = 0; state->flags_stack.auto_pop = 0;\
|
||||
state->omit_flags_stack.top = &state->omit_flags_nil_stack_top; state->omit_flags_stack.bottom_val = 0; state->omit_flags_stack.free = 0; state->omit_flags_stack.auto_pop = 0;\
|
||||
state->focus_hot_stack.top = &state->focus_hot_nil_stack_top; state->focus_hot_stack.bottom_val = UI_FocusKind_Null; state->focus_hot_stack.free = 0; state->focus_hot_stack.auto_pop = 0;\
|
||||
state->focus_active_stack.top = &state->focus_active_nil_stack_top; state->focus_active_stack.bottom_val = UI_FocusKind_Null; state->focus_active_stack.free = 0; state->focus_active_stack.auto_pop = 0;\
|
||||
state->fastpath_codepoint_stack.top = &state->fastpath_codepoint_nil_stack_top; state->fastpath_codepoint_stack.bottom_val = 0; state->fastpath_codepoint_stack.free = 0; state->fastpath_codepoint_stack.auto_pop = 0;\
|
||||
@@ -179,6 +184,7 @@ if(state->pref_width_stack.auto_pop) { ui_pop_pref_width(); state->pref_width_st
|
||||
if(state->pref_height_stack.auto_pop) { ui_pop_pref_height(); state->pref_height_stack.auto_pop = 0; }\
|
||||
if(state->permission_flags_stack.auto_pop) { ui_pop_permission_flags(); state->permission_flags_stack.auto_pop = 0; }\
|
||||
if(state->flags_stack.auto_pop) { ui_pop_flags(); state->flags_stack.auto_pop = 0; }\
|
||||
if(state->omit_flags_stack.auto_pop) { ui_pop_omit_flags(); state->omit_flags_stack.auto_pop = 0; }\
|
||||
if(state->focus_hot_stack.auto_pop) { ui_pop_focus_hot(); state->focus_hot_stack.auto_pop = 0; }\
|
||||
if(state->focus_active_stack.auto_pop) { ui_pop_focus_active(); state->focus_active_stack.auto_pop = 0; }\
|
||||
if(state->fastpath_codepoint_stack.auto_pop) { ui_pop_fastpath_codepoint(); state->fastpath_codepoint_stack.auto_pop = 0; }\
|
||||
@@ -210,6 +216,7 @@ internal UI_Size ui_top_pref_width(void);
|
||||
internal UI_Size ui_top_pref_height(void);
|
||||
internal UI_PermissionFlags ui_top_permission_flags(void);
|
||||
internal UI_BoxFlags ui_top_flags(void);
|
||||
internal UI_BoxFlags ui_top_omit_flags(void);
|
||||
internal UI_FocusKind ui_top_focus_hot(void);
|
||||
internal UI_FocusKind ui_top_focus_active(void);
|
||||
internal U32 ui_top_fastpath_codepoint(void);
|
||||
@@ -240,6 +247,7 @@ internal UI_Size ui_bottom_pref_width(void);
|
||||
internal UI_Size ui_bottom_pref_height(void);
|
||||
internal UI_PermissionFlags ui_bottom_permission_flags(void);
|
||||
internal UI_BoxFlags ui_bottom_flags(void);
|
||||
internal UI_BoxFlags ui_bottom_omit_flags(void);
|
||||
internal UI_FocusKind ui_bottom_focus_hot(void);
|
||||
internal UI_FocusKind ui_bottom_focus_active(void);
|
||||
internal U32 ui_bottom_fastpath_codepoint(void);
|
||||
@@ -270,6 +278,7 @@ internal UI_Size ui_push_pref_width(UI_Size v);
|
||||
internal UI_Size ui_push_pref_height(UI_Size v);
|
||||
internal UI_PermissionFlags ui_push_permission_flags(UI_PermissionFlags v);
|
||||
internal UI_BoxFlags ui_push_flags(UI_BoxFlags v);
|
||||
internal UI_BoxFlags ui_push_omit_flags(UI_BoxFlags v);
|
||||
internal UI_FocusKind ui_push_focus_hot(UI_FocusKind v);
|
||||
internal UI_FocusKind ui_push_focus_active(UI_FocusKind v);
|
||||
internal U32 ui_push_fastpath_codepoint(U32 v);
|
||||
@@ -300,6 +309,7 @@ internal UI_Size ui_pop_pref_width(void);
|
||||
internal UI_Size ui_pop_pref_height(void);
|
||||
internal UI_PermissionFlags ui_pop_permission_flags(void);
|
||||
internal UI_BoxFlags ui_pop_flags(void);
|
||||
internal UI_BoxFlags ui_pop_omit_flags(void);
|
||||
internal UI_FocusKind ui_pop_focus_hot(void);
|
||||
internal UI_FocusKind ui_pop_focus_active(void);
|
||||
internal U32 ui_pop_fastpath_codepoint(void);
|
||||
@@ -330,6 +340,7 @@ internal UI_Size ui_set_next_pref_width(UI_Size v);
|
||||
internal UI_Size ui_set_next_pref_height(UI_Size v);
|
||||
internal UI_PermissionFlags ui_set_next_permission_flags(UI_PermissionFlags v);
|
||||
internal UI_BoxFlags ui_set_next_flags(UI_BoxFlags v);
|
||||
internal UI_BoxFlags ui_set_next_omit_flags(UI_BoxFlags v);
|
||||
internal UI_FocusKind ui_set_next_focus_hot(UI_FocusKind v);
|
||||
internal UI_FocusKind ui_set_next_focus_active(UI_FocusKind v);
|
||||
internal U32 ui_set_next_fastpath_codepoint(U32 v);
|
||||
|
||||
+9
-8
@@ -3,11 +3,11 @@
|
||||
|
||||
//- rjf: stack table
|
||||
|
||||
@table(name, name_lower, type, default)
|
||||
@table(name, name_lower, type, default, manual_impl)
|
||||
UI_StackTable:
|
||||
{
|
||||
//- rjf: parents
|
||||
{ Parent parent `UI_Box *` `&ui_nil_box` }
|
||||
{ Parent parent `UI_Box *` `&ui_nil_box` }
|
||||
|
||||
//- rjf: layout params
|
||||
{ ChildLayoutAxis child_layout_axis Axis2 `Axis2_X` }
|
||||
@@ -23,6 +23,7 @@ UI_StackTable:
|
||||
//- rjf: flags
|
||||
{ PermissionFlags permission_flags UI_PermissionFlags UI_PermissionFlag_All }
|
||||
{ Flags flags UI_BoxFlags 0 }
|
||||
{ OmitFlags omit_flags UI_BoxFlags 0 }
|
||||
|
||||
//- rjf: interaction
|
||||
{ FocusHot focus_hot UI_FocusKind UI_FocusKind_Null }
|
||||
@@ -33,7 +34,7 @@ UI_StackTable:
|
||||
//- rjf: colors
|
||||
{ Transparency transparency F32 0 }
|
||||
{ Palette palette `UI_Palette* ` `&ui_g_nil_palette` }
|
||||
{ Tag tag String8 `str8_lit("")` }
|
||||
{ Tag tag String8 `str8_lit("")` 1 }
|
||||
|
||||
//- rjf: squish
|
||||
{ Squish squish F32 0 }
|
||||
@@ -149,13 +150,13 @@ UI_StackTable:
|
||||
@gen @c_file
|
||||
{
|
||||
@expand(UI_StackTable a)
|
||||
`internal $(a.type) ui_top_$(a.name_lower)(void) { UI_StackTopImpl(ui_state, $(a.name), $(a.name_lower)) }`;
|
||||
`$(a.manual_impl == "" -> "internal " .. a.type .. " ui_top_" .. a.name_lower .. "(void) { UI_StackTopImpl(ui_state, " .. a.name .. ", " .. a.name_lower .. ") }")`;
|
||||
@expand(UI_StackTable a)
|
||||
`internal $(a.type) ui_bottom_$(a.name_lower)(void) { UI_StackBottomImpl(ui_state, $(a.name), $(a.name_lower)) }`;
|
||||
`$(a.manual_impl == "" -> "internal " .. a.type .. " ui_bottom_" .. a.name_lower .. "(void) { UI_StackBottomImpl(ui_state, " .. a.name .. ", " .. a.name_lower .. ") }")`;
|
||||
@expand(UI_StackTable a)
|
||||
`internal $(a.type) ui_push_$(a.name_lower)($(a.type) v) { UI_StackPushImpl(ui_state, $(a.name), $(a.name_lower), $(a.type), v) }`;
|
||||
`$(a.manual_impl == "" -> "internal " .. a.type .. " ui_push_" .. a.name_lower .. "(" .. a.type .. " v) { UI_StackPushImpl(ui_state, " .. a.name .. ", " .. a.name_lower .. ", " .. a.type .. ", v) }")`;
|
||||
@expand(UI_StackTable a)
|
||||
`internal $(a.type) ui_pop_$(a.name_lower)(void) { UI_StackPopImpl(ui_state, $(a.name), $(a.name_lower)) }`;
|
||||
`$(a.manual_impl == "" -> "internal " .. a.type .. " ui_pop_" .. a.name_lower .. "(void) { UI_StackPopImpl(ui_state, " .. a.name .. ", " .. a.name_lower .. ") }")`;
|
||||
@expand(UI_StackTable a)
|
||||
`internal $(a.type) ui_set_next_$(a.name_lower)($(a.type) v) { UI_StackSetNextImpl(ui_state, $(a.name), $(a.name_lower), $(a.type), v) }`;
|
||||
`$(a.manual_impl == "" -> "internal " .. a.type .. " ui_set_next_" .. a.name_lower .. "(" .. a.type .. " v) { UI_StackSetNextImpl(ui_state, " .. a.name .. ", " .. a.name_lower .. ", " .. a.type .. ", v) }")`;
|
||||
}
|
||||
|
||||
+76
-45
@@ -1918,11 +1918,13 @@ ui_tooltip_begin_base(void)
|
||||
ui_push_flags(0);
|
||||
ui_push_text_raster_flags(ui_bottom_text_raster_flags());
|
||||
ui_push_palette(ui_bottom_palette());
|
||||
ui_push_tag(str8_lit("."));
|
||||
}
|
||||
|
||||
internal void
|
||||
ui_tooltip_end_base(void)
|
||||
{
|
||||
ui_pop_tag();
|
||||
ui_pop_palette();
|
||||
ui_pop_text_raster_flags();
|
||||
ui_pop_flags();
|
||||
@@ -2005,6 +2007,7 @@ ui_begin_ctx_menu(UI_Key key)
|
||||
ui_push_focus_hot(UI_FocusKind_Root);
|
||||
ui_push_focus_active(UI_FocusKind_Root);
|
||||
ui_push_palette(ui_state->widget_palette_info.ctx_menu_palette);
|
||||
ui_push_tag(str8_lit("."));
|
||||
B32 is_open = ui_key_match(key, ui_state->ctx_menu_key) && ui_state->ctx_menu_open;
|
||||
if(is_open != 0)
|
||||
{
|
||||
@@ -2033,6 +2036,7 @@ ui_end_ctx_menu(void)
|
||||
ui_state->is_in_open_ctx_menu = 0;
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
}
|
||||
ui_pop_tag();
|
||||
ui_pop_palette();
|
||||
ui_pop_focus_active();
|
||||
ui_pop_focus_hot();
|
||||
@@ -2262,7 +2266,7 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
//- rjf: fill box
|
||||
{
|
||||
box->key = key;
|
||||
box->flags = flags|ui_state->flags_stack.top->v;
|
||||
box->flags = (flags | ui_state->flags_stack.top->v) & ~ui_state->omit_flags_stack.top->v;
|
||||
box->fastpath_codepoint = ui_state->fastpath_codepoint_stack.top->v;
|
||||
box->group_key = ui_state->group_key_stack.top->v;
|
||||
|
||||
@@ -2357,7 +2361,14 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
String8List tags = {0};
|
||||
for(UI_TagNode *n = ui_state->tag_stack.top; n != 0; n = n->next)
|
||||
{
|
||||
str8_list_push(ui_build_arena(), &tags, push_str8_copy(ui_build_arena(), n->v));
|
||||
if(n->v.size == 1 && n->v.str[0] == '.')
|
||||
{
|
||||
break;
|
||||
}
|
||||
if(n->v.size != 0)
|
||||
{
|
||||
str8_list_push(ui_build_arena(), &tags, push_str8_copy(ui_build_arena(), n->v));
|
||||
}
|
||||
}
|
||||
ui_state->current_gen_tags = str8_array_from_list(ui_build_arena(), &tags);
|
||||
scratch_end(scratch);
|
||||
@@ -3054,6 +3065,57 @@ ui_anim_(UI_Key key, UI_AnimParams *params)
|
||||
////////////////////////////////
|
||||
//~ rjf: Stacks
|
||||
|
||||
#define UI_StackTopImpl(state, name_upper, name_lower) \
|
||||
return state->name_lower##_stack.top->v;
|
||||
|
||||
#define UI_StackBottomImpl(state, name_upper, name_lower) \
|
||||
return state->name_lower##_stack.bottom_val;
|
||||
|
||||
#define UI_StackPushImpl(state, name_upper, name_lower, type, new_value) \
|
||||
UI_##name_upper##Node *node = state->name_lower##_stack.free;\
|
||||
if(node != 0) {SLLStackPop(state->name_lower##_stack.free);}\
|
||||
else {node = push_array(ui_build_arena(), UI_##name_upper##Node, 1);}\
|
||||
type old_value = state->name_lower##_stack.top->v;\
|
||||
node->v = new_value;\
|
||||
SLLStackPush(state->name_lower##_stack.top, node);\
|
||||
if(node->next == &state->name_lower##_nil_stack_top)\
|
||||
{\
|
||||
state->name_lower##_stack.bottom_val = (new_value);\
|
||||
}\
|
||||
state->name_lower##_stack.auto_pop = 0;\
|
||||
state->name_lower##_stack.gen += 1;\
|
||||
return old_value;
|
||||
|
||||
#define UI_StackPopImpl(state, name_upper, name_lower) \
|
||||
UI_##name_upper##Node *popped = state->name_lower##_stack.top;\
|
||||
if(popped != &state->name_lower##_nil_stack_top)\
|
||||
{\
|
||||
SLLStackPop(state->name_lower##_stack.top);\
|
||||
SLLStackPush(state->name_lower##_stack.free, popped);\
|
||||
state->name_lower##_stack.auto_pop = 0;\
|
||||
state->name_lower##_stack.gen += 1;\
|
||||
}\
|
||||
return popped->v;\
|
||||
|
||||
#define UI_StackSetNextImpl(state, name_upper, name_lower, type, new_value) \
|
||||
UI_##name_upper##Node *node = state->name_lower##_stack.free;\
|
||||
if(node != 0) {SLLStackPop(state->name_lower##_stack.free);}\
|
||||
else {node = push_array(ui_build_arena(), UI_##name_upper##Node, 1);}\
|
||||
type old_value = state->name_lower##_stack.top->v;\
|
||||
node->v = new_value;\
|
||||
SLLStackPush(state->name_lower##_stack.top, node);\
|
||||
state->name_lower##_stack.auto_pop = 1;\
|
||||
state->name_lower##_stack.gen += 1;\
|
||||
return old_value;
|
||||
|
||||
//- rjf: manual implementations
|
||||
|
||||
internal String8 ui_top_tag(void) { UI_StackTopImpl(ui_state, Tag, tag) }
|
||||
internal String8 ui_bottom_tag(void) { UI_StackBottomImpl(ui_state, Tag, tag) }
|
||||
internal String8 ui_push_tag(String8 v) { UI_StackPushImpl(ui_state, Tag, tag, String8, push_str8_copy(ui_build_arena(), v)) }
|
||||
internal String8 ui_pop_tag(void) { UI_StackPopImpl(ui_state, Tag, tag) }
|
||||
internal String8 ui_set_next_tag(String8 v) { UI_StackSetNextImpl(ui_state, Tag, tag, String8, push_str8_copy(ui_build_arena(), v)) }
|
||||
|
||||
//- rjf: helpers
|
||||
|
||||
internal Rng2F32
|
||||
@@ -3139,50 +3201,19 @@ ui_pop_corner_radius(void)
|
||||
ui_pop_corner_radius_11();
|
||||
}
|
||||
|
||||
internal void
|
||||
ui_push_tagf(char *fmt, ...)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
String8 string = push_str8fv(scratch.arena, fmt, args);
|
||||
ui_push_tag(string);
|
||||
va_end(args);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Generated Code
|
||||
|
||||
#define UI_StackTopImpl(state, name_upper, name_lower) \
|
||||
return state->name_lower##_stack.top->v;
|
||||
|
||||
#define UI_StackBottomImpl(state, name_upper, name_lower) \
|
||||
return state->name_lower##_stack.bottom_val;
|
||||
|
||||
#define UI_StackPushImpl(state, name_upper, name_lower, type, new_value) \
|
||||
UI_##name_upper##Node *node = state->name_lower##_stack.free;\
|
||||
if(node != 0) {SLLStackPop(state->name_lower##_stack.free);}\
|
||||
else {node = push_array(ui_build_arena(), UI_##name_upper##Node, 1);}\
|
||||
type old_value = state->name_lower##_stack.top->v;\
|
||||
node->v = new_value;\
|
||||
SLLStackPush(state->name_lower##_stack.top, node);\
|
||||
if(node->next == &state->name_lower##_nil_stack_top)\
|
||||
{\
|
||||
state->name_lower##_stack.bottom_val = (new_value);\
|
||||
}\
|
||||
state->name_lower##_stack.auto_pop = 0;\
|
||||
state->name_lower##_stack.gen += 1;\
|
||||
return old_value;
|
||||
|
||||
#define UI_StackPopImpl(state, name_upper, name_lower) \
|
||||
UI_##name_upper##Node *popped = state->name_lower##_stack.top;\
|
||||
if(popped != &state->name_lower##_nil_stack_top)\
|
||||
{\
|
||||
SLLStackPop(state->name_lower##_stack.top);\
|
||||
SLLStackPush(state->name_lower##_stack.free, popped);\
|
||||
state->name_lower##_stack.auto_pop = 0;\
|
||||
state->name_lower##_stack.gen += 1;\
|
||||
}\
|
||||
return popped->v;\
|
||||
|
||||
#define UI_StackSetNextImpl(state, name_upper, name_lower, type, new_value) \
|
||||
UI_##name_upper##Node *node = state->name_lower##_stack.free;\
|
||||
if(node != 0) {SLLStackPop(state->name_lower##_stack.free);}\
|
||||
else {node = push_array(ui_build_arena(), UI_##name_upper##Node, 1);}\
|
||||
type old_value = state->name_lower##_stack.top->v;\
|
||||
node->v = new_value;\
|
||||
SLLStackPush(state->name_lower##_stack.top, node);\
|
||||
state->name_lower##_stack.auto_pop = 1;\
|
||||
state->name_lower##_stack.gen += 1;\
|
||||
return old_value;
|
||||
|
||||
#include "generated/ui.meta.c"
|
||||
|
||||
@@ -948,6 +948,7 @@ internal U32 ui_top_fastpath_codepoint(void);
|
||||
internal UI_Key ui_top_group_key(void);
|
||||
internal F32 ui_top_transparency(void);
|
||||
internal UI_Palette* ui_top_palette(void);
|
||||
internal String8 ui_top_tag(void);
|
||||
internal F32 ui_top_squish(void);
|
||||
internal OS_Cursor ui_top_hover_cursor(void);
|
||||
internal FNT_Tag ui_top_font(void);
|
||||
@@ -977,6 +978,7 @@ internal U32 ui_bottom_fastpath_codepoint(void);
|
||||
internal UI_Key ui_bottom_group_key(void);
|
||||
internal F32 ui_bottom_transparency(void);
|
||||
internal UI_Palette* ui_bottom_palette(void);
|
||||
internal String8 ui_bottom_tag(void);
|
||||
internal F32 ui_bottom_squish(void);
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void);
|
||||
internal FNT_Tag ui_bottom_font(void);
|
||||
@@ -1006,6 +1008,7 @@ internal U32 ui_push_fastpath_codepoint(U32 v);
|
||||
internal UI_Key ui_push_group_key(UI_Key v);
|
||||
internal F32 ui_push_transparency(F32 v);
|
||||
internal UI_Palette* ui_push_palette(UI_Palette* v);
|
||||
internal String8 ui_push_tag(String8 v);
|
||||
internal F32 ui_push_squish(F32 v);
|
||||
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v);
|
||||
internal FNT_Tag ui_push_font(FNT_Tag v);
|
||||
@@ -1035,6 +1038,7 @@ internal U32 ui_pop_fastpath_codepoint(void);
|
||||
internal UI_Key ui_pop_group_key(void);
|
||||
internal F32 ui_pop_transparency(void);
|
||||
internal UI_Palette* ui_pop_palette(void);
|
||||
internal String8 ui_pop_tag(void);
|
||||
internal F32 ui_pop_squish(void);
|
||||
internal OS_Cursor ui_pop_hover_cursor(void);
|
||||
internal FNT_Tag ui_pop_font(void);
|
||||
@@ -1064,6 +1068,7 @@ internal U32 ui_set_next_fastpath_codepoint(U32 v);
|
||||
internal UI_Key ui_set_next_group_key(UI_Key v);
|
||||
internal F32 ui_set_next_transparency(F32 v);
|
||||
internal UI_Palette* ui_set_next_palette(UI_Palette* v);
|
||||
internal String8 ui_set_next_tag(String8 v);
|
||||
internal F32 ui_set_next_squish(F32 v);
|
||||
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v);
|
||||
internal FNT_Tag ui_set_next_font(FNT_Tag v);
|
||||
@@ -1087,6 +1092,7 @@ internal UI_Size ui_pop_pref_size(Axis2 axis);
|
||||
internal UI_Size ui_set_next_pref_size(Axis2 axis, UI_Size v);
|
||||
internal void ui_push_corner_radius(F32 v);
|
||||
internal void ui_pop_corner_radius(void);
|
||||
internal void ui_push_tagf(char *fmt, ...);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Macro Loop Wrappers
|
||||
@@ -1102,12 +1108,14 @@ internal void ui_pop_corner_radius(void);
|
||||
#define UI_PrefHeight(v) DeferLoop(ui_push_pref_height(v), ui_pop_pref_height())
|
||||
#define UI_PermissionFlags(v) DeferLoop(ui_push_permission_flags(v), ui_pop_permission_flags())
|
||||
#define UI_Flags(v) DeferLoop(ui_push_flags(v), ui_pop_flags())
|
||||
#define UI_OmitFlags(v) DeferLoop(ui_push_omit_flags(v), ui_pop_omit_flags())
|
||||
#define UI_FocusHot(v) DeferLoop(ui_push_focus_hot(v), ui_pop_focus_hot())
|
||||
#define UI_FocusActive(v) DeferLoop(ui_push_focus_active(v), ui_pop_focus_active())
|
||||
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
|
||||
#define UI_GroupKey(v) DeferLoop(ui_push_group_key(v), ui_pop_group_key())
|
||||
#define UI_Transparency(v) DeferLoop(ui_push_transparency(v), ui_pop_transparency())
|
||||
#define UI_Palette(v) DeferLoop(ui_push_palette(v), ui_pop_palette())
|
||||
#define UI_Tag(v) DeferLoop(ui_push_tag(v), ui_pop_tag())
|
||||
#define UI_Squish(v) DeferLoop(ui_push_squish(v), ui_pop_squish())
|
||||
#define UI_HoverCursor(v) DeferLoop(ui_push_hover_cursor(v), ui_pop_hover_cursor())
|
||||
#define UI_Font(v) DeferLoop(ui_push_font(v), ui_pop_font())
|
||||
@@ -1132,6 +1140,7 @@ internal void ui_pop_corner_radius(void);
|
||||
#define UI_CornerRadius(v) DeferLoop(ui_push_corner_radius(v), ui_pop_corner_radius())
|
||||
#define UI_Focus(kind) DeferLoop((ui_push_focus_hot(kind), ui_push_focus_active(kind)), (ui_pop_focus_hot(), ui_pop_focus_active()))
|
||||
#define UI_FlagsAdd(v) DeferLoop(ui_push_flags(ui_top_flags()|(v)), ui_pop_flags())
|
||||
#define UI_TagF(...) DeferLoop(ui_push_tagf(__VA_ARGS__), ui_pop_tag())
|
||||
|
||||
//- rjf: tooltip
|
||||
#define UI_TooltipBase DeferLoop(ui_tooltip_begin_base(), ui_tooltip_end_base())
|
||||
|
||||
Reference in New Issue
Block a user