aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/border_delegate.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/controls/border_delegate.h')
-rw-r--r--src/ui/controls/border_delegate.h101
1 files changed, 0 insertions, 101 deletions
diff --git a/src/ui/controls/border_delegate.h b/src/ui/controls/border_delegate.h
deleted file mode 100644
index 6d8663e9..00000000
--- a/src/ui/controls/border_delegate.h
+++ /dev/null
@@ -1,101 +0,0 @@
-#pragma once
-
-#include "ui/control.h"
-
-namespace cru::ui::controls
-{
- class BorderProperty : public PropertyChangedNotifyObject
- {
- public:
- using Ptr = std::shared_ptr<BorderProperty>;
- static Ptr Create();
-
- constexpr static auto brush_property_name = L"Brush";
- constexpr static auto width_property_name = L"Width";
- 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";
-
- BorderProperty() = default;
- explicit BorderProperty(Microsoft::WRL::ComPtr<ID2D1Brush> brush);
- 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 GetWidth() const
- {
- return 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 width_ = 1.0f;
- Microsoft::WRL::ComPtr<ID2D1StrokeStyle> stroke_style_ = nullptr;
- float radius_x_ = 0.0f;
- float radius_y_ = 0.0f;
- };
-
-
- // BorderDelegate is a delegate for border painting and layout.
- // It must bind a control and not change the binding.
- // But multiple BorderDelegate may share a common BorderProperty.
- class BorderDelegate : public Object
- {
- public:
- explicit BorderDelegate(Control* control);
- BorderDelegate(Control* control, std::shared_ptr<BorderProperty> border_property);
- BorderDelegate(const BorderDelegate& other) = delete;
- BorderDelegate(BorderDelegate&& other) = delete;
- BorderDelegate& operator=(const BorderDelegate& other) = delete;
- BorderDelegate& operator=(BorderDelegate&& other) = delete;
- ~BorderDelegate() override;
-
- std::shared_ptr<BorderProperty> GetBorderProperty() const
- {
- return border_property_;
- }
-
- void SetBorderProperty(std::shared_ptr<BorderProperty> border_property);
-
- void Draw(ID2D1DeviceContext* device_context, const Size& size) const;
-
- Thickness GetBorderThickness() const
- {
- return Thickness(border_property_->GetWidth());
- }
-
- private:
- Control* control_;
- std::shared_ptr<BorderProperty> border_property_;
- FunctionPtr<void(String)> border_property_changed_listener_;
- };
-}