aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/style
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-03-13 18:51:19 +0800
committercrupest <crupest@outlook.com>2022-03-13 18:51:19 +0800
commit7320f082c4bce5939cfa7c9a23765249dac55d07 (patch)
treef51d8684d04c1d78e45f391be7965b618186231f /include/cru/ui/style
parent1d14ce416bb4e5651b956790b621308acf73b64c (diff)
downloadcru-7320f082c4bce5939cfa7c9a23765249dac55d07.tar.gz
cru-7320f082c4bce5939cfa7c9a23765249dac55d07.tar.bz2
cru-7320f082c4bce5939cfa7c9a23765249dac55d07.zip
...
Diffstat (limited to 'include/cru/ui/style')
-rw-r--r--include/cru/ui/style/StyleRuleSet.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/cru/ui/style/StyleRuleSet.h b/include/cru/ui/style/StyleRuleSet.h
index 8bf9c9ff..8f3495bc 100644
--- a/include/cru/ui/style/StyleRuleSet.h
+++ b/include/cru/ui/style/StyleRuleSet.h
@@ -2,6 +2,7 @@
#include "StyleRule.h"
#include "cru/common/Base.h"
#include "cru/common/Event.h"
+#include "cru/ui/model/IListChangeNotify.h"
#include <cstddef>
@@ -12,7 +13,7 @@ namespace cru::ui::style {
* mutable and has reference semantics. Change of it will be notified by
* StyleRuleSet::ChangeEvent.
*/
-class CRU_UI_API StyleRuleSet : public Object {
+class CRU_UI_API StyleRuleSet : public Object, public model::IListChangeNotify {
public:
StyleRuleSet() = default;
explicit StyleRuleSet(std::shared_ptr<StyleRuleSet> parent);
@@ -50,11 +51,20 @@ class CRU_UI_API StyleRuleSet : public Object {
// change ...). Subscribe to this and update style change listeners and style.
IEvent<std::nullptr_t>* ChangeEvent() { return &change_event_; }
+ IEvent<model::ListChange>* ListChangeEvent() override {
+ return &list_change_event_;
+ }
+
private:
void RaiseChangeEvent() { change_event_.Raise(nullptr); }
+ void RaiseChangeEvent(model::ListChange list_change) {
+ list_change_event_.Raise(list_change);
+ change_event_.Raise(nullptr);
+ }
private:
Event<std::nullptr_t> change_event_;
+ Event<model::ListChange> list_change_event_;
std::shared_ptr<StyleRuleSet> parent_ = nullptr;
EventRevokerGuard parent_change_event_guard_;