diff options
author | Yuqian Yang <crupest@outlook.com> | 2018-10-04 16:52:11 +0000 |
---|---|---|
committer | Yuqian Yang <crupest@outlook.com> | 2018-10-04 16:52:11 +0000 |
commit | 7e870dd16e2f5b41fa6c6f687723aaa50c16274d (patch) | |
tree | be2b26a42dc9fde97379f98f035113e08e0bc331 /src/ui/border_property.cpp | |
parent | 30ecda8bb354d5982978af97aa90b5f49d9ea195 (diff) | |
parent | c5384d496e9ed429ca2baa3ca5e586ff255235eb (diff) | |
download | cru-7e870dd16e2f5b41fa6c6f687723aaa50c16274d.tar.gz cru-7e870dd16e2f5b41fa6c6f687723aaa50c16274d.tar.bz2 cru-7e870dd16e2f5b41fa6c6f687723aaa50c16274d.zip |
Merge branch '12-layout' into 'master'
Resolve "Add padding, margin, border to Control."
Closes #12
See merge request crupest/CruUI!12
Diffstat (limited to 'src/ui/border_property.cpp')
-rw-r--r-- | src/ui/border_property.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/ui/border_property.cpp b/src/ui/border_property.cpp new file mode 100644 index 00000000..03cae16e --- /dev/null +++ b/src/ui/border_property.cpp @@ -0,0 +1,43 @@ +#include "border_property.h" + +#include "graph/graph.h" + +namespace cru::ui +{ + BorderProperty::BorderProperty() + { + brush_ = graph::CreateSolidBrush(D2D1::ColorF(D2D1::ColorF::Black)); + } + + void BorderProperty::SetBrush(Microsoft::WRL::ComPtr<ID2D1Brush> brush) + { + if (brush == nullptr) + throw std::invalid_argument("Brush of BorderProperty mustn't be null."); + brush_ = std::move(brush); + RaisePropertyChangedEvent(brush_property_name); + } + + void BorderProperty::SetWidth(const float width) + { + stroke_width_ = width; + RaisePropertyChangedEvent(width_property_name); + } + + void BorderProperty::SetStrokeStyle(Microsoft::WRL::ComPtr<ID2D1StrokeStyle> stroke_style) + { + stroke_style_ = std::move(stroke_style); + RaisePropertyChangedEvent(stroke_style_property_name); + } + + void BorderProperty::SetRadiusX(const float radius_x) + { + radius_x_ = radius_x; + RaisePropertyChangedEvent(radius_x_property_name); + } + + void BorderProperty::SetRadiusY(const float radius_y) + { + radius_y_ = radius_y; + RaisePropertyChangedEvent(radius_y_property_name); + } +} |