diff options
author | crupest <crupest@outlook.com> | 2019-04-04 18:23:00 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-04-04 18:23:00 +0800 |
commit | dbda5a8e4f0d59ad95be8fc3ee7b21e9122cc474 (patch) | |
tree | c8426a7aa086bf69b54b91328af0c160f933fa49 /src | |
parent | 4d650160a388b0192e04c454ba1a3de21b0d4cc3 (diff) | |
download | cru-dbda5a8e4f0d59ad95be8fc3ee7b21e9122cc474.tar.gz cru-dbda5a8e4f0d59ad95be8fc3ee7b21e9122cc474.tar.bz2 cru-dbda5a8e4f0d59ad95be8fc3ee7b21e9122cc474.zip |
...
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/window.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/ui/window.cpp b/src/ui/window.cpp index bad704ae..c0ee1a83 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -104,10 +104,16 @@ Window::Window(tag_overlapped_constructor) { render_object_.reset(new render::WindowRenderObject(this)); event_revokers_.push_back(native_window_->DestroyEvent()->AddHandler( - this, Window::OnNativeDestroy)); - event_revokers_.push_back( - native_window_->PaintEvent()->AddHandler(this, Window::OnNativePaint)); - //TODO + std::bind(&Window::OnNativeDestroy, this))); + event_revokers_.push_back(native_window_->PaintEvent()->AddHandler( + std::bind(&Window::OnNativePaint, this))); + event_revokers_.push_back(native_window_->ResizeEvent()->AddHandler( + std::bind(&Window::OnNativeResize, this))); + event_revokers_.push_back(native_window_->FocusEvent()->AddHandler( + std::bind(&Window::OnNativeFocus, this))); + event_revokers_.push_back(native_window_->FocusEvent()->AddHandler( + std::bind(&Window::OnNativeFocus, this))); + //TODO! } Window::~Window() { @@ -166,6 +172,13 @@ void Window::OnNativeFocus(bool focus) { : DispatchEvent(focus_control_, &Control::LoseFocusEvent, nullptr, true); } +void Window::OnNativeMouseEnterLeave(bool enter) { + if (!enter) { + DispatchEvent(mouse_hover_control_, &Control::MouseLeaveEvent, nullptr); + mouse_hover_control_ = nullptr; + } +} + void Window::OnNativeMouseMove(const Point& point) { // Find the first control that hit test succeed. const auto new_control_mouse_hover = HitTest(point); @@ -178,11 +191,6 @@ void Window::OnNativeMouseMove(const Point& point) { point); } -void Window::OnNativeMouseLeave() { - DispatchEvent(mouse_hover_control_, &Control::MouseLeaveEvent, nullptr); - mouse_hover_control_ = nullptr; -} - void Window::OnNativeMouseDown(platform::MouseButton button, const Point& point) { Control* control = HitTest(point); |