]> git.lyx.org Git - lyx.git/blob - src/Timeout.h
last fix *NOT*
[lyx.git] / src / Timeout.h
1 // -*- C++ -*-
2 #ifndef TIMEOUT_H
3 #define TIMEOUT_H
4
5 /** This class executes the callback when the timeout expires.
6     This class currently uses a regular callback, later it will use
7     signals and slots to provide the same.
8 */
9 class Timeout {
10 public:
11         ///
12         typedef void (*TimeoutCallback)(void *);
13         
14         ///
15         enum Type {
16                 ONETIME,
17                 CONTINOUS
18         };
19         ///
20         Timeout();
21         ///
22         Timeout(int msec, Type = ONETIME);
23         ///
24         ~Timeout();
25         ///
26         void start();
27         ///
28         void stop();
29         ///
30         void restart();
31         ///
32         void callback(TimeoutCallback cb, void * data);
33         ///
34         void callback();
35         ///
36         void setType(Type t);
37         ///
38         void setTimeout(int msec);
39 private:
40         ///
41         Type type;
42         ///
43         int timeout;
44         ///
45         int timeout_id;
46         ///
47         TimeoutCallback callback_;
48         ///
49         void * data_;
50 };
51
52 #endif