1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:37:35 +00:00

LibCore: Add CCustomEvent, a custom CEvent for arbitrary use.

For convenience it includes an int, and a void*. Interpretation of the
contents is up to the client.
This commit is contained in:
Andreas Kling 2019-07-13 18:35:13 +02:00
parent b51f0f7bfa
commit debc587ce2

View file

@ -17,6 +17,7 @@ public:
DeferredInvoke,
ChildAdded,
ChildRemoved,
Custom,
};
CEvent() {}
@ -72,3 +73,22 @@ public:
private:
WeakPtr<CObject> m_child;
};
class CCustomEvent : public CEvent {
public:
CCustomEvent(int custom_type, void* data = nullptr)
: CEvent(CEvent::Type::Custom)
, m_custom_type(custom_type)
, m_data(data)
{
}
~CCustomEvent() {}
int custom_type() const { return m_custom_type; }
void* data() { return m_data; }
const void* data() const { return m_data; }
private:
int m_custom_type { 0 };
void* m_data { nullptr };
};