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