diff --git a/libs/ui/include/psemek/ui/style.hpp b/libs/ui/include/psemek/ui/style.hpp index 653ebc7f..ccdb6a7d 100644 --- a/libs/ui/include/psemek/ui/style.hpp +++ b/libs/ui/include/psemek/ui/style.hpp @@ -13,10 +13,11 @@ namespace psemek::ui gfx::color_rgba highlight_color{159, 159, 159, 255}; gfx::color_rgba action_color{63, 63, 63, 255}; + gfx::color_rgba border_color{255, 255, 255, 255}; int border_width = 3; - int shadow_width = 1; - gfx::color_rgba shadow_color{0, 0, 0, 127}; + geom::vector shadow_offset{1, 1}; + gfx::color_rgba shadow_color{0, 0, 0, 255}; gfx::color_rgba text_color{0, 0, 0, 255}; std::shared_ptr font; diff --git a/libs/ui/source/default_element_factory.cpp b/libs/ui/source/default_element_factory.cpp index 3ed95a74..eeb94486 100644 --- a/libs/ui/source/default_element_factory.cpp +++ b/libs/ui/source/default_element_factory.cpp @@ -26,12 +26,18 @@ namespace psemek::ui auto s = style(); if (!s) return; + if (s->shadow_offset != geom::vector{0, 0}) + p.draw_rect(shape_.box + geom::cast(s->shadow_offset), s->shadow_color); + + if (s->border_width > 0) + p.draw_rect(shape_.box, s->border_color); + gfx::color_rgba color = s->fg_color; if (state() == state_t::mouseover) color = s->highlight_color; else if (state() == state_t::mousedown) color = s->action_color; - p.draw_rect(shape_.box, color); + p.draw_rect(geom::shrink(shape_.box, 1.f * s->border_width), color); } geom::box size_constraints() const override