aboutsummaryrefslogtreecommitdiff
path: root/include/cru/base/Event.h
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-17 12:54:55 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-17 12:54:55 +0800
commit0f8f98b9005803ab154b43dcad0db1f292072a4d (patch)
tree0a43d5a9c4e3b747ad955fc30a143aa07ab5888d /include/cru/base/Event.h
parentb68f9f52a3ecdd8e379dd60ac1c1366e76695464 (diff)
downloadcru-0f8f98b9005803ab154b43dcad0db1f292072a4d.tar.gz
cru-0f8f98b9005803ab154b43dcad0db1f292072a4d.tar.bz2
cru-0f8f98b9005803ab154b43dcad0db1f292072a4d.zip
Refactor window host.
Diffstat (limited to 'include/cru/base/Event.h')
-rw-r--r--include/cru/base/Event.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/cru/base/Event.h b/include/cru/base/Event.h
index 276c313f..c26bea83 100644
--- a/include/cru/base/Event.h
+++ b/include/cru/base/Event.h
@@ -128,6 +128,13 @@ class Event : public EventBase, public IEvent<TEventArgs> {
EventHandlerToken current_token_ = 0;
};
+#define CRU_DEFINE_EVENT(name, arg_type) \
+ private: \
+ ::cru::Event<arg_type> name##Event_; \
+ \
+ public: \
+ ::cru::IEvent<arg_type>* name##Event() { return &name##Event_; }
+
namespace details {
struct EventHandlerRevokerDestroyer {
void operator()(EventHandlerRevoker* p) {