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/signal.hpp>
23 * This class executes the callback when the timeout expires.
29 ONETIME, //< one-shot timer
30 CONTINUOUS //< repeating
32 /// Note that the c-tor is implemented in the GUI-specific frontends
33 Timeout(unsigned int msec, Type = ONETIME);
36 /// Is the timer running?
44 /// signal emitted on timer expiry
45 boost::signal<void()> timeout;
48 /// set the timer type
49 Timeout & setType(Type t);
50 /// set the timeout value
51 Timeout & setTimeout(unsigned int msec);
53 /** Base class for the GUI implementation.
54 It must be public so that C callback functions can access its
61 Impl(Timeout & owner) : owner_(owner) {}
64 /// Is the timer running?
65 virtual bool running() const = 0;
67 virtual void start() = 0;
69 virtual void stop() = 0;
71 virtual void reset() = 0;
75 void emit() { owner_.emit(); }
77 unsigned int timeout_ms() const { return owner_.timeout_ms; }
88 boost::scoped_ptr<Impl> const pimpl_;
89 /// one-shot or repeating
91 /// timeout value in milliseconds
92 unsigned int timeout_ms;