aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/text_block.h
blob: cd0af1cc44a586319ff56315d219099c65b64af9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#include "text_control.h"

namespace cru::ui::controls
{
    class TextBlock : public TextControl
    {
    public:
        static constexpr auto control_type = L"TextBlock";

        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;
        }

    protected:
        TextBlock(
            const Microsoft::WRL::ComPtr<IDWriteTextFormat>& init_text_format,
            const Microsoft::WRL::ComPtr<ID2D1Brush>& 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;
    };
}