diff options
| author | crupest <crupest@outlook.com> | 2020-05-24 01:40:02 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2020-05-24 01:40:02 +0800 |
| commit | d86a71f79afe0e4dac768f61d6bff690567aca5b (patch) | |
| tree | 4957e9a64c77680deb07201fbd879bf036616dae /include/cru/win/native/input_method.hpp | |
| parent | f3a8fd608a9776ef0a5f547da918a32cf6074060 (diff) | |
| download | cru-d86a71f79afe0e4dac768f61d6bff690567aca5b.tar.gz cru-d86a71f79afe0e4dac768f61d6bff690567aca5b.tar.bz2 cru-d86a71f79afe0e4dac768f61d6bff690567aca5b.zip | |
...
Diffstat (limited to 'include/cru/win/native/input_method.hpp')
| -rw-r--r-- | include/cru/win/native/input_method.hpp | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/include/cru/win/native/input_method.hpp b/include/cru/win/native/input_method.hpp deleted file mode 100644 index ff867f3f..00000000 --- a/include/cru/win/native/input_method.hpp +++ /dev/null @@ -1,98 +0,0 @@ -// Some useful information can be found from chromium code: -// https://chromium.googlesource.com/chromium/chromium/+/refs/heads/master/ui/base/win/ime_input.h -// https://chromium.googlesource.com/chromium/chromium/+/refs/heads/master/ui/base/win/ime_input.cc - -#pragma once -#include "resource.hpp" - -#include "cru/platform/native/input_method.hpp" -#include "window_native_message_event_args.hpp" - -#include <imm.h> - -namespace cru::platform::native::win { -class AutoHIMC : public Object { - public: - explicit AutoHIMC(HWND hwnd); - - CRU_DELETE_COPY(AutoHIMC) - - AutoHIMC(AutoHIMC&& other); - AutoHIMC& operator=(AutoHIMC&& other); - - ~AutoHIMC() override; - - HWND GetHwnd() const { return hwnd_; } - - HIMC Get() const { return handle_; } - - private: - HWND hwnd_; - HIMC handle_; -}; - -class WinInputMethodContext : public WinNativeResource, - public virtual IInputMethodContext { - public: - WinInputMethodContext(gsl::not_null<WinNativeWindow*> window); - - CRU_DELETE_COPY(WinInputMethodContext) - CRU_DELETE_MOVE(WinInputMethodContext) - - ~WinInputMethodContext() override; - - bool ShouldManuallyDrawCompositionText() override { return true; } - - void EnableIME() override; - - void DisableIME() override; - - void CompleteComposition() override; - - void CancelComposition() override; - - CompositionText GetCompositionText() override; - - void SetCandidateWindowPosition(const Point& point) override; - - IEvent<std::nullptr_t>* CompositionStartEvent() override; - - IEvent<std::nullptr_t>* CompositionEndEvent() override; - - IEvent<std::nullptr_t>* CompositionEvent() override; - - IEvent<std::string_view>* TextEvent() override; - - private: - void OnWindowNativeMessage(WindowNativeMessageEventArgs& args); - - std::string GetResultString(); - - std::optional<AutoHIMC> TryGetHIMC(); - - private: - std::shared_ptr<INativeWindowResolver> native_window_resolver_; - - std::vector<EventRevokerGuard> event_revoker_guards_; - - Event<std::nullptr_t> composition_start_event_; - Event<std::nullptr_t> composition_end_event_; - Event<std::nullptr_t> composition_event_; - Event<std::string_view> text_event_; -}; - -class WinInputMethodManager : public WinNativeResource, - public virtual IInputMethodManager { - public: - WinInputMethodManager(WinUiApplication* application); - - CRU_DELETE_COPY(WinInputMethodManager) - CRU_DELETE_MOVE(WinInputMethodManager) - - ~WinInputMethodManager() override; - - public: - std::unique_ptr<IInputMethodContext> GetContext( - INativeWindow* window) override; -}; -} // namespace cru::platform::native::win |
