aboutsummaryrefslogtreecommitdiff
path: root/src/ui/helper/ClickDetector.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-15 21:34:21 +0800
committercrupest <crupest@outlook.com>2022-02-15 21:34:21 +0800
commit24aaa8fbc5da8370506402facdb8ccaf563454e5 (patch)
tree0075bfbee729b1ccc57966bef97bda4be09cbde9 /src/ui/helper/ClickDetector.cpp
parentfa6e9a419f688df12a57199aa3b4dce10cc6fd49 (diff)
downloadcru-24aaa8fbc5da8370506402facdb8ccaf563454e5.tar.gz
cru-24aaa8fbc5da8370506402facdb8ccaf563454e5.tar.bz2
cru-24aaa8fbc5da8370506402facdb8ccaf563454e5.zip
...
Diffstat (limited to 'src/ui/helper/ClickDetector.cpp')
-rw-r--r--src/ui/helper/ClickDetector.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ui/helper/ClickDetector.cpp b/src/ui/helper/ClickDetector.cpp
index 981e9e04..a10133e9 100644
--- a/src/ui/helper/ClickDetector.cpp
+++ b/src/ui/helper/ClickDetector.cpp
@@ -3,10 +3,21 @@
#include "cru/common/Logger.h"
#include "cru/ui/DebugFlags.h"
#include "cru/ui/controls/Control.h"
+#include "cru/ui/host/WindowHost.h"
#include <optional>
namespace cru::ui::helper {
+Point ClickEventArgs::GetDownPointOfScreen() const {
+ auto window_host = sender_->GetWindowHost();
+ if (window_host != nullptr) {
+ auto window = window_host->GetNativeWindow();
+ return down_point_ + window->GetClientRect().GetLeftTop();
+ } else {
+ return down_point_;
+ }
+}
+
ClickDetector::ClickDetector(controls::Control* control) {
Expects(control);
control_ = control;