File indexing completed on 2024-04-14 14:32:09

0001 /***************************************************************************
0002                           ctimer.h  -  description
0003                              -------------------
0004     begin                : St maj 8 2003
0005     copyright            : (C) 2003-2008 by Tomas Mecir
0006     email                : kmuddy@kmuddy.com
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef CTIMER_H
0019 #define CTIMER_H
0020 
0021 #include "clistobject.h"
0022 
0023 /**
0024 One timer.
0025   *@author Tomas Mecir
0026   */
0027 
0028 class cTimer : public cListObject {
0029 public:
0030   ~cTimer () override;
0031 
0032   /** Execute this timer now. */
0033   void execute ();
0034   /** How long till the next tick ? */
0035   int tickTimeout ();
0036 protected:
0037   friend class cTimerList;
0038   cTimer (cList *list);
0039 
0040   void setEnabled (bool en = true) override;
0041 
0042   /** React on an attribute change by adjusting the visible name. */
0043   void attribChanged (const QString &name) override;
0044 
0045   void updateVisibleName() override;
0046 
0047 #define TIMER_RESET 1
0048 #define TIMER_TICK 2
0049 
0050   cList::TraverseAction traverse (int traversalType) override;
0051 
0052   virtual void tick (int tickTime);
0053   void resetTickCount ();
0054 protected:
0055   struct Private;
0056   Private *d;
0057 };
0058 
0059 #endif