diff options
Diffstat (limited to 'SwifTools/Idle/IdleDetector.h')
-rw-r--r-- | SwifTools/Idle/IdleDetector.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/SwifTools/Idle/IdleDetector.h b/SwifTools/Idle/IdleDetector.h index 1fb3d69..bd7175d 100644 --- a/SwifTools/Idle/IdleDetector.h +++ b/SwifTools/Idle/IdleDetector.h @@ -6,6 +6,7 @@ namespace Swift { class IdleDetector { public: + IdleDetector() : idle(false) {} virtual ~IdleDetector(); void setIdleTimeSeconds(int time) { @@ -16,9 +17,22 @@ namespace Swift { return idleTimeSeconds; } + virtual bool isIdle() const { + return idle; + } + boost::signal<void (bool /* isIdle */)> onIdleChanged; + protected: + void setIdle(bool b) { + if (b != idle) { + idle = b; + onIdleChanged(b); + } + } + private: int idleTimeSeconds; + bool idle; }; } |