]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/Timeout.h
Handle Qt-style file filters like
[lyx.git] / src / frontends / Timeout.h
index 3aedb78f93b226afec4ee9babd380b39583affcb..e642a989e1b70f4891da70990796c0914ecfb1c8 100644 (file)
@@ -7,18 +7,15 @@
  * \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 <boost/signals/signal0.hpp>
 
+
 /**
  * This class executes the callback when the timeout expires.
  */
@@ -29,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();
@@ -50,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<Impl> const pimpl_;
        /// one-shot or repeating
        Type type;
        /// timeout value in milliseconds