]> git.lyx.org Git - lyx.git/blob - src/frontends/Timeout.h
implement getLabelList
[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 /**
21  * This class executes the callback when the timeout expires.
22  */
23 class Timeout {
24 public:
25         ///
26         enum Type {
27                 /// one-shot timer
28                 ONETIME,
29                 /// repeating
30                 CONTINUOUS
31         };
32         ///
33         Timeout();
34         ///
35         Timeout(unsigned int msec, Type = ONETIME);
36         ///
37         ~Timeout();
38         /// start the timer
39         void start();
40         /// stop the timer
41         void stop();
42         /// restart the timer
43         void restart();
44         /// signal emitted on timer expiry
45         SigC::Signal0<void> timeout;
46         /// emit the signal
47         void emit();
48         /// set the timer type
49         Timeout & setType(Type t);
50         /// set the timeout value
51         Timeout & setTimeout(unsigned int msec);
52
53 private:
54         struct Pimpl;
55         friend struct Pimpl;
56         /// implementation
57         Pimpl * pimpl_;
58
59         /// one-shot or repeating
60         Type type;
61         /// timeout value in milliseconds
62         unsigned int timeout_ms;
63 };
64
65 #endif