From 5c805e494425a88da1813902b1ad8a1ab351e30d Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 5 Jul 2020 23:06:02 +0800 Subject: ... --- include/cru/ui/ClickDetector.hpp | 2 +- include/cru/ui/Control.hpp | 2 +- include/cru/ui/UiEvent.hpp | 6 +++--- include/cru/ui/UiHost.hpp | 2 +- include/cru/ui/Window.hpp | 4 ++-- include/cru/ui/controls/Button.hpp | 4 ++-- include/cru/ui/controls/Container.hpp | 4 ++-- include/cru/ui/controls/FlexLayout.hpp | 4 ++-- include/cru/ui/controls/StackLayout.hpp | 4 ++-- include/cru/ui/controls/TextBlock.hpp | 8 ++++---- include/cru/ui/controls/TextBox.hpp | 4 ++-- include/cru/ui/render/BorderRenderObject.hpp | 2 +- include/cru/ui/render/FlexLayoutRenderObject.hpp | 2 +- include/cru/ui/render/LayoutHelper.hpp | 4 ++-- include/cru/ui/render/RenderObject.hpp | 2 +- include/cru/ui/render/StackLayoutRenderObject.hpp | 2 +- include/cru/ui/render/TextRenderObject.hpp | 6 +++--- 17 files changed, 31 insertions(+), 31 deletions(-) (limited to 'include/cru/ui') diff --git a/include/cru/ui/ClickDetector.hpp b/include/cru/ui/ClickDetector.hpp index 3977fb8e..4ffe5d05 100644 --- a/include/cru/ui/ClickDetector.hpp +++ b/include/cru/ui/ClickDetector.hpp @@ -36,7 +36,7 @@ enum class ClickState { }; class ClickDetector : public Object { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::ClickDetector") + CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::ClickDetector") public: explicit ClickDetector(Control* control); diff --git a/include/cru/ui/Control.hpp b/include/cru/ui/Control.hpp index 347163be..bd86bc2f 100644 --- a/include/cru/ui/Control.hpp +++ b/include/cru/ui/Control.hpp @@ -22,7 +22,7 @@ class Control : public Object { ~Control() override = default; public: - virtual std::string_view GetControlType() const = 0; + virtual std::u16string_view GetControlType() const = 0; //*************** region: tree *************** public: diff --git a/include/cru/ui/UiEvent.hpp b/include/cru/ui/UiEvent.hpp index 39f26aee..5adace8a 100644 --- a/include/cru/ui/UiEvent.hpp +++ b/include/cru/ui/UiEvent.hpp @@ -212,7 +212,7 @@ class KeyEventArgs : public UiEventArgs { class CharEventArgs : public UiEventArgs { public: - CharEventArgs(Object* sender, Object* original_sender, std::string c) + CharEventArgs(Object* sender, Object* original_sender, std::u16string c) : UiEventArgs(sender, original_sender), c_(std::move(c)) {} CharEventArgs(const CharEventArgs& other) = default; CharEventArgs(CharEventArgs&& other) = default; @@ -220,9 +220,9 @@ class CharEventArgs : public UiEventArgs { CharEventArgs& operator=(CharEventArgs&& other) = default; ~CharEventArgs() override = default; - std::string GetChar() const { return c_; } + std::u16string GetChar() const { return c_; } private: - std::string c_; + std::u16string c_; }; } // namespace cru::ui::event diff --git a/include/cru/ui/UiHost.hpp b/include/cru/ui/UiHost.hpp index 1a5c6302..b1658ef6 100644 --- a/include/cru/ui/UiHost.hpp +++ b/include/cru/ui/UiHost.hpp @@ -32,7 +32,7 @@ struct AfterLayoutEventArgs {}; // 4. Delete Window when deleting_ is false and IsRetainAfterDestroy is false in // OnNativeDestroy. class UiHost : public Object, public SelfResolvable { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::UiHost") + CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::UiHost") public: // This will create root window render object and attach it to window. diff --git a/include/cru/ui/Window.hpp b/include/cru/ui/Window.hpp index eb2ecfbb..450ea97b 100644 --- a/include/cru/ui/Window.hpp +++ b/include/cru/ui/Window.hpp @@ -6,7 +6,7 @@ class Window final : public ContentControl { friend UiHost; public: - static constexpr std::string_view control_type = "Window"; + static constexpr std::u16string_view control_type = u"Window"; public: static Window* CreateOverlapped(); @@ -24,7 +24,7 @@ class Window final : public ContentControl { ~Window() override; public: - std::string_view GetControlType() const final; + std::u16string_view GetControlType() const final; render::RenderObject* GetRenderObject() const override; diff --git a/include/cru/ui/controls/Button.hpp b/include/cru/ui/controls/Button.hpp index 8a11409c..a4f727d6 100644 --- a/include/cru/ui/controls/Button.hpp +++ b/include/cru/ui/controls/Button.hpp @@ -7,7 +7,7 @@ namespace cru::ui::controls { class Button : public ContentControl { public: - static constexpr std::string_view control_type = "Button"; + static constexpr std::u16string_view control_type = u"Button"; static Button* Create() { return new Button(); } @@ -21,7 +21,7 @@ class Button : public ContentControl { Button& operator=(Button&& other) = delete; ~Button() override; - std::string_view GetControlType() const final { return control_type; } + std::u16string_view GetControlType() const final { return control_type; } render::RenderObject* GetRenderObject() const override; diff --git a/include/cru/ui/controls/Container.hpp b/include/cru/ui/controls/Container.hpp index e3d78365..304d402c 100644 --- a/include/cru/ui/controls/Container.hpp +++ b/include/cru/ui/controls/Container.hpp @@ -3,7 +3,7 @@ namespace cru::ui::controls { class Container : public ContentControl { - static constexpr std::string_view control_type = "Container"; + static constexpr std::u16string_view control_type = u"Container"; protected: Container(); @@ -15,7 +15,7 @@ class Container : public ContentControl { ~Container() override; public: - std::string_view GetControlType() const final { return control_type; } + std::u16string_view GetControlType() const final { return control_type; } render::RenderObject* GetRenderObject() const override; diff --git a/include/cru/ui/controls/FlexLayout.hpp b/include/cru/ui/controls/FlexLayout.hpp index 3d6087c2..87162569 100644 --- a/include/cru/ui/controls/FlexLayout.hpp +++ b/include/cru/ui/controls/FlexLayout.hpp @@ -4,7 +4,7 @@ namespace cru::ui::controls { class FlexLayout : public LayoutControl { public: - static constexpr std::string_view control_type = "FlexLayout"; + static constexpr std::u16string_view control_type = u"FlexLayout"; static FlexLayout* Create() { return new FlexLayout(); } @@ -18,7 +18,7 @@ class FlexLayout : public LayoutControl { FlexLayout& operator=(FlexLayout&& other) = delete; ~FlexLayout() override; - std::string_view GetControlType() const final { return control_type; } + std::u16string_view GetControlType() const final { return control_type; } render::RenderObject* GetRenderObject() const override; diff --git a/include/cru/ui/controls/StackLayout.hpp b/include/cru/ui/controls/StackLayout.hpp index d5998cc4..c0b95044 100644 --- a/include/cru/ui/controls/StackLayout.hpp +++ b/include/cru/ui/controls/StackLayout.hpp @@ -4,7 +4,7 @@ namespace cru::ui::controls { class StackLayout : public LayoutControl { public: - static constexpr std::string_view control_type = "StackLayout"; + static constexpr std::u16string_view control_type = u"StackLayout"; static StackLayout* Create() { return new StackLayout(); } @@ -17,7 +17,7 @@ class StackLayout : public LayoutControl { ~StackLayout() override; - std::string_view GetControlType() const final { return control_type; } + std::u16string_view GetControlType() const final { return control_type; } render::RenderObject* GetRenderObject() const override; diff --git a/include/cru/ui/controls/TextBlock.hpp b/include/cru/ui/controls/TextBlock.hpp index 1b1b4a5c..8a9a3bff 100644 --- a/include/cru/ui/controls/TextBlock.hpp +++ b/include/cru/ui/controls/TextBlock.hpp @@ -7,7 +7,7 @@ class TextControlService; class TextBlock : public NoChildControl { public: - static constexpr std::string_view control_type = "TextBlock"; + static constexpr std::u16string_view control_type = u"TextBlock"; static TextBlock* Create() { return new TextBlock(); } @@ -21,12 +21,12 @@ class TextBlock : public NoChildControl { TextBlock& operator=(TextBlock&& other) = delete; ~TextBlock() override; - std::string_view GetControlType() const final { return control_type; } + std::u16string_view GetControlType() const final { return control_type; } render::RenderObject* GetRenderObject() const override; - std::string GetText() const; - void SetText(std::string text); + std::u16string GetText() const; + void SetText(std::u16string text); gsl::not_null GetTextRenderObject(); render::ScrollRenderObject* GetScrollRenderObject() { return nullptr; } diff --git a/include/cru/ui/controls/TextBox.hpp b/include/cru/ui/controls/TextBox.hpp index 3d4de7c0..5976f6da 100644 --- a/include/cru/ui/controls/TextBox.hpp +++ b/include/cru/ui/controls/TextBox.hpp @@ -10,7 +10,7 @@ class TextControlService; class TextBox : public NoChildControl { public: - static constexpr std::string_view control_type = "TextBox"; + static constexpr std::u16string_view control_type = u"TextBox"; static TextBox* Create() { return new TextBox(); } @@ -23,7 +23,7 @@ class TextBox : public NoChildControl { ~TextBox() override; - std::string_view GetControlType() const final { return control_type; } + std::u16string_view GetControlType() const final { return control_type; } render::RenderObject* GetRenderObject() const override; diff --git a/include/cru/ui/render/BorderRenderObject.hpp b/include/cru/ui/render/BorderRenderObject.hpp index 94e888d4..587f051a 100644 --- a/include/cru/ui/render/BorderRenderObject.hpp +++ b/include/cru/ui/render/BorderRenderObject.hpp @@ -3,7 +3,7 @@ namespace cru::ui::render { class BorderRenderObject : public RenderObject { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render::BorderRenderObject") + CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::render::BorderRenderObject") public: BorderRenderObject(); diff --git a/include/cru/ui/render/FlexLayoutRenderObject.hpp b/include/cru/ui/render/FlexLayoutRenderObject.hpp index 87a41c7e..ee29d1e4 100644 --- a/include/cru/ui/render/FlexLayoutRenderObject.hpp +++ b/include/cru/ui/render/FlexLayoutRenderObject.hpp @@ -74,7 +74,7 @@ namespace cru::ui::render { // and just fill the rest space with blank. // class FlexLayoutRenderObject : public LayoutRenderObject { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render::FlexLayoutRenderObject") + CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::render::FlexLayoutRenderObject") public: FlexLayoutRenderObject() = default; diff --git a/include/cru/ui/render/LayoutHelper.hpp b/include/cru/ui/render/LayoutHelper.hpp index 3469ccf0..518dc5a3 100644 --- a/include/cru/ui/render/LayoutHelper.hpp +++ b/include/cru/ui/render/LayoutHelper.hpp @@ -9,6 +9,6 @@ float CalculateAnchorByAlignment(Alignment alignment, float start_point, MeasureLength StackLayoutCalculateChildMaxLength( MeasureLength parent_preferred_size, MeasureLength parent_max_size, - MeasureLength child_min_size, std::string_view log_tag, - std::string_view exceeds_message); + MeasureLength child_min_size, std::u16string_view log_tag, + std::u16string_view exceeds_message); } // namespace cru::ui::render diff --git a/include/cru/ui/render/RenderObject.hpp b/include/cru/ui/render/RenderObject.hpp index 2e784afc..f820f029 100644 --- a/include/cru/ui/render/RenderObject.hpp +++ b/include/cru/ui/render/RenderObject.hpp @@ -37,7 +37,7 @@ namespace cru::ui::render { class RenderObject : public Object { friend WindowRenderObject; - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render::RenderObject") + CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::render::RenderObject") protected: enum class ChildMode { diff --git a/include/cru/ui/render/StackLayoutRenderObject.hpp b/include/cru/ui/render/StackLayoutRenderObject.hpp index 534d7f22..303241c5 100644 --- a/include/cru/ui/render/StackLayoutRenderObject.hpp +++ b/include/cru/ui/render/StackLayoutRenderObject.hpp @@ -23,7 +23,7 @@ namespace cru::ui::render { // to min size. class StackLayoutRenderObject : public LayoutRenderObject { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render:StackLayoutRenderObject") + CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::render:StackLayoutRenderObject") public: StackLayoutRenderObject() = default; diff --git a/include/cru/ui/render/TextRenderObject.hpp b/include/cru/ui/render/TextRenderObject.hpp index 77a92b4f..32d96797 100644 --- a/include/cru/ui/render/TextRenderObject.hpp +++ b/include/cru/ui/render/TextRenderObject.hpp @@ -18,7 +18,7 @@ namespace cru::ui::render { // If the result layout box is bigger than actual text box, then text is center // aligned. class TextRenderObject : public RenderObject { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render::TextRenderObject") + CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::render::TextRenderObject") public: constexpr static float default_caret_width = 2; @@ -34,8 +34,8 @@ class TextRenderObject : public RenderObject { TextRenderObject& operator=(TextRenderObject&& other) = delete; ~TextRenderObject() override; - std::string GetText() const; - void SetText(std::string new_text); + std::u16string GetText() const; + void SetText(std::u16string new_text); std::shared_ptr GetBrush() const { return brush_; } void SetBrush(std::shared_ptr new_brush); -- cgit v1.2.3