diff options
author | Yuqian Yang <crupest@outlook.com> | 2018-09-23 16:48:18 +0000 |
---|---|---|
committer | Yuqian Yang <crupest@outlook.com> | 2018-09-23 16:48:18 +0000 |
commit | 001e1d955132a02a2f7effc841ab9e5ee425eda1 (patch) | |
tree | 1bfbdcc2a25316d6e85cc9b4527a1ec15841b502 /CruUI/ui/window.cpp | |
parent | 796ba6e1e816ec87a106f2f7b501e38c99f059e1 (diff) | |
parent | 9049f7674e0808cc3676543e0a95330a1657d10e (diff) | |
download | cru-001e1d955132a02a2f7effc841ab9e5ee425eda1.tar.gz cru-001e1d955132a02a2f7effc841ab9e5ee425eda1.tar.bz2 cru-001e1d955132a02a2f7effc841ab9e5ee425eda1.zip |
Merge branch 'textboxdev' into 'master'
TextBox develop.
See merge request crupest/CruUI!2
Diffstat (limited to 'CruUI/ui/window.cpp')
-rw-r--r-- | CruUI/ui/window.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/CruUI/ui/window.cpp b/CruUI/ui/window.cpp index 6ff962b6..34a54512 100644 --- a/CruUI/ui/window.cpp +++ b/CruUI/ui/window.cpp @@ -204,8 +204,7 @@ namespace cru if (!native_message_event.IsNoHandler()) { - const events::WindowNativeMessage message{hwnd, msg, w_param, l_param}; - events::WindowNativeMessageEventArgs args(this, this, message); + events::WindowNativeMessageEventArgs args(this, this, {hwnd, msg, w_param, l_param}); native_message_event.Raise(args); if (args.GetResult().has_value()) { @@ -293,6 +292,18 @@ namespace cru result = 0; return true; } + case WM_KEYDOWN: + OnKeyDownInternal(static_cast<int>(w_param)); + result = 0; + return true; + case WM_KEYUP: + OnKeyUpInternal(static_cast<int>(w_param)); + result = 0; + return true; + case WM_CHAR: + OnCharInternal(static_cast<wchar_t>(w_param)); + result = 0; + return true; case WM_SIZE: OnResizeInternal(LOWORD(l_param), HIWORD(l_param)); result = 0; @@ -553,6 +564,21 @@ namespace cru DispatchEvent(control, &Control::RaiseMouseUpEvent, nullptr, dip_point, button); } + void Window::OnKeyDownInternal(int virtual_code) + { + DispatchEvent(focus_control_, &Control::RaiseKeyDownEvent, nullptr, virtual_code); + } + + void Window::OnKeyUpInternal(int virtual_code) + { + DispatchEvent(focus_control_, &Control::RaiseKeyUpEvent, nullptr, virtual_code); + } + + void Window::OnCharInternal(wchar_t c) + { + DispatchEvent(focus_control_, &Control::RaiseCharEvent, nullptr, c); + } + void Window::OnActivatedInternal() { events::UiEventArgs args(this, this); |