X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2FTimeout.h;h=e642a989e1b70f4891da70990796c0914ecfb1c8;hb=558e849e692cc72ea74ac3859405b85e54c6e315;hp=1e57e53d3501a2a52392a00de21b64d263b25d54;hpb=1eb8155fa0d2253d9504a8d660cb3d666c1224f6;p=lyx.git diff --git a/src/frontends/Timeout.h b/src/frontends/Timeout.h index 1e57e53d35..e642a989e1 100644 --- a/src/frontends/Timeout.h +++ b/src/frontends/Timeout.h @@ -1,25 +1,21 @@ // -*- C++ -*- /** * \file Timeout.h - * Copyright 2001 LyX Team * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * * \author Lars Gullik Bjønnes * \author John Levon * - * Full author contact details are available in file CREDITS + * Full author contact details are available in file CREDITS. */ - + #ifndef TIMEOUT_H #define TIMEOUT_H -#ifdef __GNUG__ -#pragma interface -#endif - #include + /** * This class executes the callback when the timeout expires. */ @@ -30,7 +26,7 @@ public: ONETIME, //< one-shot timer CONTINUOUS //< repeating }; - /// + /// Note that the c-tor is implemented in the GUI-specific frontends Timeout(unsigned int msec, Type = ONETIME); /// ~Timeout(); @@ -51,13 +47,42 @@ public: /// set the timeout value Timeout & setTimeout(unsigned int msec); + /** Base class for the GUI implementation. + It must be public so that C callback functions can access its + daughter classes. + */ + class Impl + { + public: + /// + Impl(Timeout & owner) : owner_(owner) {} + /// + virtual ~Impl() {} + /// Is the timer running? + virtual bool running() const = 0; + /// start the timer + virtual void start() = 0; + /// stop the timer + virtual void stop() = 0; + /// reset + virtual void reset() = 0; + + protected: + /// + void emit() { owner_.emit(); } + /// + unsigned int timeout_ms() const { return owner_.timeout_ms; } + + private: + /// + Timeout & owner_; + }; + private: /// - struct Pimpl; + friend class Impl; /// - friend struct Pimpl; - /// implementation - Pimpl * pimpl_; + boost::scoped_ptr const pimpl_; /// one-shot or repeating Type type; /// timeout value in milliseconds