aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/button.cpp
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-09-08 19:09:38 +0800
committer杨宇千 <crupest@outlook.com>2019-09-08 19:09:38 +0800
commit8b9a306d6f24dbc08aeee16b115260406e79126d (patch)
treedb37b8c3441a28b7150b1f40ddf79c7fa9dcda79 /src/ui/controls/button.cpp
parent2c40085dd30d6e7370a0974ad1f642a61acc6e30 (diff)
downloadcru-8b9a306d6f24dbc08aeee16b115260406e79126d.tar.gz
cru-8b9a306d6f24dbc08aeee16b115260406e79126d.tar.bz2
cru-8b9a306d6f24dbc08aeee16b115260406e79126d.zip
...
Diffstat (limited to 'src/ui/controls/button.cpp')
-rw-r--r--src/ui/controls/button.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ui/controls/button.cpp b/src/ui/controls/button.cpp
index 42a08e33..38ce75a8 100644
--- a/src/ui/controls/button.cpp
+++ b/src/ui/controls/button.cpp
@@ -3,12 +3,17 @@
#include "cru/platform/graph/brush.hpp"
#include "cru/platform/graph/graph_factory.hpp"
+#include "cru/platform/native/cursor.hpp"
#include "cru/platform/native/native_window.hpp"
+#include "cru/platform/native/ui_applicaition.hpp"
#include "cru/ui/render/border_render_object.hpp"
#include "cru/ui/ui_manager.hpp"
#include "cru/ui/window.hpp"
namespace cru::ui::controls {
+using platform::native::SystemCursor;
+using platform::native::UiApplication;
+
Button::Button() : click_detector_(this) {
// const auto predefined_resource =
// UiManager::GetInstance()->GetPredefineResources();
@@ -39,10 +44,15 @@ Button::Button() : click_detector_(this) {
} else {
SetState(ButtonState::Hover);
}
+ SetCursor(UiApplication::GetInstance()->GetCursorManager()->GetSystemCursor(
+ SystemCursor::Hand));
});
- MouseLeaveEvent()->Direct()->AddHandler(
- [this](event::MouseEventArgs& args) { SetState(ButtonState::Normal); });
+ MouseLeaveEvent()->Direct()->AddHandler([this](event::MouseEventArgs& args) {
+ SetState(ButtonState::Normal);
+ SetCursor(UiApplication::GetInstance()->GetCursorManager()->GetSystemCursor(
+ SystemCursor::Arrow));
+ });
click_detector_.ClickBeginEvent()->AddHandler([this](MouseButton button) {
if (button & trigger_button_) {