aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/toggle_button.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-11-07 21:40:04 +0800
committercrupest <crupest@outlook.com>2018-11-07 21:40:04 +0800
commitefdce672123284847bd7fb6f12ac1ec96f28f3ef (patch)
tree298e6313e9a48c5867b2355242b78d3cd23fdc61 /src/ui/controls/toggle_button.h
parent634dab6ad2c9e4675beacfb77ac02b2d43cab132 (diff)
downloadcru-efdce672123284847bd7fb6f12ac1ec96f28f3ef.tar.gz
cru-efdce672123284847bd7fb6f12ac1ec96f28f3ef.tar.bz2
cru-efdce672123284847bd7fb6f12ac1ec96f28f3ef.zip
Make all header *.hpp .
Diffstat (limited to 'src/ui/controls/toggle_button.h')
-rw-r--r--src/ui/controls/toggle_button.h65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/ui/controls/toggle_button.h b/src/ui/controls/toggle_button.h
deleted file mode 100644
index 6f3683de..00000000
--- a/src/ui/controls/toggle_button.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#pragma once
-
-#include "ui/control.h"
-
-namespace cru::ui::controls
-{
- class ToggleButton : public Control
- {
- public:
- static constexpr auto control_type = L"ToggleButton";
-
- static ToggleButton* Create()
- {
- return new ToggleButton();
- }
-
- protected:
- ToggleButton();
-
- public:
- ToggleButton(const ToggleButton& other) = delete;
- ToggleButton(ToggleButton&& other) = delete;
- ToggleButton& operator=(const ToggleButton& other) = delete;
- ToggleButton& operator=(ToggleButton&& other) = delete;
- ~ToggleButton() override = default;
-
- StringView GetControlType() const override final;
-
- bool IsPointInside(const Point& point) override;
-
- bool GetState() const
- {
- return state_;
- }
-
- void SetState(bool state);
-
- void Toggle();
-
- public:
- events::ToggleEvent toggle_event;
-
- protected:
- virtual void OnToggle(events::ToggleEventArgs& args);
-
- protected:
- void OnDrawContent(ID2D1DeviceContext* device_context) override;
-
- void OnMouseClickCore(events::MouseButtonEventArgs& args) override;
-
- Size OnMeasureContent(const Size& available_size) override;
-
- private:
- void RaiseToggleEvent(bool new_state);
-
- private:
- bool state_ = false;
-
- float current_circle_position_;
-
- Microsoft::WRL::ComPtr<ID2D1RoundedRectangleGeometry> frame_path_;
- Microsoft::WRL::ComPtr<ID2D1Brush> on_brush_;
- Microsoft::WRL::ComPtr<ID2D1Brush> off_brush_;
- };
-}