aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/text_block.hpp
blob: 0d65dd670d4f1a9f70d35b6ebb74b66a4c538d96 (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
37
38
39
#pragma once
#include "pre.hpp"

#include <memory>

#include "ui/no_child_control.hpp"

namespace cru::ui::render {
class TextRenderObject;
}

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

  static TextBlock* Create() { return new TextBlock(); }

 protected:
  TextBlock();

 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 { return control_type; }

  render::RenderObject* GetRenderObject() const override;

  String GetText() const;
  void SetText(const String& text);

 private:
  std::shared_ptr<render::TextRenderObject> render_object_;
};
}  // namespace cru::ui::controls