diff options
author | crupest <crupest@outlook.com> | 2020-04-05 00:04:05 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-04-05 00:04:05 +0800 |
commit | 37bb421e963662e8203acbe3a03bdbd5d1f5858e (patch) | |
tree | 400af7a9d378be209158eda8ca8adeced60b0cc8 /include/cru/win | |
parent | ee61633d81cc9e34c3bd8b5fbfb6a5a25a1f3ea5 (diff) | |
download | cru-37bb421e963662e8203acbe3a03bdbd5d1f5858e.tar.gz cru-37bb421e963662e8203acbe3a03bdbd5d1f5858e.tar.bz2 cru-37bb421e963662e8203acbe3a03bdbd5d1f5858e.zip |
...
Diffstat (limited to 'include/cru/win')
-rw-r--r-- | include/cru/win/native/input_method.hpp | 19 | ||||
-rw-r--r-- | include/cru/win/native/window_native_message_event_args.hpp | 4 |
2 files changed, 17 insertions, 6 deletions
diff --git a/include/cru/win/native/input_method.hpp b/include/cru/win/native/input_method.hpp index 3ea16709..2e09aac4 100644 --- a/include/cru/win/native/input_method.hpp +++ b/include/cru/win/native/input_method.hpp @@ -2,6 +2,7 @@ #include "resource.hpp" #include "cru/platform/native/input_method.hpp" +#include "window_native_message_event_args.hpp" #include <imm.h> @@ -20,23 +21,33 @@ class WinInputMethodContextRef : public WinNativeResource, ::HIMC GetHandle() const { return handle_; } + bool ShouldManuallyDrawCompositionText() override { return true; } + void Reset() override; - std::string GetCompositionString() override; + std::string GetCompositionText() override; void SetCandidateWindowPosition(const Point& point) override; + IEvent<std::nullptr_t>* CompositionStartEvent() override; + + IEvent<std::nullptr_t>* CompositionEndEvent() override; + IEvent<std::string>* CompositionTextChangeEvent() override; - IEvent<std::string>* CharEvent() override; + private: + void OnWindowNativeMessage(WindowNativeMessageEventArgs& args); private: - WinNativeWindow* window_; + [[maybe_unused]] WinNativeWindow* window_; + + std::vector<EventRevokerGuard> event_revoker_guards_; ::HWND window_handle_; ::HIMC handle_; + Event<std::nullptr_t> composition_start_event_; + Event<std::nullptr_t> composition_end_event_; Event<std::string> composition_text_change_event_; - Event<std::string> char_event_; }; } // namespace cru::platform::native::win diff --git a/include/cru/win/native/window_native_message_event_args.hpp b/include/cru/win/native/window_native_message_event_args.hpp index 18de1f46..f5476735 100644 --- a/include/cru/win/native/window_native_message_event_args.hpp +++ b/include/cru/win/native/window_native_message_event_args.hpp @@ -19,7 +19,7 @@ class WindowNativeMessageEventArgs : public Object { CRU_DEFAULT_MOVE(WindowNativeMessageEventArgs) ~WindowNativeMessageEventArgs() override = default; - WindowNativeMessage GetWindowMessage() const { return message_; } + const WindowNativeMessage& GetWindowMessage() const { return message_; } LRESULT GetResult() const { return result_; } void SetResult(LRESULT result) { result_ = result; } @@ -27,7 +27,7 @@ class WindowNativeMessageEventArgs : public Object { bool IsHandled() const { return handled_; } void SetHandled(bool handled) { handled_ = handled; } - void HandledAndSetResult(LRESULT result) { + void HandleWithResult(LRESULT result) { handled_ = true; result_ = result; } |