From 02baef645090f0514fa14b43aecf954fd55257dc Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 12 May 2021 08:36:43 +0800 Subject: ... --- src/ui/render/ScrollBar.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/ui/render/ScrollBar.cpp') diff --git a/src/ui/render/ScrollBar.cpp b/src/ui/render/ScrollBar.cpp index 4bde6d19..ec583b2a 100644 --- a/src/ui/render/ScrollBar.cpp +++ b/src/ui/render/ScrollBar.cpp @@ -14,6 +14,7 @@ #include "cru/ui/UiManager.hpp" #include "cru/ui/events/UiEvent.hpp" #include "cru/ui/helper/ClickDetector.hpp" +#include "cru/ui/host/WindowHost.hpp" #include "cru/ui/render/ScrollRenderObject.hpp" #include @@ -348,22 +349,24 @@ void ScrollBar::OnDraw(platform::graphics::IPainter* painter, } void ScrollBar::SetCursor() { - if (!old_cursor_) { - if (const auto control = render_object_->GetAttachedControl()) { - old_cursor_ = control->GetCursor(); - control->SetCursor( + if (const auto control = render_object_->GetAttachedControl()) { + if (const auto window_host = control->GetWindowHost()) { + window_host->SetOverrideCursor( GetUiApplication()->GetCursorManager()->GetSystemCursor( platform::gui::SystemCursorType::Arrow)); + cursor_overrided_ = true; } } } void ScrollBar::RestoreCursor() { - if (old_cursor_) { + if (cursor_overrided_) { if (const auto control = render_object_->GetAttachedControl()) { - control->SetCursor(*old_cursor_); + if (const auto window_host = control->GetWindowHost()) { + window_host->SetOverrideCursor(nullptr); + } } - old_cursor_ = std::nullopt; + cursor_overrided_ = false; } } -- cgit v1.2.3