]> git.lyx.org Git - lyx.git/blob - src/frontends/Timeout.h
small cleanup, doxygen, formatting changes
[lyx.git] / src / frontends / Timeout.h
1 /**
2  * \file Timeout.h
3  * Copyright 2001 LyX Team
4  * Read COPYING
5  *
6  * \author Lars Gullik Bjønnes
7  * \author John Levon
8  */
9 #ifndef TIMEOUT_H
10 #define TIMEOUT_H
11
12 #include <config.h>
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include <sigc++/signal_system.h>
19
20 #ifdef SIGC_CXX_NAMESPACES
21 using SigC::Signal0;
22 #endif
23
24 /**
25  * This class executes the callback when the timeout expires.
26  */
27 class Timeout {
28 public:
29         ///
30         enum Type {
31                 /// one-shot timer
32                 ONETIME,
33                 /// repeating
34                 CONTINUOUS
35         };
36         ///
37         Timeout();
38         ///
39         Timeout(unsigned int msec, Type = ONETIME);
40         ///
41         ~Timeout();
42         /// start the timer
43         void start();
44         /// stop the timer
45         void stop();
46         /// restart the timer
47         void restart();
48         /// signal emitted on timer expiry
49         Signal0<void> timeout;
50         /// emit the signal
51         void emit();
52         /// set the timer type
53         Timeout & setType(Type t);
54         /// set the timeout value
55         Timeout & setTimeout(unsigned int msec);
56
57 private:
58         struct Pimpl;
59         friend struct Pimpl;
60         /// implementation
61         Pimpl * pimpl_;
62
63         /// one-shot or repeating
64         Type type;
65         /// timeout value in milliseconds
66         unsigned int timeout_ms;
67 };
68
69 #endif