diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-12 00:09:45 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-12 00:09:45 +0200 |
commit | 47a29821190cbb5b239f053ae0d18e13bb420420 (patch) | |
tree | 4b963cbdd98c1f788e03d690a426b005ae9cc495 /LibGUI | |
parent | 667e678aa6a37c4df1b4a72a09ef4069ac003f3c (diff) | |
download | serenity-47a29821190cbb5b239f053ae0d18e13bb420420.zip |
LibCore: Move LibGUI/GTimer to LibCore/CTimer.
Diffstat (limited to 'LibGUI')
-rw-r--r-- | LibGUI/GTimer.cpp | 39 | ||||
-rw-r--r-- | LibGUI/GTimer.h | 32 | ||||
-rw-r--r-- | LibGUI/Makefile | 1 |
3 files changed, 0 insertions, 72 deletions
diff --git a/LibGUI/GTimer.cpp b/LibGUI/GTimer.cpp deleted file mode 100644 index 18c092f1b0..0000000000 --- a/LibGUI/GTimer.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#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(); -} diff --git a/LibGUI/GTimer.h b/LibGUI/GTimer.h deleted file mode 100644 index 68707748c8..0000000000 --- a/LibGUI/GTimer.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include <LibCore/CObject.h> -#include <AK/Function.h> - -class GTimer final : public CObject { -public: - explicit GTimer(CObject* 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 }; -}; diff --git a/LibGUI/Makefile b/LibGUI/Makefile index 3847add902..6ee8b250c6 100644 --- a/LibGUI/Makefile +++ b/LibGUI/Makefile @@ -49,7 +49,6 @@ LIBGUI_OBJS = \ GTreeView.o \ GFileSystemModel.o \ GSplitter.o \ - GTimer.o \ GSpinBox.o \ GGroupBox.o \ GWindow.o |