From 7320f082c4bce5939cfa7c9a23765249dac55d07 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 13 Mar 2022 18:51:19 +0800 Subject: ... --- src/ui/style/StyleRuleSet.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/ui/style/StyleRuleSet.cpp') diff --git a/src/ui/style/StyleRuleSet.cpp b/src/ui/style/StyleRuleSet.cpp index 6b475c8c..74aba5b1 100644 --- a/src/ui/style/StyleRuleSet.cpp +++ b/src/ui/style/StyleRuleSet.cpp @@ -1,6 +1,7 @@ #include "cru/ui/style/StyleRuleSet.h" #include "cru/common/Event.h" #include "cru/ui/controls/Control.h" +#include "cru/ui/model/IListChangeNotify.h" #include "gsl/gsl_assert" #include @@ -42,7 +43,7 @@ void StyleRuleSet::AddStyleRule(StyleRule rule, gsl::index index) { rules_.insert(rules_.cbegin() + index, std::move(rule)); - RaiseChangeEvent(); + RaiseChangeEvent(model::ListChange::ItemAdd(index)); } void StyleRuleSet::RemoveStyleRule(gsl::index index, gsl::index count) { @@ -51,20 +52,22 @@ void StyleRuleSet::RemoveStyleRule(gsl::index index, gsl::index count) { rules_.erase(rules_.cbegin() + index, rules_.cbegin() + index + count); - RaiseChangeEvent(); + RaiseChangeEvent(model::ListChange::ItemRemove(index, count)); } void StyleRuleSet::SetStyleRule(Index index, StyleRule rule) { Expects(index >= 0 && index < GetSize()); rules_[index] = std::move(rule); - RaiseChangeEvent(); + RaiseChangeEvent(model::ListChange::ItemSet(index)); } void StyleRuleSet::Set(const StyleRuleSet& other, bool set_parent) { rules_ = other.rules_; if (set_parent) parent_ = other.parent_; - RaiseChangeEvent(); + list_change_event_.Raise(model::ListChange::Clear()); + list_change_event_.Raise(model::ListChange::ItemAdd(0, GetSize())); + change_event_.Raise(nullptr); } StyleRuleSetBind::StyleRuleSetBind(controls::Control* control, -- cgit v1.2.3