From 376d5bfe0f3b9658cbf2d4ca9b00c0600341ee85 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Tue, 25 Nov 2025 17:15:16 +0800 Subject: Clean code. Clean events of native window. --- include/cru/base/Base.h | 7 ++++++- include/cru/base/Event.h | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'include/cru/base') diff --git a/include/cru/base/Base.h b/include/cru/base/Base.h index fda45f66..3cd04f8c 100644 --- a/include/cru/base/Base.h +++ b/include/cru/base/Base.h @@ -137,12 +137,17 @@ class CRU_BASE_API Exception : public std::exception { std::shared_ptr inner_; }; +class CRU_BASE_API NotImplementedException : public Exception { + public: + using Exception::Exception; // inherit constructors +}; + class CRU_BASE_API PlatformException : public Exception { public: using Exception::Exception; // inherit constructors }; -class ErrnoException : public Exception { +class CRU_BASE_API ErrnoException : public Exception { public: ErrnoException(); explicit ErrnoException(int error_code); diff --git a/include/cru/base/Event.h b/include/cru/base/Event.h index bdaf3ea6..71c0ac6b 100644 --- a/include/cru/base/Event.h +++ b/include/cru/base/Event.h @@ -141,6 +141,13 @@ class Event : public EventBase, public IEvent { public: \ ::cru::IEvent* name##Event() { return &name##Event_; } +#define CRU_DEFINE_EVENT_OVERRIDE(name, arg_type) \ + private: \ + ::cru::Event name##Event_; \ + \ + public: \ + ::cru::IEvent* name##Event() override { return &name##Event_; } + namespace details { struct EventHandlerRevokerCaller { void operator()(const EventHandlerRevoker& revoker) { revoker(); } -- cgit v1.2.3