4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
15 #include <boost/signal.hpp>
21 * This class executes the callback when the timeout expires.
27 ONETIME, //< one-shot timer
28 CONTINUOUS //< repeating
30 /// Note that the c-tor is implemented in the GUI-specific frontends
31 Timeout(unsigned int msec, Type = ONETIME);
34 /// Is the timer running?
42 /// signal emitted on timer expiry
43 boost::signal<void()> timeout;
46 /// set the timer type
47 Timeout & setType(Type t);
48 /// set the timeout value
49 Timeout & setTimeout(unsigned int msec);
51 /** Base class for the GUI implementation.
52 It must be public so that C callback functions can access its
59 Impl(Timeout & owner) : owner_(owner) {}
62 /// Is the timer running?
63 virtual bool running() const = 0;
65 virtual void start() = 0;
67 virtual void stop() = 0;
69 virtual void reset() = 0;
73 void emit() { owner_.emit(); }
75 unsigned int timeout_ms() const { return owner_.timeout_ms; }
86 boost::scoped_ptr<Impl> const pimpl_;
87 /// one-shot or repeating
89 /// timeout value in milliseconds
90 unsigned int timeout_ms;