From a14704fbd9b9fb377b7009a9fbe641a9b8d0fdfb Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 25 Dec 2020 14:43:19 +0800 Subject: ... --- src/ui/controls/Button.cpp | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'src/ui/controls/Button.cpp') 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 #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 GetSystemCursor(SystemCursorType type) { - return GetUiApplication()->GetCursorManager()->GetSystemCursor(type); -} -} // namespace - Button::Button() : click_detector_(this) { render_object_ = std::make_unique(); 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); } -- cgit v1.2.3