diff options
Diffstat (limited to 'src/ui/render/text_render_object.hpp')
-rw-r--r-- | src/ui/render/text_render_object.hpp | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/src/ui/render/text_render_object.hpp b/src/ui/render/text_render_object.hpp index ac874b75..30d78736 100644 --- a/src/ui/render/text_render_object.hpp +++ b/src/ui/render/text_render_object.hpp @@ -1,8 +1,6 @@ #pragma once #include "pre.hpp" -#include <wrl/client.h> // for ComPtr - #include "render_object.hpp" // forward declarations @@ -13,14 +11,13 @@ struct IDWriteTextLayout; namespace cru::ui::render { class TextRenderObject : public RenderObject { public: - TextRenderObject(Microsoft::WRL::ComPtr<ID2D1Brush> brush, - Microsoft::WRL::ComPtr<IDWriteTextFormat> format, - Microsoft::WRL::ComPtr<ID2D1Brush> selection_brush); + 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 = default; + ~TextRenderObject() override; String GetText() const { return text_; } void SetText(String new_text) { @@ -28,19 +25,11 @@ class TextRenderObject : public RenderObject { RecreateTextLayout(); } - Microsoft::WRL::ComPtr<ID2D1Brush> GetBrush() const { return brush_; } - void SetBrush(Microsoft::WRL::ComPtr<ID2D1Brush> new_brush) { - brush_ = std::move(new_brush); - } + ID2D1Brush* GetBrush() const { return brush_; } + void SetBrush(ID2D1Brush* new_brush); - Microsoft::WRL::ComPtr<IDWriteTextFormat> GetTextFormat() const { - return text_format_; - } - void SetTextFormat( - Microsoft::WRL::ComPtr<IDWriteTextFormat> new_text_format) { - text_format_ = std::move(new_text_format); - RecreateTextLayout(); - } + IDWriteTextFormat* GetTextFormat() const { return text_format_; } + void SetTextFormat(IDWriteTextFormat* new_text_format); std::optional<TextRange> GetSelectionRange() const { return selection_range_; @@ -49,12 +38,10 @@ class TextRenderObject : public RenderObject { selection_range_ = std::move(new_range); } - Microsoft::WRL::ComPtr<ID2D1Brush> GetSelectionBrush() const { + ID2D1Brush* GetSelectionBrush() const { return selection_brush_; } - void SetSelectionBrush(Microsoft::WRL::ComPtr<ID2D1Brush> new_brush) { - selection_brush_ = std::move(new_brush); - } + void SetSelectionBrush(ID2D1Brush* new_brush); void Draw(ID2D1RenderTarget* render_target) override; @@ -72,11 +59,11 @@ class TextRenderObject : public RenderObject { private: String text_; - Microsoft::WRL::ComPtr<ID2D1Brush> brush_; - Microsoft::WRL::ComPtr<IDWriteTextFormat> text_format_; - Microsoft::WRL::ComPtr<IDWriteTextLayout> text_layout_; + ID2D1Brush* brush_; + IDWriteTextFormat* text_format_; + IDWriteTextLayout* text_layout_; std::optional<TextRange> selection_range_ = std::nullopt; - Microsoft::WRL::ComPtr<ID2D1Brush> selection_brush_; + ID2D1Brush* selection_brush_; }; } // namespace cru::ui::render |