blob: 1aa37b4f58280963a63ef908c08a8f4f0e516412 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#pragma once
#include <LibGUI/GObject.h>
#include <AK/Function.h>
class GTimer final : public GObject {
public:
explicit GTimer(GObject* parent = nullptr);
virtual ~GTimer() override;
void start();
void start(int interval);
void stop();
bool is_active() const { return m_active; }
int interval() const { return m_interval; }
void set_interval(int interval) { m_interval = interval; }
bool is_single_shot() const { return m_single_shot; }
void set_single_shot(bool single_shot) { m_single_shot = single_shot; }
Function<void()> on_timeout;
virtual const char* class_name() const override { return "GTimer"; }
private:
virtual void timer_event(CTimerEvent&) override;
bool m_active { false };
bool m_single_shot { false };
int m_interval { 0 };
};
|