From 221f9cd7e453f2968c12a14a46588ea50ca2119d Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 4 Mar 2022 21:26:48 +0800 Subject: ... --- include/cru/ui/style/Styler.h | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'include/cru/ui') 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 Create( + std::shared_ptr brush) { + return ClonablePtr( + new ContentBrushStyler(std::move(brush))); + } + + explicit ContentBrushStyler(std::shared_ptr brush) + : brush_(std::move(brush)) {} + + void Apply(controls::Control* control) const override; + + ContentBrushStyler* Clone() const override { + return new ContentBrushStyler(brush_); + } + + std::shared_ptr GetBrush() const { + return brush_; + } + + private: + std::shared_ptr brush_; +}; + +class CRU_UI_API FontStyler : public Styler { + public: + static ClonablePtr Create( + std::shared_ptr font) { + return ClonablePtr(new FontStyler(std::move(font))); + } + + explicit FontStyler(std::shared_ptr font) + : font_(std::move(font)) {} + + void Apply(controls::Control* control) const override; + + FontStyler* Clone() const override { return new FontStyler(font_); } + + std::shared_ptr GetFont() const { return font_; } + + private: + std::shared_ptr font_; +}; } // namespace cru::ui::style -- cgit v1.2.3