From 4ac58d91bac0cebe2bdf5e11b9d63b9c41e6b39e Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 15 Nov 2021 16:26:25 +0800 Subject: ... --- include/cru/ui/controls/TextHostControlService.hpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'include/cru/ui/controls') diff --git a/include/cru/ui/controls/TextHostControlService.hpp b/include/cru/ui/controls/TextHostControlService.hpp index adf72d69..da9547ac 100644 --- a/include/cru/ui/controls/TextHostControlService.hpp +++ b/include/cru/ui/controls/TextHostControlService.hpp @@ -8,6 +8,7 @@ #include "cru/ui/helper/ShortcutHub.hpp" #include +#include namespace cru::ui::render { class TextRenderObject; @@ -29,6 +30,8 @@ class TextControlMovePattern : public Object { public: static TextControlMovePattern kLeft; static TextControlMovePattern kRight; + static TextControlMovePattern kCtrlLeft; + static TextControlMovePattern kCtrlRight; static TextControlMovePattern kUp; static TextControlMovePattern kDown; static TextControlMovePattern kHome; @@ -36,6 +39,8 @@ class TextControlMovePattern : public Object { static TextControlMovePattern kPageUp; static TextControlMovePattern kPageDown; + static std::vector kDefaultPatterns; + using MoveFunction = std::function; @@ -44,15 +49,15 @@ class TextControlMovePattern : public Object { MoveFunction move_function) : key_bind_(key_bind), move_function_(move_function) {} - CRU_DELETE_COPY(TextControlMovePattern) - CRU_DELETE_MOVE(TextControlMovePattern) + CRU_DEFAULT_COPY(TextControlMovePattern) + CRU_DEFAULT_MOVE(TextControlMovePattern) ~TextControlMovePattern() override = default; public: helper::ShortcutKeyBind GetKeyBind() const { return key_bind_; } gsl::index Move(TextHostControlService* service, StringView text, - gsl::index current_position) { + gsl::index current_position) const { return move_function_(service, text, current_position); } @@ -118,10 +123,10 @@ class TextHostControlService : public Object { void ScrollToCaret(); - private: gsl::not_null GetTextRenderObject(); render::ScrollRenderObject* GetScrollRenderObject(); + private: // May return nullptr. platform::gui::IInputMethodContext* GetInputMethodContext(); -- cgit v1.2.3