aboutsummaryrefslogtreecommitdiff
path: root/CruUI/ui/controls/text_block.h
diff options
context:
space:
mode:
Diffstat (limited to 'CruUI/ui/controls/text_block.h')
-rw-r--r--CruUI/ui/controls/text_block.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/CruUI/ui/controls/text_block.h b/CruUI/ui/controls/text_block.h
index abf77112..04347a0c 100644
--- a/CruUI/ui/controls/text_block.h
+++ b/CruUI/ui/controls/text_block.h
@@ -15,11 +15,22 @@ namespace cru
public:
using TextLayoutHandler = Action<Microsoft::WRL::ComPtr<IDWriteTextLayout>>;
+ static TextBlock* Create(
+ const String& text = L"",
+ const Microsoft::WRL::ComPtr<IDWriteTextFormat>& init_text_format = nullptr,
+ const Microsoft::WRL::ComPtr<ID2D1Brush>& init_brush = nullptr)
+ {
+ const auto text_block = new TextBlock(init_text_format, init_brush);
+ text_block->SetText(text);
+ return text_block;
+ }
+ private:
explicit TextBlock(
const Microsoft::WRL::ComPtr<IDWriteTextFormat>& init_text_format = nullptr,
const Microsoft::WRL::ComPtr<ID2D1Brush>& init_brush = nullptr
);
+ public:
TextBlock(const TextBlock& other) = delete;
TextBlock(TextBlock&& other) = delete;
TextBlock& operator=(const TextBlock& other) = delete;