aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/controls/text_block.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/ui/controls/text_block.hpp')
-rw-r--r--include/cru/ui/controls/text_block.hpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/include/cru/ui/controls/text_block.hpp b/include/cru/ui/controls/text_block.hpp
index 708b62f1..02e0eb2b 100644
--- a/include/cru/ui/controls/text_block.hpp
+++ b/include/cru/ui/controls/text_block.hpp
@@ -1,14 +1,18 @@
#pragma once
#include "../no_child_control.hpp"
+#include "text_common.hpp"
+
#include <memory>
namespace cru::ui::render {
+class StackLayoutRenderObject;
class TextRenderObject;
-}
+class CanvasRenderObject;
+} // namespace cru::ui::render
namespace cru::ui::controls {
-class TextBlock : public NoChildControl {
+class TextBlock : public NoChildControl, public virtual ITextControl {
public:
static constexpr std::string_view control_type = "TextBlock";
@@ -24,16 +28,23 @@ class TextBlock : public NoChildControl {
TextBlock& operator=(TextBlock&& other) = delete;
~TextBlock() override;
- std::string_view GetControlType() const final {
- return control_type;
- }
+ std::string_view GetControlType() const final { return control_type; }
render::RenderObject* GetRenderObject() const override;
std::string GetText() const;
void SetText(std::string text);
+ render::TextRenderObject* GetTextRenderObject() override;
+ render::CanvasRenderObject* GetCaretRenderObject() override;
+ platform::graph::IBrush* GetCaretBrush() override;
+
private:
- std::unique_ptr<render::TextRenderObject> render_object_;
+ std::unique_ptr<render::StackLayoutRenderObject> root_render_object_;
+ std::unique_ptr<render::TextRenderObject> text_render_object_;
+ std::unique_ptr<render::CanvasRenderObject> caret_render_object_;
+ std::shared_ptr<platform::graph::IBrush> caret_brush_;
+
+ std::unique_ptr<TextControlService> service_;
};
} // namespace cru::ui::controls