diff options
author | crupest <crupest@outlook.com> | 2020-04-02 23:00:34 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-04-02 23:00:34 +0800 |
commit | ee61633d81cc9e34c3bd8b5fbfb6a5a25a1f3ea5 (patch) | |
tree | b2cf74e5ff45ebe5604bb3ffb189d2d2bd1406df /include/cru/platform/native/input_method.hpp | |
parent | 7fd9ca808c908c67d9bec2183034ad16ea86a912 (diff) | |
download | cru-ee61633d81cc9e34c3bd8b5fbfb6a5a25a1f3ea5.tar.gz cru-ee61633d81cc9e34c3bd8b5fbfb6a5a25a1f3ea5.tar.bz2 cru-ee61633d81cc9e34c3bd8b5fbfb6a5a25a1f3ea5.zip |
...
Diffstat (limited to 'include/cru/platform/native/input_method.hpp')
-rw-r--r-- | include/cru/platform/native/input_method.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/cru/platform/native/input_method.hpp b/include/cru/platform/native/input_method.hpp new file mode 100644 index 00000000..ecc47fd8 --- /dev/null +++ b/include/cru/platform/native/input_method.hpp @@ -0,0 +1,30 @@ +#pragma once +#include "../resource.hpp" +#include "base.hpp" +#include "cru/common/event.hpp" + +#include <memory> + +namespace cru::platform::native { +// It is a reference, so there is a ref count, remember to destroy it to release +// the ref after use. +struct IInputMethodContextRef : INativeResource { + // Reset composition string. Use this method to prepare typing. + virtual void Reset() = 0; + // Get the composition string. + virtual std::string GetCompositionString() = 0; + // Set the candidate window lefttop. Use this method to prepare typing. + virtual void SetCandidateWindowPosition(const Point& point); + // Triggered every time composition text changes, evet args is the new + // composition text. + virtual IEvent<std::string>* CompositionTextChangeEvent() = 0; + // User comfirmed compostition. Use this method to get the final input text. + virtual IEvent<std::string>* CharEvent() = 0; +}; + +struct IInputMethodManager : INativeResource { + // Get a reference of context of a window. + virtual std::unique_ptr<IInputMethodContextRef> GetContext( + INativeWindow* window) = 0; +}; +} // namespace cru::platform::native |