diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-18 00:46:27 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-18 00:46:27 +0800 |
| commit | 6b4edc9be8ec556147c195cf2047d92b9439efd7 (patch) | |
| tree | a1d7b7d1e821b4e1911fd00761f77a24ee483f4a /src/ui/events/MouseEventArgs.cpp | |
| parent | f7c4d19df66c602d74795e98ce2ee4390d06fbb4 (diff) | |
| download | cru-6b4edc9be8ec556147c195cf2047d92b9439efd7.tar.gz cru-6b4edc9be8ec556147c195cf2047d92b9439efd7.tar.bz2 cru-6b4edc9be8ec556147c195cf2047d92b9439efd7.zip | |
Bring back ControlHost and refactor tree management of control.
Diffstat (limited to 'src/ui/events/MouseEventArgs.cpp')
| -rw-r--r-- | src/ui/events/MouseEventArgs.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/ui/events/MouseEventArgs.cpp b/src/ui/events/MouseEventArgs.cpp index bbbf5cd4..ff3a2372 100644 --- a/src/ui/events/MouseEventArgs.cpp +++ b/src/ui/events/MouseEventArgs.cpp @@ -1,7 +1,7 @@ #include "cru/ui/events/MouseEventArgs.h" #include "cru/ui/controls/Control.h" -#include "cru/ui/controls/Window.h" +#include "cru/ui/controls/ControlHost.h" #include "cru/ui/render/RenderObject.h" namespace cru::ui::events { @@ -17,9 +17,8 @@ Point MouseEventArgs::GetPointToContent( Point MouseEventArgs::GetPointOfScreen() const { auto sender = GetSender(); if (auto control = dynamic_cast<controls::Control*>(sender)) { - if (auto window = control->GetWindow()) - return GetPoint() + - window->GetNativeWindow()->GetClientRect().GetLeftTop(); + if (auto host = control->GetControlHost()) + return GetPoint() + host->GetNativeWindow()->GetClientRect().GetLeftTop(); } return GetPoint(); } |
