]> git.lyx.org Git - lyx.git/blob - src/frontends/Timeout.h
remove preamble dialog from the qt frontend
[lyx.git] / src / frontends / Timeout.h
1 // -*- C++ -*-
2 /**
3  * \file Timeout.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS
11  */
12
13 #ifndef TIMEOUT_H
14 #define TIMEOUT_H
15
16 #ifdef __GNUG__
17 #pragma interface
18 #endif
19
20 #include <boost/signals/signal0.hpp>
21
22 /**
23  * This class executes the callback when the timeout expires.
24  */
25 class Timeout {
26 public:
27         /// the timeout type
28         enum Type {
29                 ONETIME, //< one-shot timer
30                 CONTINUOUS //< repeating
31         };
32         ///
33         Timeout(unsigned int msec, Type = ONETIME);
34         ///
35         ~Timeout();
36         /// Is the timer running?
37         bool running() const;
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         boost::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         ///
55         struct Pimpl;
56         ///
57         friend struct Pimpl;
58         /// implementation
59         Pimpl * pimpl_;
60         /// one-shot or repeating
61         Type type;
62         /// timeout value in milliseconds
63         unsigned int timeout_ms;
64 };
65
66 #endif