]> git.lyx.org Git - lyx.git/blob - src/Timeout.h
Small fix.
[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 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include <sigc++/signal_system.h>
20
21 #ifdef SIGC_CXX_NAMESPACES
22 using SigC::Signal0;
23 #endif
24
25 /** This class executes the callback when the timeout expires.
26     This class currently uses a regular callback, later it will use
27     signals and slots to provide the same.
28 */
29 class Timeout {
30 public:
31         ///
32         enum Type {
33                 ONETIME,
34                 CONTINOUS
35         };
36         ///
37         Timeout();
38         ///
39         Timeout(int msec, Type = ONETIME);
40         ///
41         ~Timeout();
42         ///
43         void start();
44         ///
45         void stop();
46         ///
47         void restart();
48         ///
49         Signal0<void> timeout;
50         ///
51         void emit();
52         ///
53         void setType(Type t);
54         ///
55         void setTimeout(int msec);
56 private:
57         ///
58         Type type;
59         ///
60         int timeout_ms;
61         ///
62         int timeout_id;
63 };
64
65 #endif