From 17baaa03e0ff49ec1921607e6a439c1c6487883c Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 5 Nov 2018 21:32:55 +0800 Subject: Add control type. --- src/ui/controls/text_block.h | 56 +++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 29 deletions(-) (limited to 'src/ui/controls/text_block.h') diff --git a/src/ui/controls/text_block.h b/src/ui/controls/text_block.h index c307fd2f..cd0af1cc 100644 --- a/src/ui/controls/text_block.h +++ b/src/ui/controls/text_block.h @@ -2,37 +2,35 @@ #include "text_control.h" -namespace cru +namespace cru::ui::controls { - namespace ui + class TextBlock : public TextControl { - namespace controls - { - class TextBlock : public TextControl - { - public: - static TextBlock* Create( - const String& text = L"", - const Microsoft::WRL::ComPtr& init_text_format = nullptr, - const Microsoft::WRL::ComPtr& init_brush = nullptr) - { - const auto text_block = new TextBlock(init_text_format, init_brush); - text_block->SetText(text); - return text_block; - } + public: + static constexpr auto control_type = L"TextBlock"; - protected: - TextBlock( - const Microsoft::WRL::ComPtr& init_text_format, - const Microsoft::WRL::ComPtr& init_brush - ); - public: - TextBlock(const TextBlock& other) = delete; - TextBlock(TextBlock&& other) = delete; - TextBlock& operator=(const TextBlock& other) = delete; - TextBlock& operator=(TextBlock&& other) = delete; - ~TextBlock() override = default; - }; + static TextBlock* Create( + const String& text = L"", + const Microsoft::WRL::ComPtr& init_text_format = nullptr, + const Microsoft::WRL::ComPtr& init_brush = nullptr) + { + const auto text_block = new TextBlock(init_text_format, init_brush); + text_block->SetText(text); + return text_block; } - } + + protected: + TextBlock( + const Microsoft::WRL::ComPtr& init_text_format, + const Microsoft::WRL::ComPtr& init_brush + ); + public: + TextBlock(const TextBlock& other) = delete; + TextBlock(TextBlock&& other) = delete; + TextBlock& operator=(const TextBlock& other) = delete; + TextBlock& operator=(TextBlock&& other) = delete; + ~TextBlock() override = default; + + StringView GetControlType() const override final; + }; } -- cgit v1.2.3