1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 08:55:08 +00:00
serenity/LibGUI/GTimer.cpp
2019-04-10 17:01:54 +02:00

39 lines
503 B
C++

#include <LibGUI/GTimer.h>
GTimer::GTimer(CObject* parent)
: CObject(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(CTimerEvent&)
{
if (m_single_shot)
stop();
if (on_timeout)
on_timeout();
}