aboutsummaryrefslogtreecommitdiff
path: root/src/ui/border_property.h
diff options
context:
space:
mode:
authorYuqian Yang <crupest@outlook.com>2018-10-04 16:52:11 +0000
committerYuqian Yang <crupest@outlook.com>2018-10-04 16:52:11 +0000
commit7e870dd16e2f5b41fa6c6f687723aaa50c16274d (patch)
treebe2b26a42dc9fde97379f98f035113e08e0bc331 /src/ui/border_property.h
parent30ecda8bb354d5982978af97aa90b5f49d9ea195 (diff)
parentc5384d496e9ed429ca2baa3ca5e586ff255235eb (diff)
downloadcru-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.h')
-rw-r--r--src/ui/border_property.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/ui/border_property.h b/src/ui/border_property.h
new file mode 100644
index 00000000..71ec0e7d
--- /dev/null
+++ b/src/ui/border_property.h
@@ -0,0 +1,72 @@
+#pragma once
+
+#include "system_headers.h"
+
+#include "base.h"
+
+
+namespace cru::ui
+{
+ class BorderProperty final : public PropertyChangedNotifyObject
+ {
+ public:
+ constexpr static auto brush_property_name = L"Brush";
+ constexpr static auto width_property_name = L"StrokeWidth";
+ constexpr static auto stroke_style_property_name = L"StrokeStyle";
+ constexpr static auto radius_x_property_name = L"RadiusX";
+ constexpr static auto radius_y_property_name = L"RadiusY";
+
+ using Ptr = std::shared_ptr<BorderProperty>;
+
+ static Ptr Create()
+ {
+ return std::make_shared<BorderProperty>();
+ }
+
+ BorderProperty();
+ BorderProperty(const BorderProperty& other) = delete;
+ BorderProperty(BorderProperty&& other) = delete;
+ BorderProperty& operator=(const BorderProperty& other) = delete;
+ BorderProperty& operator=(BorderProperty&& other) = delete;
+ ~BorderProperty() override = default;
+
+
+ Microsoft::WRL::ComPtr<ID2D1Brush> GetBrush() const
+ {
+ return brush_;
+ }
+
+ float GetStrokeWidth() const
+ {
+ return stroke_width_;
+ }
+
+ Microsoft::WRL::ComPtr<ID2D1StrokeStyle> GetStrokeStyle() const
+ {
+ return stroke_style_;
+ }
+
+ float GetRadiusX() const
+ {
+ return radius_x_;
+ }
+
+ float GetRadiusY() const
+ {
+ return radius_y_;
+ }
+
+ void SetBrush(Microsoft::WRL::ComPtr<ID2D1Brush> brush);
+ void SetWidth(float width);
+ void SetStrokeStyle(Microsoft::WRL::ComPtr<ID2D1StrokeStyle> stroke_style);
+ void SetRadiusX(float radius_x);
+ void SetRadiusY(float radius_y);
+
+ private:
+ Microsoft::WRL::ComPtr<ID2D1Brush> brush_ = nullptr;
+ float stroke_width_ = 1.0f;
+ Microsoft::WRL::ComPtr<ID2D1StrokeStyle> stroke_style_ = nullptr;
+ float radius_x_ = 0.0f;
+ float radius_y_ = 0.0f;
+ };
+}