diff options
author | crupest <crupest@outlook.com> | 2022-02-10 19:49:06 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-10 19:49:06 +0800 |
commit | c1dbad5fdf0560983e6c832eddded6f610eae94e (patch) | |
tree | 40f22f7e6aa7ef39c49b1c007beed37130fc0b5d /include/cru/ui/controls | |
parent | b2622f654598f82a220a98daaa84fed9ce3b92b2 (diff) | |
download | cru-c1dbad5fdf0560983e6c832eddded6f610eae94e.tar.gz cru-c1dbad5fdf0560983e6c832eddded6f610eae94e.tar.bz2 cru-c1dbad5fdf0560983e6c832eddded6f610eae94e.zip |
...
Diffstat (limited to 'include/cru/ui/controls')
-rw-r--r-- | include/cru/ui/controls/Button.h | 6 | ||||
-rw-r--r-- | include/cru/ui/controls/Container.h | 4 | ||||
-rw-r--r-- | include/cru/ui/controls/FlexLayout.h | 6 | ||||
-rw-r--r-- | include/cru/ui/controls/Popup.h | 4 | ||||
-rw-r--r-- | include/cru/ui/controls/ScrollView.h | 6 | ||||
-rw-r--r-- | include/cru/ui/controls/StackLayout.h | 6 | ||||
-rw-r--r-- | include/cru/ui/controls/TextBlock.h | 12 | ||||
-rw-r--r-- | include/cru/ui/controls/TextBox.h | 6 | ||||
-rw-r--r-- | include/cru/ui/controls/TreeView.h | 5 | ||||
-rw-r--r-- | include/cru/ui/controls/Window.h | 8 |
10 files changed, 11 insertions, 52 deletions
diff --git a/include/cru/ui/controls/Button.h b/include/cru/ui/controls/Button.h index d35d7ef8..1828dc57 100644 --- a/include/cru/ui/controls/Button.h +++ b/include/cru/ui/controls/Button.h @@ -15,12 +15,8 @@ class CRU_UI_API Button : public SingleChildControl<render::BorderRenderObject>, public: static constexpr StringView kControlType = u"Button"; - static Button* Create() { return new Button(); } - - protected: - Button(); - public: + Button(); Button(const Button& other) = delete; Button(Button&& other) = delete; Button& operator=(const Button& other) = delete; diff --git a/include/cru/ui/controls/Container.h b/include/cru/ui/controls/Container.h index adb0fad1..3df2b445 100644 --- a/include/cru/ui/controls/Container.h +++ b/include/cru/ui/controls/Container.h @@ -8,10 +8,8 @@ class CRU_UI_API Container : public SingleChildControl<render::BorderRenderObject> { static constexpr StringView kControlType = u"Container"; - protected: - Container(); - public: + Container(); CRU_DELETE_COPY(Container) CRU_DELETE_MOVE(Container) diff --git a/include/cru/ui/controls/FlexLayout.h b/include/cru/ui/controls/FlexLayout.h index 15494742..148586c0 100644 --- a/include/cru/ui/controls/FlexLayout.h +++ b/include/cru/ui/controls/FlexLayout.h @@ -15,12 +15,8 @@ class CRU_UI_API FlexLayout public: static constexpr StringView kControlType = u"FlexLayout"; - static FlexLayout* Create() { return new FlexLayout(); } - - protected: - FlexLayout(); - public: + FlexLayout(); FlexLayout(const FlexLayout& other) = delete; FlexLayout(FlexLayout&& other) = delete; FlexLayout& operator=(const FlexLayout& other) = delete; diff --git a/include/cru/ui/controls/Popup.h b/include/cru/ui/controls/Popup.h index 271ad4b7..464e7278 100644 --- a/include/cru/ui/controls/Popup.h +++ b/include/cru/ui/controls/Popup.h @@ -10,10 +10,6 @@ class CRU_UI_API Popup : public RootControl { public: static constexpr StringView kControlType = u"Popup"; - static Popup* Create(Control* attached_control = nullptr) { - return new Popup(attached_control); - } - explicit Popup(Control* attached_control = nullptr); CRU_DELETE_COPY(Popup) diff --git a/include/cru/ui/controls/ScrollView.h b/include/cru/ui/controls/ScrollView.h index 43b6390c..244977d5 100644 --- a/include/cru/ui/controls/ScrollView.h +++ b/include/cru/ui/controls/ScrollView.h @@ -7,17 +7,11 @@ namespace cru::ui::controls { class CRU_UI_API ScrollView : public SingleChildControl<render::ScrollRenderObject> { public: - static ScrollView* Create() { return new ScrollView(); } - static constexpr StringView kControlType = u"ScrollView"; - protected: ScrollView(); - - public: CRU_DELETE_COPY(ScrollView) CRU_DELETE_MOVE(ScrollView) - ~ScrollView() override; public: diff --git a/include/cru/ui/controls/StackLayout.h b/include/cru/ui/controls/StackLayout.h index 28e0e796..82826171 100644 --- a/include/cru/ui/controls/StackLayout.h +++ b/include/cru/ui/controls/StackLayout.h @@ -9,15 +9,9 @@ class CRU_UI_API StackLayout public: static constexpr StringView kControlType = u"StackLayout"; - static StackLayout* Create() { return new StackLayout(); } - - protected: StackLayout(); - - public: CRU_DELETE_COPY(StackLayout) CRU_DELETE_MOVE(StackLayout) - ~StackLayout() override; String GetControlType() const final { return kControlType.ToString(); } diff --git a/include/cru/ui/controls/TextBlock.h b/include/cru/ui/controls/TextBlock.h index feb5cfa3..dc47d00a 100644 --- a/include/cru/ui/controls/TextBlock.h +++ b/include/cru/ui/controls/TextBlock.h @@ -10,19 +10,19 @@ class CRU_UI_API TextBlock : public NoChildControl, public: static constexpr StringView kControlType = u"TextBlock"; - static TextBlock* Create(); - static TextBlock* Create(String text, bool selectable = false); - - protected: - TextBlock(); - public: + TextBlock(); TextBlock(const TextBlock& other) = delete; TextBlock(TextBlock&& other) = delete; TextBlock& operator=(const TextBlock& other) = delete; TextBlock& operator=(TextBlock&& other) = delete; ~TextBlock() override; + TextBlock(String text, bool selectable = false) : TextBlock() { + SetText(std::move(text)); + SetSelectable(selectable); + } + String GetControlType() const final { return kControlType.ToString(); } render::RenderObject* GetRenderObject() const override; diff --git a/include/cru/ui/controls/TextBox.h b/include/cru/ui/controls/TextBox.h index 0632cc12..94a1ac0c 100644 --- a/include/cru/ui/controls/TextBox.h +++ b/include/cru/ui/controls/TextBox.h @@ -15,15 +15,9 @@ class CRU_UI_API TextBox : public NoChildControl, public: static constexpr StringView control_type = u"TextBox"; - static TextBox* Create() { return new TextBox(); } - - protected: TextBox(); - - public: CRU_DELETE_COPY(TextBox) CRU_DELETE_MOVE(TextBox) - ~TextBox() override; String GetControlType() const final { return control_type.ToString(); } diff --git a/include/cru/ui/controls/TreeView.h b/include/cru/ui/controls/TreeView.h index 2e782ee0..b36ca553 100644 --- a/include/cru/ui/controls/TreeView.h +++ b/include/cru/ui/controls/TreeView.h @@ -7,13 +7,10 @@ class TreeView; class CRU_UI_API TreeViewItem : public Object { friend TreeView; - private: - TreeViewItem(TreeView* tree_view, TreeViewItem* parent); - public: + TreeViewItem(TreeView* tree_view, TreeViewItem* parent); CRU_DELETE_COPY(TreeViewItem) CRU_DELETE_MOVE(TreeViewItem) - ~TreeViewItem() override; TreeView* GetTreeView() { return tree_view_; } diff --git a/include/cru/ui/controls/Window.h b/include/cru/ui/controls/Window.h index 5fb6d594..a1a97f87 100644 --- a/include/cru/ui/controls/Window.h +++ b/include/cru/ui/controls/Window.h @@ -10,15 +10,9 @@ class CRU_UI_API Window final : public RootControl { static constexpr StringView control_type = u"Window"; public: - static Window* Create(Control* attached_control = nullptr); - - private: - explicit Window(Control* attached_control); - - public: + explicit Window(Control* attached_control = nullptr); CRU_DELETE_COPY(Window) CRU_DELETE_MOVE(Window) - ~Window() override; public: |