aboutsummaryrefslogtreecommitdiff
path: root/src/ui/control.cpp
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-08-12 01:03:02 +0800
committer杨宇千 <crupest@outlook.com>2019-08-12 01:03:02 +0800
commit04367ead7027e9f0359d24681f5cc0dd916b934d (patch)
treef2a277ac9d53863c9f4efc8099450138974bdb4d /src/ui/control.cpp
parent86e776eaebf7c45a269001ca7da0dfafba069d0a (diff)
downloadcru-04367ead7027e9f0359d24681f5cc0dd916b934d.tar.gz
cru-04367ead7027e9f0359d24681f5cc0dd916b934d.tar.bz2
cru-04367ead7027e9f0359d24681f5cc0dd916b934d.zip
...
Diffstat (limited to 'src/ui/control.cpp')
-rw-r--r--src/ui/control.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index d529b687..7bd33d84 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -54,6 +54,7 @@ void Control::_TraverseDescendants(
predicate(control);
for (auto c : control->GetChildren()) _TraverseDescendants(c, predicate);
}
+
bool Control::RequestFocus() {
auto window = GetWindow();
if (window == nullptr) return false;
@@ -68,15 +69,21 @@ bool Control::HasFocus() {
return window->GetFocusControl() == this;
}
-void Control::OnParentChanged(Control* old_parent, Control* new_parent) {}
+bool Control::CaptureMouse() {
+ return GetWindow()->CaptureMouseFor(this);
+}
-void Control::OnAttachToWindow(Window* window) {}
+bool Control::ReleaseMouse() {
+ return GetWindow()->CaptureMouseFor(nullptr);
+}
-void Control::OnDetachToWindow(Window* window) {}
+bool Control::IsMouseCaptured() {
+ return GetWindow()->GetMouseCaptureControl() == this;
+}
-void Control::OnMouseClickBegin(platform::native::MouseButton button) {}
+void Control::OnParentChanged(Control* old_parent, Control* new_parent) {}
-void Control::OnMouseClickEnd(platform::native::MouseButton button) {}
+void Control::OnAttachToWindow(Window* window) {}
-void Control::OnMouseClickCancel(platform::native::MouseButton button) {}
+void Control::OnDetachToWindow(Window* window) {}
} // namespace cru::ui