From 560c0ead613658a2b7444907c3d1d69e49be8c32 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 27 Jan 2022 21:21:51 +0800 Subject: ... --- include/cru/ui/style/StyleRuleSet.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'include/cru/ui/style/StyleRuleSet.hpp') diff --git a/include/cru/ui/style/StyleRuleSet.hpp b/include/cru/ui/style/StyleRuleSet.hpp index b3c4f683..32b02d78 100644 --- a/include/cru/ui/style/StyleRuleSet.hpp +++ b/include/cru/ui/style/StyleRuleSet.hpp @@ -9,7 +9,7 @@ namespace cru::ui::style { class StyleRuleSet : public Object { public: StyleRuleSet() = default; - explicit StyleRuleSet(StyleRuleSet* parent); + explicit StyleRuleSet(std::shared_ptr parent); CRU_DELETE_COPY(StyleRuleSet) CRU_DELETE_MOVE(StyleRuleSet) @@ -17,8 +17,8 @@ class StyleRuleSet : public Object { ~StyleRuleSet() override = default; public: - StyleRuleSet* GetParent() const { return parent_; } - void SetParent(StyleRuleSet* parent); + std::shared_ptr GetParent() const { return parent_; } + void SetParent(std::shared_ptr parent); gsl::index GetSize() const { return static_cast(rules_.size()); } const std::vector& GetRules() const { return rules_; } @@ -47,7 +47,7 @@ class StyleRuleSet : public Object { private: Event change_event_; - StyleRuleSet* parent_ = nullptr; + std::shared_ptr parent_ = nullptr; EventRevokerGuard parent_change_event_guard_; std::vector rules_; @@ -55,7 +55,8 @@ class StyleRuleSet : public Object { class StyleRuleSetBind { public: - StyleRuleSetBind(controls::Control* control, StyleRuleSet* ruleset); + StyleRuleSetBind(controls::Control* control, + std::shared_ptr ruleset); CRU_DELETE_COPY(StyleRuleSetBind) CRU_DELETE_MOVE(StyleRuleSetBind) @@ -69,7 +70,7 @@ class StyleRuleSetBind { private: controls::Control* control_; - StyleRuleSet* ruleset_; + std::shared_ptr ruleset_; // child first, parent last. std::vector ruleset_chain_cache_; -- cgit v1.2.3