mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +00:00
Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch moves the Lib*/ directories into Libraries/.
This commit is contained in:
parent
63814ffebf
commit
04b9dc2d30
328 changed files with 36 additions and 36 deletions
41
Libraries/LibCore/CTimer.h
Normal file
41
Libraries/LibCore/CTimer.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <LibCore/CObject.h>
|
||||
|
||||
class CTimer final : public CObject {
|
||||
public:
|
||||
explicit CTimer(CObject* parent = nullptr);
|
||||
CTimer(int interval, Function<void()>&& timeout_handler, CObject* parent = nullptr);
|
||||
virtual ~CTimer() override;
|
||||
|
||||
void start();
|
||||
void start(int interval);
|
||||
void restart(int interval);
|
||||
void stop();
|
||||
|
||||
bool is_active() const { return m_active; }
|
||||
int interval() const { return m_interval; }
|
||||
void set_interval(int interval)
|
||||
{
|
||||
if (m_interval == interval)
|
||||
return;
|
||||
m_interval = interval;
|
||||
m_interval_dirty = true;
|
||||
}
|
||||
|
||||
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 "CTimer"; }
|
||||
|
||||
private:
|
||||
virtual void timer_event(CTimerEvent&) override;
|
||||
|
||||
bool m_active { false };
|
||||
bool m_single_shot { false };
|
||||
bool m_interval_dirty { false };
|
||||
int m_interval { 0 };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue