X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2FTimeout.h;h=e642a989e1b70f4891da70990796c0914ecfb1c8;hb=2f1d525ee1d41bc20adbfe766a9c5d90469aa4b2;hp=d363e0c270c30d1c88b308264093f6fc052bca33;hpb=ab5f0efdcbc357141375f7e7c53aa9f2cbdf2f45;p=lyx.git diff --git a/src/frontends/Timeout.h b/src/frontends/Timeout.h index d363e0c270..e642a989e1 100644 --- a/src/frontends/Timeout.h +++ b/src/frontends/Timeout.h @@ -1,22 +1,21 @@ // -*- C++ -*- /** * \file Timeout.h - * Copyright 2001 LyX Team - * Read COPYING + * 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. */ - + #ifndef TIMEOUT_H #define TIMEOUT_H -#ifdef __GNUG__ -#pragma interface -#endif - #include + /** * This class executes the callback when the timeout expires. */ @@ -27,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(); @@ -48,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