Add ui::style::ref_height

This commit is contained in:
Nikita Lisitsa 2021-03-05 22:34:30 +03:00
parent 66194a1adc
commit 6ad43ff0a5
3 changed files with 8 additions and 3 deletions

View file

@ -22,6 +22,8 @@ namespace psemek::ui
std::optional<gfx::color_rgba> axis_color;
std::optional<int> ref_height;
std::optional<geom::vector<int, 2>> shadow_offset;
std::optional<gfx::color_rgba> shadow_color;

View file

@ -379,19 +379,19 @@ namespace psemek::ui
int button_width() const
{
auto st = merged_style();
return *st->outer_margin;
return *st->ref_height / 3;
}
int button_height() const
{
auto st = merged_style();
return 3 * (*st->outer_margin);
return *st->ref_height;
}
int axis_width() const
{
auto st = merged_style();
return *st->inner_margin;
return *st->ref_height / 5;
}
};

View file

@ -25,6 +25,7 @@ namespace psemek::ui
merge(dst.border_color, src.border_color);
merge(dst.border_width, src.border_width);
merge(dst.axis_color, src.axis_color);
merge(dst.ref_height, src.ref_height);
merge(dst.shadow_offset, src.shadow_offset);
merge(dst.shadow_color, src.shadow_color);
merge(dst.inner_margin, src.inner_margin);
@ -50,6 +51,8 @@ namespace psemek::ui
s.axis_color = {255, 255, 255, 255};
s.ref_height = 22;
s.shadow_offset = {1, 1};
s.shadow_color = {0, 0, 0, 255};