1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

CObject: Add custom_event() virtual.

This way you can just override custom_event() to catch CCustomEvent instead
of having to filter the entire event stream with event(). :^)
This commit is contained in:
Andreas Kling 2019-07-14 10:27:27 +02:00
parent 1ecb7462b7
commit a634fab3c4
2 changed files with 8 additions and 0 deletions

View file

@ -37,6 +37,8 @@ void CObject::event(CEvent& event)
case CEvent::Invalid:
ASSERT_NOT_REACHED();
break;
case CEvent::Custom:
return custom_event(static_cast<CCustomEvent&>(event));
default:
break;
}
@ -70,6 +72,10 @@ void CObject::child_event(CChildEvent&)
{
}
void CObject::custom_event(CCustomEvent&)
{
}
void CObject::start_timer(int ms)
{
if (m_timer_id) {

View file

@ -8,6 +8,7 @@
class CEvent;
class CChildEvent;
class CCustomEvent;
class CTimerEvent;
class CObject : public Weakable<CObject> {
@ -59,6 +60,7 @@ public:
protected:
virtual void timer_event(CTimerEvent&);
virtual void child_event(CChildEvent&);
virtual void custom_event(CCustomEvent&);
private:
CObject* m_parent { nullptr };