aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-12-25 14:43:19 +0800
committercrupest <crupest@outlook.com>2020-12-25 14:43:19 +0800
commita14704fbd9b9fb377b7009a9fbe641a9b8d0fdfb (patch)
tree7ee33e1d51f15841ee908ec16b937985f7d9be96 /src/ui/controls
parentd23cdd9c6f2fbec1329c704bde7e183b5ef07e2e (diff)
downloadcru-a14704fbd9b9fb377b7009a9fbe641a9b8d0fdfb.tar.gz
cru-a14704fbd9b9fb377b7009a9fbe641a9b8d0fdfb.tar.bz2
cru-a14704fbd9b9fb377b7009a9fbe641a9b8d0fdfb.zip
...
Diffstat (limited to 'src/ui/controls')
-rw-r--r--src/ui/controls/Button.cpp27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/ui/controls/Button.cpp b/src/ui/controls/Button.cpp
index 8bd9f93f..c6480b77 100644
--- a/src/ui/controls/Button.cpp
+++ b/src/ui/controls/Button.cpp
@@ -1,5 +1,4 @@
#include "cru/ui/controls/Button.hpp"
-#include <memory>
#include "../Helper.hpp"
#include "cru/platform/graphics/Brush.hpp"
@@ -10,38 +9,12 @@
#include "cru/ui/render/BorderRenderObject.hpp"
namespace cru::ui::controls {
-using cru::platform::gui::SystemCursorType;
-
-namespace {
-std::shared_ptr<platform::gui::ICursor> GetSystemCursor(SystemCursorType type) {
- return GetUiApplication()->GetCursorManager()->GetSystemCursor(type);
-}
-} // namespace
-
Button::Button() : click_detector_(this) {
render_object_ = std::make_unique<render::BorderRenderObject>();
render_object_->SetAttachedControl(this);
SetContainerRenderObject(render_object_.get());
render_object_->SetBorderEnabled(true);
- click_detector_.StateChangeEvent()->AddHandler(
- [this](const helper::ClickState& state) {
- switch (state) {
- case helper::ClickState::None:
- SetCursor(GetSystemCursor(SystemCursorType::Arrow));
- break;
- case helper::ClickState::Hover:
- SetCursor(GetSystemCursor(SystemCursorType::Hand));
- break;
- case helper::ClickState::Press:
- SetCursor(GetSystemCursor(SystemCursorType::Hand));
- break;
- case helper::ClickState::PressInactive:
- SetCursor(GetSystemCursor(SystemCursorType::Arrow));
- break;
- }
- });
-
GetStyleRuleSet()->SetParent(
&UiManager::GetInstance()->GetThemeResources()->button_style);
}