mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
959a1b0750
This feels vaguely crashy. I haven't tested window/widget destruction before so there's sure to be bugs.
41 lines
789 B
C++
41 lines
789 B
C++
#pragma once
|
|
|
|
#include <AK/Vector.h>
|
|
#include <AK/Weakable.h>
|
|
|
|
class Event;
|
|
class TimerEvent;
|
|
|
|
class Object : public Weakable<Object> {
|
|
public:
|
|
Object(Object* parent = nullptr);
|
|
virtual ~Object();
|
|
|
|
virtual const char* className() const { return "Object"; }
|
|
|
|
virtual void event(Event&);
|
|
|
|
Vector<Object*>& children() { return m_children; }
|
|
|
|
Object* parent() { return m_parent; }
|
|
const Object* parent() const { return m_parent; }
|
|
|
|
void startTimer(int ms);
|
|
void stopTimer();
|
|
bool hasTimer() const { return m_timerID; }
|
|
|
|
void addChild(Object&);
|
|
void removeChild(Object&);
|
|
|
|
void deleteLater();
|
|
|
|
private:
|
|
virtual void timerEvent(TimerEvent&);
|
|
|
|
Object* m_parent { nullptr };
|
|
|
|
int m_timerID { 0 };
|
|
|
|
Vector<Object*> m_children;
|
|
};
|