]> git.lyx.org Git - lyx.git/blob - src/Timeout.h
prepare for 1.1.6pre2
[lyx.git] / src / Timeout.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef TIMEOUT_H
13 #define TIMEOUT_H
14
15 #include <config.h>
16
17 #ifdef __GNUG__
18 #pragma interface
19 #endif
20
21 #include <sigc++/signal_system.h>
22
23 #ifdef SIGC_CXX_NAMESPACES
24 using SigC::Signal0;
25 #endif
26
27 /** This class executes the callback when the timeout expires.
28     This class currently uses a regular callback, later it will use
29     signals and slots to provide the same.
30 */
31 class Timeout {
32 public:
33         ///
34         enum Type {
35                 ///
36                 ONETIME,
37                 ///
38                 CONTINOUS
39         };
40         ///
41         Timeout();
42         ///
43         Timeout(unsigned int msec, Type = ONETIME);
44         ///
45         ~Timeout();
46         ///
47         void start();
48         ///
49         void stop();
50         ///
51         void restart();
52         ///
53         Signal0<void> timeout;
54         ///
55         void emit();
56         ///
57         Timeout & setType(Type t);
58         ///
59         Timeout & setTimeout(unsigned int msec);
60 private:
61         ///
62         Type type;
63         ///
64         unsigned int timeout_ms;
65         ///
66         int timeout_id;
67 };
68
69 #endif