aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/Button.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-11-08 17:45:41 +0800
committercrupest <crupest@outlook.com>2020-11-08 17:45:41 +0800
commit2188845a7acffa653015a1000139ec0a9a3984bc (patch)
tree7e8ed6eca5868a0943af6fcad6467115f369987c /src/ui/controls/Button.cpp
parent93265251d56c91b05f160423077ce95339786f87 (diff)
downloadcru-2188845a7acffa653015a1000139ec0a9a3984bc.tar.gz
cru-2188845a7acffa653015a1000139ec0a9a3984bc.tar.bz2
cru-2188845a7acffa653015a1000139ec0a9a3984bc.zip
...
Diffstat (limited to 'src/ui/controls/Button.cpp')
-rw-r--r--src/ui/controls/Button.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/ui/controls/Button.cpp b/src/ui/controls/Button.cpp
index 5f7ed143..b7407ec2 100644
--- a/src/ui/controls/Button.cpp
+++ b/src/ui/controls/Button.cpp
@@ -5,9 +5,9 @@
#include "cru/platform/graphics/Brush.hpp"
#include "cru/platform/gui/Cursor.hpp"
#include "cru/platform/gui/UiApplication.hpp"
-#include "cru/ui/render/BorderRenderObject.hpp"
#include "cru/ui/UiManager.hpp"
-#include "cru/ui/Window.hpp"
+#include "cru/ui/helper/ClickDetector.hpp"
+#include "cru/ui/render/BorderRenderObject.hpp"
namespace cru::ui::controls {
using cru::platform::gui::SystemCursorType;
@@ -21,8 +21,7 @@ void Set(render::BorderRenderObject* o, const ButtonStateStyle& s) {
o->SetBackgroundBrush(s.background_brush);
}
-std::shared_ptr<platform::gui::ICursor> GetSystemCursor(
- SystemCursorType type) {
+std::shared_ptr<platform::gui::ICursor> GetSystemCursor(SystemCursorType type) {
return GetUiApplication()->GetCursorManager()->GetSystemCursor(type);
}
} // namespace
@@ -36,21 +35,21 @@ Button::Button() : click_detector_(this) {
render_object_->SetBorderEnabled(true);
click_detector_.StateChangeEvent()->AddHandler(
- [this](const ClickState& state) {
+ [this](const helper::ClickState& state) {
switch (state) {
- case ClickState::None:
+ case helper::ClickState::None:
Set(render_object_.get(), style_.normal);
SetCursor(GetSystemCursor(SystemCursorType::Arrow));
break;
- case ClickState::Hover:
+ case helper::ClickState::Hover:
Set(render_object_.get(), style_.hover);
SetCursor(GetSystemCursor(SystemCursorType::Hand));
break;
- case ClickState::Press:
+ case helper::ClickState::Press:
Set(render_object_.get(), style_.press);
SetCursor(GetSystemCursor(SystemCursorType::Hand));
break;
- case ClickState::PressInactive:
+ case helper::ClickState::PressInactive:
Set(render_object_.get(), style_.press_cancel);
SetCursor(GetSystemCursor(SystemCursorType::Arrow));
break;