Add ui::style::scale
This commit is contained in:
parent
36446c66ac
commit
615fc029e7
2 changed files with 7 additions and 0 deletions
|
|
@ -16,6 +16,8 @@ namespace psemek::ui
|
||||||
|
|
||||||
struct style
|
struct style
|
||||||
{
|
{
|
||||||
|
std::optional<int> scale;
|
||||||
|
|
||||||
std::optional<gfx::color_rgba> bg_color;
|
std::optional<gfx::color_rgba> bg_color;
|
||||||
std::optional<gfx::color_rgba> fg_color;
|
std::optional<gfx::color_rgba> fg_color;
|
||||||
std::optional<gfx::color_rgba> highlight_color;
|
std::optional<gfx::color_rgba> highlight_color;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ namespace psemek::ui
|
||||||
|
|
||||||
void merge(style & dst, style const & src)
|
void merge(style & dst, style const & src)
|
||||||
{
|
{
|
||||||
|
merge(dst.scale, src.scale);
|
||||||
merge(dst.bg_color, src.bg_color);
|
merge(dst.bg_color, src.bg_color);
|
||||||
merge(dst.fg_color, src.fg_color);
|
merge(dst.fg_color, src.fg_color);
|
||||||
merge(dst.highlight_color, src.highlight_color);
|
merge(dst.highlight_color, src.highlight_color);
|
||||||
|
|
@ -62,6 +63,7 @@ namespace psemek::ui
|
||||||
style scale(style const & s, float factor)
|
style scale(style const & s, float factor)
|
||||||
{
|
{
|
||||||
style result = s;
|
style result = s;
|
||||||
|
scale(result.scale, factor);
|
||||||
scale(result.action_offset, factor);
|
scale(result.action_offset, factor);
|
||||||
scale(result.border_width, factor);
|
scale(result.border_width, factor);
|
||||||
scale(result.ref_height, factor);
|
scale(result.ref_height, factor);
|
||||||
|
|
@ -76,6 +78,9 @@ namespace psemek::ui
|
||||||
style default_style()
|
style default_style()
|
||||||
{
|
{
|
||||||
style s;
|
style s;
|
||||||
|
|
||||||
|
s.scale = 1;
|
||||||
|
|
||||||
s.bg_color = {95, 95, 95, 255};
|
s.bg_color = {95, 95, 95, 255};
|
||||||
s.fg_color = {127, 127, 127, 255};
|
s.fg_color = {127, 127, 127, 255};
|
||||||
s.highlight_color = {159, 159, 159, 255};
|
s.highlight_color = {159, 159, 159, 255};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue