diff options
Diffstat (limited to 'src/ui/window.cpp')
-rw-r--r-- | src/ui/window.cpp | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/src/ui/window.cpp b/src/ui/window.cpp index 347a7a49..291f6fb6 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -105,26 +105,36 @@ Window::Window(tag_overlapped_constructor) { platform::native::UiApplication::GetInstance()->CreateWindow(nullptr); render_object_.reset(new render::WindowRenderObject(this)); - event_revoker_guard_.Add(native_window_->DestroyEvent()->AddHandler( - std::bind(&Window::OnNativeDestroy, this))); - event_revoker_guard_.Add(native_window_->PaintEvent()->AddHandler( - std::bind(&Window::OnNativePaint, this))); - event_revoker_guard_.Add(native_window_->ResizeEvent()->AddHandler( - std::bind(&Window::OnNativeResize, this, _1))); - event_revoker_guard_.Add(native_window_->FocusEvent()->AddHandler( - std::bind(&Window::OnNativeFocus, this, _1))); - event_revoker_guard_.Add(native_window_->MouseEnterLeaveEvent()->AddHandler( - std::bind(&Window::OnNativeMouseEnterLeave, this, _1))); - event_revoker_guard_.Add(native_window_->MouseMoveEvent()->AddHandler( - std::bind(&Window::OnNativeMouseMove, this, _1))); - event_revoker_guard_.Add(native_window_->MouseDownEvent()->AddHandler( - std::bind(&Window::OnNativeMouseDown, this, _1, _2))); - event_revoker_guard_.Add(native_window_->MouseUpEvent()->AddHandler( - std::bind(&Window::OnNativeMouseUp, this, _1, _2))); - event_revoker_guard_.Add(native_window_->KeyDownEvent()->AddHandler( - std::bind(&Window::OnNativeKeyDown, this, _1))); - event_revoker_guard_.Add(native_window_->KeyUpEvent()->AddHandler( - std::bind(&Window::OnNativeKeyUp, this, _1))); + event_revoker_guards_.push_back( + EventRevokerGuard(native_window_->DestroyEvent()->AddHandler( + std::bind(&Window::OnNativeDestroy, this)))); + event_revoker_guards_.push_back( + EventRevokerGuard(native_window_->PaintEvent()->AddHandler( + std::bind(&Window::OnNativePaint, this)))); + event_revoker_guards_.push_back( + EventRevokerGuard(native_window_->ResizeEvent()->AddHandler( + std::bind(&Window::OnNativeResize, this, _1)))); + event_revoker_guards_.push_back( + EventRevokerGuard(native_window_->FocusEvent()->AddHandler( + std::bind(&Window::OnNativeFocus, this, _1)))); + event_revoker_guards_.push_back( + EventRevokerGuard(native_window_->MouseEnterLeaveEvent()->AddHandler( + std::bind(&Window::OnNativeMouseEnterLeave, this, _1)))); + event_revoker_guards_.push_back( + EventRevokerGuard(native_window_->MouseMoveEvent()->AddHandler( + std::bind(&Window::OnNativeMouseMove, this, _1)))); + event_revoker_guards_.push_back( + EventRevokerGuard(native_window_->MouseDownEvent()->AddHandler( + std::bind(&Window::OnNativeMouseDown, this, _1, _2)))); + event_revoker_guards_.push_back( + EventRevokerGuard(native_window_->MouseUpEvent()->AddHandler( + std::bind(&Window::OnNativeMouseUp, this, _1, _2)))); + event_revoker_guards_.push_back( + EventRevokerGuard(native_window_->KeyDownEvent()->AddHandler( + std::bind(&Window::OnNativeKeyDown, this, _1)))); + event_revoker_guards_.push_back( + EventRevokerGuard(native_window_->KeyUpEvent()->AddHandler( + std::bind(&Window::OnNativeKeyUp, this, _1)))); } Window::~Window() { |