diff options
author | crupest <crupest@outlook.com> | 2022-03-04 21:21:15 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-03-04 21:21:15 +0800 |
commit | a0732c3aa32d200bf154d486df3c9f506161954f (patch) | |
tree | 4019d719d8672030db7602c19798e911ef57e3b3 /include/cru/ui/controls/TextBlock.h | |
parent | 14e1b0f188d302b69816ddf12f5ac591fd76b91d (diff) | |
download | cru-a0732c3aa32d200bf154d486df3c9f506161954f.tar.gz cru-a0732c3aa32d200bf154d486df3c9f506161954f.tar.bz2 cru-a0732c3aa32d200bf154d486df3c9f506161954f.zip |
...
Diffstat (limited to 'include/cru/ui/controls/TextBlock.h')
-rw-r--r-- | include/cru/ui/controls/TextBlock.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/cru/ui/controls/TextBlock.h b/include/cru/ui/controls/TextBlock.h index e43d472f..12c9d2f9 100644 --- a/include/cru/ui/controls/TextBlock.h +++ b/include/cru/ui/controls/TextBlock.h @@ -2,12 +2,17 @@ #include "NoChildControl.h" #include "../render/TextRenderObject.h" +#include "IContentBrushControl.h" +#include "IFontControl.h" #include "TextHostControlService.h" #include "cru/platform/graphics/Brush.h" +#include "cru/platform/graphics/Font.h" namespace cru::ui::controls { class CRU_UI_API TextBlock : public NoChildControl, - public virtual ITextHostControl { + public virtual ITextHostControl, + public virtual IFontControl, + public virtual IContentBrushControl { public: static constexpr StringView kControlType = u"TextBlock"; @@ -47,6 +52,22 @@ class CRU_UI_API TextBlock : public NoChildControl, return nullptr; } + std::shared_ptr<platform::graphics::IFont> GetFont() const override { + return text_render_object_->GetFont(); + } + void SetFont(std::shared_ptr<platform::graphics::IFont> font) override { + text_render_object_->SetFont(std::move(font)); + } + + std::shared_ptr<platform::graphics::IBrush> GetContentBrush() const override { + return GetTextBrush(); + } + + void SetContentBrush( + std::shared_ptr<platform::graphics::IBrush> brush) override { + SetTextBrush(std::move(brush)); + } + private: std::unique_ptr<render::TextRenderObject> text_render_object_; |