mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 09:46:04 -05:00
31 lines
464 B
C
31 lines
464 B
C
|
#pragma once
|
||
|
|
||
|
#include <AK/OwnPtr.h>
|
||
|
#include <AK/Vector.h>
|
||
|
|
||
|
class Event;
|
||
|
class Object;
|
||
|
|
||
|
class EventLoop {
|
||
|
public:
|
||
|
virtual ~EventLoop();
|
||
|
|
||
|
int exec();
|
||
|
|
||
|
virtual void waitForEvent() = 0;
|
||
|
|
||
|
void postEvent(Object* receiver, OwnPtr<Event>&&);
|
||
|
|
||
|
static EventLoop& main();
|
||
|
|
||
|
protected:
|
||
|
EventLoop();
|
||
|
|
||
|
private:
|
||
|
struct QueuedEvent {
|
||
|
Object* receiver { nullptr };
|
||
|
OwnPtr<Event> event;
|
||
|
};
|
||
|
Vector<QueuedEvent> m_queuedEvents;
|
||
|
};
|