mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:47: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:
parent
b51f0f7bfa
commit
debc587ce2
1 changed files with 20 additions and 0 deletions
|
@ -17,6 +17,7 @@ public:
|
||||||
DeferredInvoke,
|
DeferredInvoke,
|
||||||
ChildAdded,
|
ChildAdded,
|
||||||
ChildRemoved,
|
ChildRemoved,
|
||||||
|
Custom,
|
||||||
};
|
};
|
||||||
|
|
||||||
CEvent() {}
|
CEvent() {}
|
||||||
|
@ -72,3 +73,22 @@ public:
|
||||||
private:
|
private:
|
||||||
WeakPtr<CObject> m_child;
|
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 };
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue