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/platform/native/input_method.hpp | |
parent | f3a8fd608a9776ef0a5f547da918a32cf6074060 (diff) | |
download | cru-d86a71f79afe0e4dac768f61d6bff690567aca5b.tar.gz cru-d86a71f79afe0e4dac768f61d6bff690567aca5b.tar.bz2 cru-d86a71f79afe0e4dac768f61d6bff690567aca5b.zip |
...
Diffstat (limited to 'include/cru/platform/native/input_method.hpp')
-rw-r--r-- | include/cru/platform/native/input_method.hpp | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/include/cru/platform/native/input_method.hpp b/include/cru/platform/native/input_method.hpp deleted file mode 100644 index bcf030b4..00000000 --- a/include/cru/platform/native/input_method.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once -#include "../resource.hpp" -#include "base.hpp" - -#include "cru/common/event.hpp" - -#include <iostream> -#include <memory> -#include <vector> - -namespace cru::platform::native { -struct CompositionClause { - int start; - int end; - bool target; -}; - -using CompositionClauses = std::vector<CompositionClause>; - -struct CompositionText { - std::string text; - CompositionClauses clauses; - TextRange selection; -}; - -inline std::ostream& operator<<(std::ostream& stream, - const CompositionText& composition_text) { - stream << "text: " << composition_text.text << "\n" - << "clauses:\n"; - for (int i = 0; i < static_cast<int>(composition_text.clauses.size()); i++) { - const auto& clause = composition_text.clauses[i]; - stream << "\t" << i << ". start:" << clause.start << " end:" << clause.end; - if (clause.target) { - stream << " target"; - } - stream << "\n"; - } - stream << "selection: position:" << composition_text.selection.position - << " count:" << composition_text.selection.count; - return stream; -} - -struct IInputMethodContext : virtual INativeResource { - // Return true if you should draw composition text manually. Return false if - // system will take care of that for you. - virtual bool ShouldManuallyDrawCompositionText() = 0; - - virtual void EnableIME() = 0; - - virtual void DisableIME() = 0; - - virtual void CompleteComposition() = 0; - - virtual void CancelComposition() = 0; - - virtual CompositionText GetCompositionText() = 0; - - // Set the candidate window lefttop. Use this method to prepare typing. - virtual void SetCandidateWindowPosition(const Point& point) = 0; - - // Triggered when user starts composition. - virtual IEvent<std::nullptr_t>* CompositionStartEvent() = 0; - - // Triggered when user stops composition. - virtual IEvent<std::nullptr_t>* CompositionEndEvent() = 0; - - // Triggered every time composition text changes. - virtual IEvent<std::nullptr_t>* CompositionEvent() = 0; - - virtual IEvent<std::string_view>* TextEvent() = 0; -}; - -struct IInputMethodManager : virtual INativeResource { - virtual std::unique_ptr<IInputMethodContext> GetContext( - INativeWindow* window) = 0; -}; -} // namespace cru::platform::native |