diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-10-17 12:06:14 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-10-17 12:06:14 +0800 |
commit | 32aa6f116acc6e3e20a1ec76cef45b29f7005ad7 (patch) | |
tree | 892b71060a88b58d9293d78033000b05818783df /include/cru/ui/components | |
parent | faf77949e19dc0d01f75bf8abb783eda70328048 (diff) | |
download | cru-32aa6f116acc6e3e20a1ec76cef45b29f7005ad7.tar.gz cru-32aa6f116acc6e3e20a1ec76cef45b29f7005ad7.tar.bz2 cru-32aa6f116acc6e3e20a1ec76cef45b29f7005ad7.zip |
Remove String stage 1.
Diffstat (limited to 'include/cru/ui/components')
-rw-r--r-- | include/cru/ui/components/Input.h | 14 | ||||
-rw-r--r-- | include/cru/ui/components/Menu.h | 8 | ||||
-rw-r--r-- | include/cru/ui/components/PopupButton.h | 8 | ||||
-rw-r--r-- | include/cru/ui/components/Select.h | 6 |
4 files changed, 18 insertions, 18 deletions
diff --git a/include/cru/ui/components/Input.h b/include/cru/ui/components/Input.h index e808afd7..0f077983 100644 --- a/include/cru/ui/components/Input.h +++ b/include/cru/ui/components/Input.h @@ -5,17 +5,17 @@ namespace cru::ui::components { struct CRU_UI_API InputValidateResult { bool valid; - String message; + std::string message; }; struct CRU_UI_API IInputValidator : public virtual Interface { - virtual InputValidateResult Validate(StringView text) const = 0; + virtual InputValidateResult Validate(std::string_view text) const = 0; }; struct CRU_UI_API InputChangeEventArgs { - String text; + std::string text; bool valid; - String message; + std::string message; }; class CRU_UI_API Input : public Component { @@ -26,8 +26,8 @@ class CRU_UI_API Input : public Component { public: controls::Control* GetRootControl() override; - String GetText() const; - void SetText(String text); + std::string GetText() const; + void SetText(std::string text); IInputValidator* GetValidator() const; void SetValidator(IInputValidator* validator); @@ -48,7 +48,7 @@ class CRU_UI_API Input : public Component { class CRU_UI_API FloatInputValidator : public Object, public virtual IInputValidator { public: - InputValidateResult Validate(StringView text) const override; + InputValidateResult Validate(std::string_view text) const override; std::optional<float> min; std::optional<float> max; diff --git a/include/cru/ui/components/Menu.h b/include/cru/ui/components/Menu.h index 913f5c92..554a8898 100644 --- a/include/cru/ui/components/Menu.h +++ b/include/cru/ui/components/Menu.h @@ -14,7 +14,7 @@ namespace cru::ui::components { class CRU_UI_API MenuItem : public Component { public: MenuItem(); - explicit MenuItem(String text); + explicit MenuItem(std::string text); CRU_DELETE_COPY(MenuItem) CRU_DELETE_MOVE(MenuItem) @@ -24,7 +24,7 @@ class CRU_UI_API MenuItem : public Component { public: controls::Control* GetRootControl() override { return &container_; } - void SetText(String text); + void SetText(std::string text); void SetOnClick(std::function<void()> on_click) { on_click_ = std::move(on_click); @@ -55,10 +55,10 @@ class CRU_UI_API Menu : public Component { Component* RemoveItemAt(Index index); void ClearItems(); - void AddTextItem(String text, std::function<void()> on_click) { + void AddTextItem(std::string text, std::function<void()> on_click) { AddTextItemAt(std::move(text), GetItemCount(), std::move(on_click)); } - void AddTextItemAt(String text, Index index, std::function<void()> on_click); + void AddTextItemAt(std::string text, Index index, std::function<void()> on_click); void SetOnItemClick(std::function<void(Index)> on_item_click) { on_item_click_ = std::move(on_item_click); diff --git a/include/cru/ui/components/PopupButton.h b/include/cru/ui/components/PopupButton.h index c8ef9c50..5fa69044 100644 --- a/include/cru/ui/components/PopupButton.h +++ b/include/cru/ui/components/PopupButton.h @@ -18,14 +18,14 @@ class CRU_UI_API PopupMenuTextButton : public Component { ui::controls::Button* GetButton() { return &button_; } - String GetButtonText() { return button_text_.GetText(); } - void SetButtonText(String text) { button_text_.SetText(std::move(text)); } + std::string GetButtonText() { return button_text_.GetText(); } + void SetButtonText(std::string text) { button_text_.SetText(std::move(text)); } void SetButtonTextColor(const Color& color) { button_text_.SetTextColor(color); } - void SetMenuItems(std::vector<String> items); + void SetMenuItems(std::vector<std::string> items); IEvent<Index>* MenuItemSelectedEvent() { return &menu_item_selected_event_; } @@ -47,7 +47,7 @@ class CRU_UI_API PopupMenuIconButton : public Component { ui::controls::IconButton* GetButton() { return &button_; } - void SetMenuItems(std::vector<String> items); + void SetMenuItems(std::vector<std::string> items); IEvent<Index>* MenuItemSelectedEvent() { return &menu_item_selected_event_; } diff --git a/include/cru/ui/components/Select.h b/include/cru/ui/components/Select.h index d5ff0b43..9efe9a04 100644 --- a/include/cru/ui/components/Select.h +++ b/include/cru/ui/components/Select.h @@ -13,8 +13,8 @@ class CRU_UI_API Select : public Component { public: ui::controls::Control* GetRootControl() override { return &button_; } - std::vector<String> GetItems() const { return items_; } - void SetItems(std::vector<String> items); + std::vector<std::string> GetItems() const { return items_; } + void SetItems(std::vector<std::string> items); Index GetSelectedIndex() const { return selected_index_; } void SetSelectedIndex(Index index); @@ -23,7 +23,7 @@ class CRU_UI_API Select : public Component { private: Index selected_index_; - std::vector<String> items_; + std::vector<std::string> items_; ui::controls::Button button_; ui::controls::TextBlock button_text_; |