More progress on themes + workspace resize handles support

Still need to add support for centered resize of boxes with the handles. (Will need a different alignment configuration)

Theme manipulation is getting cleaned up iteratively code is slowly looking less nosiy
This commit is contained in:
2024-05-15 18:48:20 -04:00
parent 48ee98f22d
commit 85cf9d8db2
15 changed files with 360 additions and 258 deletions

View File

@ -36,7 +36,6 @@ ui_theme_via_theme :: #force_inline proc( theme : UI_Theme ) {
ui_style_push( theme.style )
}
/*
UI Themes: Comprise of UI_Box's layout & style
@ -44,93 +43,13 @@ Provides presets for themes and their interface for manipulating the combo stack
*/
// TODO(Ed): Eventually this will have a configuration wizard, and we'll save the presets
/*
UI_Theme_Template :: UI_Theme {
UI_Layout {
flags = {},
anchor = Range2{{},{}},
alignment = {},
text_alignment = {},
font_size = {},
margins = {},
padding = {},
border_width = {},
pos = {},
size = Range2{{},{}}
},
UI_Style {
bg_color = {},
corner_radii = {},
blur_size = 0,
font = {},
text_color = {},
cursor = 0,
}
}
*/
@(deferred_none = ui_theme_pop)
ui_theme_app_menu_bar_default :: proc()
{
@static theme : UI_Theme
// @static loaded : b32 = false
// if true && ! loaded
// {
layout := UI_Layout {
flags = {},
anchor = range2({},{}),
alignment = {0.5, 0.5},
text_alignment = {0.0, 1.5},
font_size = 12,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 0.6,
pos = {0, 0},
size = range2({},{})
}
style := UI_Style {
bg_color = Color_ThmDark_BG,
border_color = Color_ThmDark_Border_Default,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = Color_ThmDark_Text_Default,
cursor = {},
}
// loaded = true
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
{
using layout_combo.hot
using style_combo.hot
bg_color = Color_ThmDark_Btn_BG_Hot
text_color = Color_ThmDark_Text_Hot
}
{
using layout_combo.active
using style_combo.active
bg_color = Color_ThmDark_Btn_BG_Active
text_color = Color_ThmDark_Text_Active
}
theme = UI_Theme {
layout_combo, style_combo
}
// }
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}
@(deferred_none = ui_theme_pop)
ui_theme_btn_default :: proc()
{
@static theme : UI_Theme
// @static loaded : b32 = false
// if true && ! loaded
// {
@static loaded : b32 = false
if ! loaded
{
layout := UI_Layout {
flags = {},
anchor = range2({},{}),
@ -152,8 +71,6 @@ ui_theme_btn_default :: proc()
text_color = Color_ThmDark_Text_Default,
cursor = {},
}
// loaded = true
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
{
@ -170,13 +87,64 @@ ui_theme_btn_default :: proc()
text_color = Color_ThmDark_Text_Active
margins = {2, 2, 2, 2}
}
theme = UI_Theme {
layout_combo, style_combo
}
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}
@(deferred_none = ui_theme_pop)
ui_theme_transparent :: proc()
{
@static theme : UI_Theme
@static loaded : b32 = false
if ! loaded || true
{
layout := UI_Layout {
flags = {},
anchor = range2({},{}),
alignment = {0, 0},
text_alignment = {0.0, 0.0},
font_size = 16,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 0,
pos = {0, 0},
size = range2({},{})
}
style := UI_Style {
bg_color = Color_Transparent,
border_color = Color_Transparent,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = Color_ThmDark_Text_Default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
{
using layout_combo.disabled
using style_combo.disabled
}
{
using layout_combo.hot
using style_combo.hot
}
{
using layout_combo.active
using style_combo.active
}
theme = UI_Theme {
layout_combo, style_combo
}
// }
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}