From 9dec93315173999c4fb9ab5a0e57909eb5e7fd8b Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 26 Oct 2021 16:32:13 +0800 Subject: ... --- include/cru/ui/controls/TextBlock.hpp | 6 +++--- include/cru/ui/controls/TextHostControlService.hpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'include/cru/ui/controls') diff --git a/include/cru/ui/controls/TextBlock.hpp b/include/cru/ui/controls/TextBlock.hpp index be31816c..b3ce21c5 100644 --- a/include/cru/ui/controls/TextBlock.hpp +++ b/include/cru/ui/controls/TextBlock.hpp @@ -9,7 +9,7 @@ class TextBlock : public NoChildControl, public virtual ITextHostControl { static constexpr std::u16string_view control_type = u"TextBlock"; static TextBlock* Create(); - static TextBlock* Create(std::u16string text, bool selectable = false); + static TextBlock* Create(String text, bool selectable = false); protected: TextBlock(); @@ -25,8 +25,8 @@ class TextBlock : public NoChildControl, public virtual ITextHostControl { render::RenderObject* GetRenderObject() const override; - std::u16string GetText() const; - void SetText(std::u16string text); + String GetText() const; + void SetText(String text); bool IsSelectable() const; void SetSelectable(bool value); diff --git a/include/cru/ui/controls/TextHostControlService.hpp b/include/cru/ui/controls/TextHostControlService.hpp index 84c226ca..b56374dc 100644 --- a/include/cru/ui/controls/TextHostControlService.hpp +++ b/include/cru/ui/controls/TextHostControlService.hpp @@ -8,7 +8,6 @@ #include "cru/ui/helper/ShortcutHub.hpp" #include -#include namespace cru::ui::render { class TextRenderObject; @@ -43,9 +42,10 @@ class TextHostControlService : public Object { void SetEditable(bool editable); String GetText() { return this->text_; } + StringView GetTextView() { return this->text_; } void SetText(String text, bool stop_composition = false); - void InsertText(gsl::index position, std::u16string_view text, + void InsertText(gsl::index position, StringView text, bool stop_composition = false); void DeleteChar(gsl::index position, bool stop_composition = false); @@ -76,7 +76,7 @@ class TextHostControlService : public Object { void DeleteSelectedText(); // If some text is selected, then they are deleted first. Then insert text // into caret position. - void ReplaceSelectedText(std::u16string_view text); + void ReplaceSelectedText(StringView text); void ScrollToCaret(); -- cgit v1.2.3