all repos — openbox @ 684405eec8553918b62e334bffe29eb4712ec95c

openbox fork - make it a bit more like ryudo

otk/timerqueuemanager.hh (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// -*- mode: C++; indent-tabs-mode: nil; -*-
#ifndef __timerqueuemanager_hh
#define __timerqueuemanager_hh

#include "timerqueue.hh"

namespace otk {

//! Manages a queue of OBTimer objects
/*!
  All OBTimer objects add themself to an OBTimerQueueManager. The manager is
  what fires the timers when their time has elapsed. This is done by having the
  application call the OBTimerQueueManager::fire class in its main event loop.
*/
class OBTimerQueueManager {
private:
  //! A priority queue of all timers being managed by this class.
  TimerQueue timerList;
public:
  //! Constructs a new OBTimerQueueManager
  OBTimerQueueManager() {}
  //! Destroys the OBTimerQueueManager
  virtual ~OBTimerQueueManager() {}

  //! Fire the next timer in the queue.
  /*!
    @param wait If true, this function will wait for the next timer, breaking
                on any events from the X server.
  */
  virtual void fire(bool wait = true);

  //! Adds a new timer to the queue
  /*!
    @param timer An OBTimer to add to the queue
  */
  virtual void addTimer(OBTimer* timer);
  //! Removes a timer from the queue
  /*!
    @param timer An OBTimer already in the queue to remove
  */
  virtual void removeTimer(OBTimer* timer);
};

}

#endif // __timerqueuemanager_hh