aboutsummaryrefslogtreecommitdiff
path: root/src/ui/render/text_render_object.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-04-01 18:08:58 +0800
committercrupest <crupest@outlook.com>2019-04-01 18:08:58 +0800
commitde00126c6aeba189a50296df455dd516e21e4176 (patch)
tree3d89a8a36a3603096d4371230c2d071f91e9e986 /src/ui/render/text_render_object.hpp
parent055a3cde0cd19c896f3e498b774078654555c065 (diff)
downloadcru-de00126c6aeba189a50296df455dd516e21e4176.tar.gz
cru-de00126c6aeba189a50296df455dd516e21e4176.tar.bz2
cru-de00126c6aeba189a50296df455dd516e21e4176.zip
...
Diffstat (limited to 'src/ui/render/text_render_object.hpp')
-rw-r--r--src/ui/render/text_render_object.hpp69
1 files changed, 0 insertions, 69 deletions
diff --git a/src/ui/render/text_render_object.hpp b/src/ui/render/text_render_object.hpp
deleted file mode 100644
index 7827f994..00000000
--- a/src/ui/render/text_render_object.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#pragma once
-#include "pre.hpp"
-
-#include "render_object.hpp"
-
-// forward declarations
-struct ID2D1Brush;
-struct IDWriteTextFormat;
-struct IDWriteTextLayout;
-
-namespace cru::ui::render {
-class TextRenderObject : public RenderObject {
- public:
- TextRenderObject(ID2D1Brush* brush, IDWriteTextFormat* format,
- ID2D1Brush* selection_brush);
- TextRenderObject(const TextRenderObject& other) = delete;
- TextRenderObject(TextRenderObject&& other) = delete;
- TextRenderObject& operator=(const TextRenderObject& other) = delete;
- TextRenderObject& operator=(TextRenderObject&& other) = delete;
- ~TextRenderObject() override;
-
- String GetText() const { return text_; }
- void SetText(String new_text) {
- text_ = std::move(new_text);
- RecreateTextLayout();
- }
-
- ID2D1Brush* GetBrush() const { return brush_; }
- void SetBrush(ID2D1Brush* new_brush);
-
- IDWriteTextFormat* GetTextFormat() const { return text_format_; }
- void SetTextFormat(IDWriteTextFormat* new_text_format);
-
- std::optional<TextRange> GetSelectionRange() const {
- return selection_range_;
- }
- void SetSelectionRange(std::optional<TextRange> new_range) {
- selection_range_ = std::move(new_range);
- }
-
- ID2D1Brush* GetSelectionBrush() const { return selection_brush_; }
- void SetSelectionBrush(ID2D1Brush* new_brush);
-
- void Refresh() { RecreateTextLayout(); }
-
- void Draw(ID2D1RenderTarget* render_target) override;
-
- RenderObject* HitTest(const Point& point) override;
-
- protected:
- void OnSizeChanged(const Size& old_size, const Size& new_size) override;
-
- Size OnMeasureContent(const Size& available_size) override;
- void OnLayoutContent(const Rect& content_rect) override;
-
- private:
- void RecreateTextLayout();
-
- private:
- String text_;
-
- ID2D1Brush* brush_ = nullptr;
- IDWriteTextFormat* text_format_ = nullptr;
- IDWriteTextLayout* text_layout_ = nullptr;
-
- std::optional<TextRange> selection_range_ = std::nullopt;
- ID2D1Brush* selection_brush_ = nullptr;
-};
-} // namespace cru::ui::render