aboutsummaryrefslogtreecommitdiff
path: root/src/ui/control.cpp
diff options
context:
space:
mode:
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