diff options
author | crupest <crupest@outlook.com> | 2020-12-02 19:38:25 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-12-02 19:38:25 +0800 |
commit | d7dca1be0dd0814e30fa63924a20af3d924e974c (patch) | |
tree | 0a5ea0b637dc8392eee67ec625a51cef09ec8731 /src/ui/render | |
parent | 145cfd5b82d76e0c937eceda707aa22427899943 (diff) | |
download | cru-d7dca1be0dd0814e30fa63924a20af3d924e974c.tar.gz cru-d7dca1be0dd0814e30fa63924a20af3d924e974c.tar.bz2 cru-d7dca1be0dd0814e30fa63924a20af3d924e974c.zip |
...
Diffstat (limited to 'src/ui/render')
-rw-r--r-- | src/ui/render/BorderRenderObject.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ui/render/BorderRenderObject.cpp b/src/ui/render/BorderRenderObject.cpp index 8e16d8cb..5abc7832 100644 --- a/src/ui/render/BorderRenderObject.cpp +++ b/src/ui/render/BorderRenderObject.cpp @@ -5,6 +5,7 @@ #include "cru/platform/graphics/Factory.hpp" #include "cru/platform/graphics/Geometry.hpp" #include "cru/platform/graphics/util/Painter.hpp" +#include "cru/ui/style/ApplyBorderStyleInfo.hpp" #include <algorithm> @@ -25,6 +26,16 @@ void BorderRenderObject::SetBorderStyle(const BorderStyle& style) { InvalidateLayout(); } +void BorderRenderObject::ApplyBorderStyle( + const style::ApplyBorderStyleInfo& style) { + if (style.border_brush != nullptr) border_brush_ = style.border_brush; + if (style.border_thickness) border_thickness_ = *style.border_thickness; + if (style.border_radius) border_radius_ = *style.border_radius; + if (style.foreground_brush) foreground_brush_ = style.foreground_brush; + if (style.background_brush) background_brush_ = style.background_brush; + InvalidateLayout(); +} + RenderObject* BorderRenderObject::HitTest(const Point& point) { if (const auto child = GetSingleChild()) { auto offset = child->GetOffset(); @@ -109,9 +120,10 @@ Size BorderRenderObject::OnMeasureCore(const MeasureRequirement& requirement, if (!requirement.max.height.IsNotSpecified()) { const auto max_height = requirement.max.height.GetLengthOrMax(); if (coerced_space_size.height > max_height) { - log::TagWarn(log_tag, - u"(Measure) Vertical length of padding, border and margin is " - u"bigger than required max length."); + log::TagWarn( + log_tag, + u"(Measure) Vertical length of padding, border and margin is " + u"bigger than required max length."); coerced_space_size.height = max_height; } content_requirement.max.height = max_height - coerced_space_size.height; |