1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +00:00

LibCore: Move LibGUI/GTimer to LibCore/CTimer.

This commit is contained in:
Andreas Kling 2019-04-12 00:09:45 +02:00
parent 667e678aa6
commit 47a2982119
5 changed files with 14 additions and 14 deletions

39
LibCore/CTimer.cpp Normal file
View file

@ -0,0 +1,39 @@
#include <LibCore/CTimer.h>
CTimer::CTimer(CObject* parent)
: CObject(parent)
{
}
CTimer::~CTimer()
{
}
void CTimer::start()
{
start(m_interval);
}
void CTimer::start(int interval)
{
if (m_active)
return;
start_timer(interval);
m_active = true;
}
void CTimer::stop()
{
if (!m_active)
return;
stop_timer();
m_active = false;
}
void CTimer::timer_event(CTimerEvent&)
{
if (m_single_shot)
stop();
if (on_timeout)
on_timeout();
}