diff options
| author | 杨宇千 <crupest@outlook.com> | 2019-08-11 23:27:16 +0800 |
|---|---|---|
| committer | 杨宇千 <crupest@outlook.com> | 2019-08-11 23:27:16 +0800 |
| commit | 86e776eaebf7c45a269001ca7da0dfafba069d0a (patch) | |
| tree | 64c0544d9839562a6fc6d08ea00682a94c5d222b /include/cru/ui | |
| parent | 99a322a6badf5b6d95be4944e80d92fc1cb2589e (diff) | |
| download | cru-86e776eaebf7c45a269001ca7da0dfafba069d0a.tar.gz cru-86e776eaebf7c45a269001ca7da0dfafba069d0a.tar.bz2 cru-86e776eaebf7c45a269001ca7da0dfafba069d0a.zip | |
...
Diffstat (limited to 'include/cru/ui')
| -rw-r--r-- | include/cru/ui/window.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/cru/ui/window.hpp b/include/cru/ui/window.hpp index 197198d2..ee6d2176 100644 --- a/include/cru/ui/window.hpp +++ b/include/cru/ui/window.hpp @@ -60,6 +60,14 @@ class Window final : public ContentControl, public SelfResolvable<Window> { // Get the control that has focus. Control* GetFocusControl(); + //*************** region: focus *************** + + // Pass nullptr to release capture. + bool CaptureMouseFor(Control* control); + + // Return null if not captured. + Control* GetMouseCaptureControl(); + protected: void OnChildChanged(Control* old_child, Control* new_child) override; @@ -86,6 +94,7 @@ class Window final : public ContentControl, public SelfResolvable<Window> { //*************** region: event dispatcher helper *************** + // dispatch enter is useful when mouse is captured. void DispatchMouseHoverControlChangeEvent(Control* old_control, Control* new_control, const Point& point); @@ -100,6 +109,8 @@ class Window final : public ContentControl, public SelfResolvable<Window> { Control* focus_control_; // "focus_control_" can't be nullptr + Control* mouse_captured_control_; + bool need_layout_ = false; }; } // namespace cru::ui |
