diff options
Diffstat (limited to 'include/cru/ui/controls')
-rw-r--r-- | include/cru/ui/controls/TextBlock.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/cru/ui/controls/TextBlock.h b/include/cru/ui/controls/TextBlock.h index ad44ad2d..52e227eb 100644 --- a/include/cru/ui/controls/TextBlock.h +++ b/include/cru/ui/controls/TextBlock.h @@ -16,6 +16,14 @@ 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) { + auto c = std::make_unique<TextBlock>(); + c->SetText(std::move(text)); + c->SetSelectable(selectable); + return std::move(c); + } + public: TextBlock(); TextBlock(const TextBlock& other) = delete; @@ -24,11 +32,6 @@ class CRU_UI_API TextBlock : public NoChildControl, 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; |