[ui] shorten ui styling api names

This commit is contained in:
Martin Fouilleul 2023-03-08 11:13:32 +01:00
parent 8b06cb31ba
commit f07f56948d
3 changed files with 12 additions and 12 deletions

View File

@ -265,9 +265,9 @@ int main()
ui_pattern pattern = {0}; ui_pattern pattern = {0};
ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TEXT, .text = str8_lit("b")}); ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TEXT, .text = str8_lit("b")});
ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TAG, .tag = ui_tag_make("foo")}); ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TAG, .tag = ui_tag_make("foo")});
ui_style_match_next_before(pattern, &(ui_style){.fontSize = 36}, UI_STYLE_FONT_SIZE); ui_style_match_before(pattern, &(ui_style){.fontSize = 36}, UI_STYLE_FONT_SIZE);
ui_style_match_next_before(ui_pattern_all(), ui_style_match_before(ui_pattern_all(),
&defaultStyle, &defaultStyle,
UI_STYLE_FONT UI_STYLE_FONT
|UI_STYLE_FONT_SIZE |UI_STYLE_FONT_SIZE
@ -282,7 +282,7 @@ int main()
pattern = (ui_pattern){0}; pattern = (ui_pattern){0};
ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TEXT, .text = str8_lit("c")}); ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TEXT, .text = str8_lit("c")});
ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TAG, .tag = ui_tag_make("button")}); ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TAG, .tag = ui_tag_make("button")});
ui_style_match_next_after(pattern, ui_style_match_after(pattern,
&(ui_style){.bgColor = {1, 0.5, 0.5, 1}}, &(ui_style){.bgColor = {1, 0.5, 0.5, 1}},
UI_STYLE_BG_COLOR); UI_STYLE_BG_COLOR);
@ -290,7 +290,7 @@ int main()
ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TEXT, .text = str8_lit("c")}); ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TEXT, .text = str8_lit("c")});
ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TAG, .tag = ui_tag_make("button")}); ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TAG, .tag = ui_tag_make("button")});
ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_STATUS, .op = UI_SEL_AND, .status = UI_ACTIVE|UI_HOVER}); ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_STATUS, .op = UI_SEL_AND, .status = UI_ACTIVE|UI_HOVER});
ui_style_match_next_after(pattern, ui_style_match_after(pattern,
&(ui_style){.bgColor = {0.5, 1, 0.5, 1}}, &(ui_style){.bgColor = {0.5, 1, 0.5, 1}},
UI_STYLE_BG_COLOR); UI_STYLE_BG_COLOR);
@ -298,7 +298,7 @@ int main()
{ {
ui_pattern pattern = {0}; ui_pattern pattern = {0};
ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TEXT, .text = str8_lit("b")}); ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TEXT, .text = str8_lit("b")});
ui_style_match_next_before(pattern, &(ui_style){.fontSize = 22}, UI_STYLE_FONT_SIZE); ui_style_match_before(pattern, &(ui_style){.fontSize = 22}, UI_STYLE_FONT_SIZE);
ui_container("b", defaultFlags) ui_container("b", defaultFlags)
{ {

View File

@ -324,7 +324,7 @@ ui_pattern ui_pattern_owner(void)
return(pattern); return(pattern);
} }
void ui_style_match_next_before(ui_pattern pattern, ui_style* style, ui_style_mask mask) void ui_style_match_before(ui_pattern pattern, ui_style* style, ui_style_mask mask)
{ {
ui_context* ui = ui_get_context(); ui_context* ui = ui_get_context();
if(ui) if(ui)
@ -339,7 +339,7 @@ void ui_style_match_next_before(ui_pattern pattern, ui_style* style, ui_style_ma
} }
} }
void ui_style_match_next_after(ui_pattern pattern, ui_style* style, ui_style_mask mask) void ui_style_match_after(ui_pattern pattern, ui_style* style, ui_style_mask mask)
{ {
ui_context* ui = ui_get_context(); ui_context* ui = ui_get_context();
if(ui) if(ui)
@ -356,7 +356,7 @@ void ui_style_match_next_after(ui_pattern pattern, ui_style* style, ui_style_mas
void ui_style_next(ui_style* style, ui_style_mask mask) void ui_style_next(ui_style* style, ui_style_mask mask)
{ {
ui_style_match_next_before(ui_pattern_owner(), style, mask); ui_style_match_before(ui_pattern_owner(), style, mask);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -1448,7 +1448,7 @@ ui_sig ui_button_str8(str8 label)
&activePattern, &activePattern,
(ui_selector){.kind = UI_SEL_STATUS, (ui_selector){.kind = UI_SEL_STATUS,
.status = UI_ACTIVE|UI_HOVER}); .status = UI_ACTIVE|UI_HOVER});
ui_style_match_next_before(activePattern, &activeStyle, activeMask); ui_style_match_before(activePattern, &activeStyle, activeMask);
ui_flags flags = UI_FLAG_CLICKABLE ui_flags flags = UI_FLAG_CLICKABLE
| UI_FLAG_CLIP | UI_FLAG_CLIP
@ -1491,7 +1491,7 @@ ui_sig ui_button(const char* label)
ui_box* ui_slider(const char* label, f32 thumbRatio, f32* scrollValue) ui_box* ui_slider(const char* label, f32 thumbRatio, f32* scrollValue)
{ {
ui_style_match_next_before(ui_pattern_all(), &(ui_style){0}, UI_STYLE_LAYOUT); ui_style_match_before(ui_pattern_all(), &(ui_style){0}, UI_STYLE_LAYOUT);
ui_box* frame = ui_box_begin(label, 0); ui_box* frame = ui_box_begin(label, 0);
{ {
f32 beforeRatio = (*scrollValue) * (1. - thumbRatio); f32 beforeRatio = (*scrollValue) * (1. - thumbRatio);

View File

@ -395,8 +395,8 @@ ui_pattern ui_pattern_all(void);
ui_pattern ui_pattern_owner(void); ui_pattern ui_pattern_owner(void);
void ui_style_next(ui_style* style, ui_style_mask mask); void ui_style_next(ui_style* style, ui_style_mask mask);
void ui_style_match_next_before(ui_pattern pattern, ui_style* style, ui_style_mask mask); void ui_style_match_before(ui_pattern pattern, ui_style* style, ui_style_mask mask);
void ui_style_match_next_after(ui_pattern pattern, ui_style* style, ui_style_mask mask); void ui_style_match_after(ui_pattern pattern, ui_style* style, ui_style_mask mask);
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Basic widget helpers // Basic widget helpers