summaryrefslogtreecommitdiff
path: root/LibGUI/GTimer.cpp
blob: 9edd58bd7a3207381be30446a0f381dfdfc06ee1 (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
33
34
35
36
37
38
39
#include <LibGUI/GTimer.h>

GTimer::GTimer(GObject* parent)
    : GObject(parent)
{
}

GTimer::~GTimer()
{
}

void GTimer::start()
{
    start(m_interval);
}

void GTimer::start(int interval)
{
    if (m_active)
        return;
    start_timer(interval);
    m_active = true;
}

void GTimer::stop()
{
    if (!m_active)
        return;
    stop_timer();
    m_active = false;
}

void GTimer::timer_event(GTimerEvent&)
{
    if (m_single_shot)
        stop();
    if (on_timeout)
        on_timeout();
}