aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/style/StyleRuleSet.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-27 21:21:51 +0800
committercrupest <crupest@outlook.com>2022-01-27 21:21:51 +0800
commit560c0ead613658a2b7444907c3d1d69e49be8c32 (patch)
tree37938098f0e80403d572accf9f7a275ec8792c00 /include/cru/ui/style/StyleRuleSet.hpp
parent56633dab8c1bf9d25a6367a651b5b054055a2130 (diff)
downloadcru-560c0ead613658a2b7444907c3d1d69e49be8c32.tar.gz
cru-560c0ead613658a2b7444907c3d1d69e49be8c32.tar.bz2
cru-560c0ead613658a2b7444907c3d1d69e49be8c32.zip
...
Diffstat (limited to 'include/cru/ui/style/StyleRuleSet.hpp')
-rw-r--r--include/cru/ui/style/StyleRuleSet.hpp13
1 files changed, 7 insertions, 6 deletions
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<StyleRuleSet> 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<StyleRuleSet> GetParent() const { return parent_; }
+ void SetParent(std::shared_ptr<StyleRuleSet> parent);
gsl::index GetSize() const { return static_cast<gsl::index>(rules_.size()); }
const std::vector<StyleRule>& GetRules() const { return rules_; }
@@ -47,7 +47,7 @@ class StyleRuleSet : public Object {
private:
Event<std::nullptr_t> change_event_;
- StyleRuleSet* parent_ = nullptr;
+ std::shared_ptr<StyleRuleSet> parent_ = nullptr;
EventRevokerGuard parent_change_event_guard_;
std::vector<StyleRule> 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<StyleRuleSet> ruleset);
CRU_DELETE_COPY(StyleRuleSetBind)
CRU_DELETE_MOVE(StyleRuleSetBind)
@@ -69,7 +70,7 @@ class StyleRuleSetBind {
private:
controls::Control* control_;
- StyleRuleSet* ruleset_;
+ std::shared_ptr<StyleRuleSet> ruleset_;
// child first, parent last.
std::vector<StyleRuleSet*> ruleset_chain_cache_;