diff options
author | crupest <crupest@outlook.com> | 2022-03-04 21:26:48 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-03-04 21:26:48 +0800 |
commit | 221f9cd7e453f2968c12a14a46588ea50ca2119d (patch) | |
tree | 278a2ade6817b1656d89051aaae5b26658112a4c /include/cru/ui/style/Styler.h | |
parent | a0732c3aa32d200bf154d486df3c9f506161954f (diff) | |
download | cru-221f9cd7e453f2968c12a14a46588ea50ca2119d.tar.gz cru-221f9cd7e453f2968c12a14a46588ea50ca2119d.tar.bz2 cru-221f9cd7e453f2968c12a14a46588ea50ca2119d.zip |
...
Diffstat (limited to 'include/cru/ui/style/Styler.h')
-rw-r--r-- | include/cru/ui/style/Styler.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/cru/ui/style/Styler.h b/include/cru/ui/style/Styler.h index e2e05c5b..f4f66ea0 100644 --- a/include/cru/ui/style/Styler.h +++ b/include/cru/ui/style/Styler.h @@ -2,6 +2,7 @@ #include "../Base.h" #include "ApplyBorderStyleInfo.h" #include "cru/common/ClonablePtr.h" +#include "cru/platform/graphics/Brush.h" #include "cru/platform/gui/Cursor.h" #include "cru/ui/render/MeasureRequirement.h" @@ -149,4 +150,48 @@ class CRU_UI_API PaddingStyler : public Styler { Thickness padding_; }; +class CRU_UI_API ContentBrushStyler : public Styler { + public: + static ClonablePtr<ContentBrushStyler> Create( + std::shared_ptr<platform::graphics::IBrush> brush) { + return ClonablePtr<ContentBrushStyler>( + new ContentBrushStyler(std::move(brush))); + } + + explicit ContentBrushStyler(std::shared_ptr<platform::graphics::IBrush> brush) + : brush_(std::move(brush)) {} + + void Apply(controls::Control* control) const override; + + ContentBrushStyler* Clone() const override { + return new ContentBrushStyler(brush_); + } + + std::shared_ptr<platform::graphics::IBrush> GetBrush() const { + return brush_; + } + + private: + std::shared_ptr<platform::graphics::IBrush> brush_; +}; + +class CRU_UI_API FontStyler : public Styler { + public: + static ClonablePtr<FontStyler> Create( + std::shared_ptr<platform::graphics::IFont> font) { + return ClonablePtr<FontStyler>(new FontStyler(std::move(font))); + } + + explicit FontStyler(std::shared_ptr<platform::graphics::IFont> font) + : font_(std::move(font)) {} + + void Apply(controls::Control* control) const override; + + FontStyler* Clone() const override { return new FontStyler(font_); } + + std::shared_ptr<platform::graphics::IFont> GetFont() const { return font_; } + + private: + std::shared_ptr<platform::graphics::IFont> font_; +}; } // namespace cru::ui::style |