[go: up one dir, main page]

Menu

[e0151d]: / src / ytimer.h  Maximize  Restore  History

Download this file

43 lines (31 with data), 832 Bytes

 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
#ifndef __YTIMER_H
#define __YTIMER_H
#include "base.h"
#include <X11/Xos.h>
class YTimer;
class YTimerListener {
public:
virtual bool handleTimer(YTimer *timer) = 0;
};
class YTimer {
public:
YTimer(long ms = 0);
~YTimer();
void setTimerListener(YTimerListener *listener) { fListener = listener; }
YTimerListener *getTimerListener() const { return fListener; }
void setInterval(long ms) { fInterval = ms; }
long getInterval() const { return fInterval; }
void startTimer();
void stopTimer();
void runTimer(); // run timer handler immediatelly
bool isRunning() const { return fRunning; }
private:
YTimerListener *fListener;
long fInterval;
bool fRunning;
YTimer *fPrev;
YTimer *fNext;
struct timeval timeout;
friend class YApplication;
};
#endif