diff options
Diffstat (limited to 'include/cru/ui/controls')
-rw-r--r-- | include/cru/ui/controls/IconButton.h | 6 | ||||
-rw-r--r-- | include/cru/ui/controls/TextBlock.h | 8 | ||||
-rw-r--r-- | include/cru/ui/controls/TextBox.h | 6 | ||||
-rw-r--r-- | include/cru/ui/controls/TextHostControlService.h | 26 |
4 files changed, 23 insertions, 23 deletions
diff --git a/include/cru/ui/controls/IconButton.h b/include/cru/ui/controls/IconButton.h index 632450e2..9dbb3a3d 100644 --- a/include/cru/ui/controls/IconButton.h +++ b/include/cru/ui/controls/IconButton.h @@ -21,7 +21,7 @@ class CRU_UI_API IconButton : public NoChildControl, public: IconButton(); - IconButton(StringView icon_svg_path_data_string, const Rect& view_port); + IconButton(std::string_view icon_svg_path_data_string, const Rect& view_port); ~IconButton() override; String GetControlType() const final { return kControlType.ToString(); } @@ -84,10 +84,10 @@ class CRU_UI_API IconButton : public NoChildControl, } void SetIconFillColor(const Color& color); - void SetIconWithSvgPathDataString(StringView icon_svg_path_data_string, + void SetIconWithSvgPathDataString(std::string_view icon_svg_path_data_string, const Rect& view_port); void SetIconWithSvgPathDataStringResourceKey( - StringView icon_svg_path_data_string_resource_key, const Rect& view_port); + std::string_view icon_svg_path_data_string_resource_key, const Rect& view_port); std::shared_ptr<platform::graphics::IBrush> GetContentBrush() const override { return GetIconFillBrush(); diff --git a/include/cru/ui/controls/TextBlock.h b/include/cru/ui/controls/TextBlock.h index 52e227eb..66330b23 100644 --- a/include/cru/ui/controls/TextBlock.h +++ b/include/cru/ui/controls/TextBlock.h @@ -16,8 +16,8 @@ class CRU_UI_API TextBlock : public NoChildControl, public: static constexpr StringView kControlType = u"TextBlock"; - static std::unique_ptr<TextBlock> Create(String text, - bool selectable = false) { + static std::unique_ptr<TextBlock> Create(std::string text, + bool selectable = false) { auto c = std::make_unique<TextBlock>(); c->SetText(std::move(text)); c->SetSelectable(selectable); @@ -36,8 +36,8 @@ class CRU_UI_API TextBlock : public NoChildControl, render::RenderObject* GetRenderObject() const override; - String GetText() const; - void SetText(String text); + std::string GetText() const; + void SetText(std::string text); bool IsSelectable() const; void SetSelectable(bool value); diff --git a/include/cru/ui/controls/TextBox.h b/include/cru/ui/controls/TextBox.h index 9388d3fd..13f5d356 100644 --- a/include/cru/ui/controls/TextBox.h +++ b/include/cru/ui/controls/TextBox.h @@ -37,9 +37,9 @@ class CRU_UI_API TextBox : public NoChildControl, void ApplyBorderStyle(const style::ApplyBorderStyleInfo& style) override; - String GetText() const { return service_->GetText(); } - StringView GetTextView() const { return service_->GetTextView(); } - void SetText(String text) { service_->SetText(std::move(text)); } + std::string GetText() const { return service_->GetText(); } + std::string_view GetTextView() const { return service_->GetTextView(); } + void SetText(std::string text) { service_->SetText(std::move(text)); } IEvent<std::nullptr_t>* TextChangeEvent() { return service_->TextChangeEvent(); diff --git a/include/cru/ui/controls/TextHostControlService.h b/include/cru/ui/controls/TextHostControlService.h index 95f7a067..a945e427 100644 --- a/include/cru/ui/controls/TextHostControlService.h +++ b/include/cru/ui/controls/TextHostControlService.h @@ -48,10 +48,10 @@ class TextControlMovePattern : public Object { static std::vector<TextControlMovePattern> kDefaultPatterns; using MoveFunction = - std::function<Index(TextHostControlService* service, StringView text, - Index current_position)>; + std::function<Index(TextHostControlService* service, + std::string_view text, Index current_position)>; - TextControlMovePattern(String name, helper::ShortcutKeyBind key_bind, + TextControlMovePattern(std::string name, helper::ShortcutKeyBind key_bind, MoveFunction move_function) : name_(std::move(name)), key_bind_(key_bind), @@ -63,15 +63,15 @@ class TextControlMovePattern : public Object { ~TextControlMovePattern() override = default; public: - String GetName() const { return name_; } + std::string GetName() const { return name_; } helper::ShortcutKeyBind GetKeyBind() const { return key_bind_; } - Index Move(TextHostControlService* service, StringView text, + Index Move(TextHostControlService* service, std::string_view text, Index current_position) const { return move_function_(service, text, current_position); } private: - String name_; + std::string name_; helper::ShortcutKeyBind key_bind_; MoveFunction move_function_; }; @@ -101,11 +101,11 @@ class CRU_UI_API TextHostControlService : public Object { // If text contains line feed characters, it will be converted to space. void SetMultiLine(bool multi_line); - String GetText() { return this->text_; } - StringView GetTextView() { return this->text_; } - void SetText(String text, bool stop_composition = false); + std::string GetText() { return this->text_; } + std::string_view GetTextView() { return this->text_; } + void SetText(std::string text, bool stop_composition = false); - void InsertText(Index position, StringView text, + void InsertText(Index position, std::string_view text, bool stop_composition = false); void DeleteChar(Index position, bool stop_composition = false); @@ -126,7 +126,7 @@ class CRU_UI_API TextHostControlService : public Object { Index GetCaretPosition() { return selection_.GetEnd(); } TextRange GetSelection() { return selection_; } - StringView GetSelectedText(); + std::string_view GetSelectedText(); void SetSelection(Index caret_position); void SetSelection(TextRange selection, bool scroll_to_caret = true); @@ -139,7 +139,7 @@ class CRU_UI_API TextHostControlService : public Object { void DeleteSelectedText(); // If some text is selected, then they are deleted first. Then insert text // into caret position. - void ReplaceSelectedText(StringView text); + void ReplaceSelectedText(std::string_view text); void ScrollToCaret(); @@ -199,7 +199,7 @@ class CRU_UI_API TextHostControlService : public Object { EventRevokerListGuard event_guard_; EventRevokerListGuard input_method_context_event_guard_; - String text_; + std::string text_; TextRange selection_; bool enable_ = false; |