aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/controls/TextBlock.h
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-09-08 23:08:10 +0800
committerYuqian Yang <crupest@crupest.life>2025-09-08 23:08:10 +0800
commit37d9a034013b4245a50c0d748dc83d2c3d136210 (patch)
tree3cee1be334acc4d917e9d6b3cbe3e03b653116ac /include/cru/ui/controls/TextBlock.h
parent0b0c32a1d688389c36f1847edf77af1fd7a2f9d7 (diff)
downloadcru-37d9a034013b4245a50c0d748dc83d2c3d136210.tar.gz
cru-37d9a034013b4245a50c0d748dc83d2c3d136210.tar.bz2
cru-37d9a034013b4245a50c0d748dc83d2c3d136210.zip
Fix windows dynamic lib build.
Diffstat (limited to 'include/cru/ui/controls/TextBlock.h')
-rw-r--r--include/cru/ui/controls/TextBlock.h13
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;