4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
10 * Full author contact details are available in file CREDITS
16 #include <boost/signals/signal0.hpp>
20 * This class executes the callback when the timeout expires.
26 ONETIME, //< one-shot timer
27 CONTINUOUS //< repeating
29 /// Note that the c-tor is implemented in the GUI-specific frontends
30 Timeout(unsigned int msec, Type = ONETIME);
33 /// Is the timer running?
41 /// signal emitted on timer expiry
42 boost::signal0<void> timeout;
45 /// set the timer type
46 Timeout & setType(Type t);
47 /// set the timeout value
48 Timeout & setTimeout(unsigned int msec);
50 /** Base class for the GUI implementation.
51 It must be public so that C callback functions can access its
58 Impl(Timeout & owner) : owner_(owner) {}
61 /// Is the timer running?
62 virtual bool running() const = 0;
64 virtual void start() = 0;
66 virtual void stop() = 0;
68 virtual void reset() = 0;
72 void emit() { owner_.emit(); }
74 unsigned int timeout_ms() const { return owner_.timeout_ms; }
85 boost::scoped_ptr<Impl> const pimpl_;
86 /// one-shot or repeating
88 /// timeout value in milliseconds
89 unsigned int timeout_ms;