diff options
author | crupest <crupest@outlook.com> | 2021-05-12 08:36:43 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-05-12 08:36:43 +0800 |
commit | 02baef645090f0514fa14b43aecf954fd55257dc (patch) | |
tree | 3d26669c5781238fb4737c9b315ad534b7c0a3e0 /src/ui/render | |
parent | f54032b94817bc5a03be68d39758e9b3d67a1b59 (diff) | |
download | cru-02baef645090f0514fa14b43aecf954fd55257dc.tar.gz cru-02baef645090f0514fa14b43aecf954fd55257dc.tar.bz2 cru-02baef645090f0514fa14b43aecf954fd55257dc.zip |
...
Diffstat (limited to 'src/ui/render')
-rw-r--r-- | src/ui/render/ScrollBar.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
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 <algorithm> @@ -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; } } |