]> git.lyx.org Git - lyx.git/blob - src/frontends/Timeout.h
fix tooltips in toolbar
[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  
11 #ifndef TIMEOUT_H
12 #define TIMEOUT_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include <boost/signals/signal0.hpp>
19
20 /**
21  * This class executes the callback when the timeout expires.
22  */
23 class Timeout {
24 public:
25         /// the timeout type
26         enum Type {
27                 ONETIME, //< one-shot timer
28                 CONTINUOUS //< repeating
29         };
30         ///
31         Timeout(unsigned int msec, Type = ONETIME);
32         ///
33         ~Timeout();
34         /// Is the timer running?
35         bool running() const;
36         /// start the timer
37         void start();
38         /// stop the timer
39         void stop();
40         /// restart the timer
41         void restart();
42         /// signal emitted on timer expiry
43         boost::signal0<void> timeout;
44         /// emit the signal
45         void emit();
46         /// set the timer type
47         Timeout & setType(Type t);
48         /// set the timeout value
49         Timeout & setTimeout(unsigned int msec);
50
51 private:
52         ///
53         struct Pimpl;
54         ///
55         friend struct Pimpl;
56         /// implementation
57         Pimpl * pimpl_;
58         /// one-shot or repeating
59         Type type;
60         /// timeout value in milliseconds
61         unsigned int timeout_ms;
62 };
63
64 #endif