SimpleWindow
载入中...
搜索中...
未找到
ObservableObject.h
1#pragma once
2
3#include "INotifyObjectDead.h"
4#include "INotifyPropertyChanged.h"
5
6namespace sw
7{
12 public INotifyObjectDead,
14 {
15 private:
19 PropertyChangedEventHandler _propertyChanged;
20
24 ObjectDeadEventHandler _objectDead;
25
26 public:
31 {
32 if (_objectDead) {
34 _objectDead(*this, args);
35 }
36 }
37
38 protected:
44 {
45 return _propertyChanged;
46 }
47
53 {
54 return _objectDead;
55 }
56
62 {
63 if (_propertyChanged) {
65 args.propertyId = propertyId;
66 _propertyChanged(*this, args);
67 }
68 }
69
76 template <typename T, typename TProperty>
82 };
83}
动态对象基类
Definition Reflection.h:27
对象销毁通知接口
Definition INotifyObjectDead.h:20
属性变更通知接口
Definition INotifyPropertyChanged.h:30
值转换器接口
Definition IValueConverter.h:14
可观察对象基类,实现属性更改通知功能
Definition ObservableObject.h:14
virtual ~ObservableObject()
析构时触发对象销毁事件
Definition ObservableObject.h:30
virtual PropertyChangedEventHandler & GetPropertyChangedEventDelegate() override final
获取属性更改事件委托的引用
Definition ObservableObject.h:43
void RaisePropertyChanged(TProperty T::*property)
触发属性更改通知事件
Definition ObservableObject.h:77
void RaisePropertyChanged(FieldId propertyId)
触发属性更改通知事件
Definition ObservableObject.h:61
virtual ObjectDeadEventHandler & GetObjectDeadEventDelegate() override final
获取对象销毁事件委托的引用
Definition ObservableObject.h:52
static FieldId GetFieldId(TField T::*field) noexcept
获取字段的唯一标识符
Definition Reflection.h:1083
SimpleWindow框架的顶级命名空间,所有公共类型、控件、枚举和工具函数均定义于此。
Definition Alignment.h:4
事件参数结构体
Definition Event.h:286
表示字段的唯一标识符
Definition Reflection.h:1020
属性更改事件参数
Definition INotifyPropertyChanged.h:13