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