+
+#ifndef SWIG
+ // ... und Timer
+/**
+ * \brief Gives a callback after a specified timeout.
+ *
+ * This class emits the signal \c eTimer::timeout after the specified timeout.
+ */
+class eTimer
+{
+ friend class eMainloop;
+ eMainloop &context;
+ timeval nextActivation;
+ long interval;
+ bool bSingleShot;
+ bool bActive;
+ void addTimeOffset(int);
+ void activate();
+public:
+ /**
+ * \brief Constructs a timer.
+ *
+ * The timer is not yet active, it has to be started with \c start.
+ * \param context The thread from which the signal should be emitted.
+ */
+ eTimer(eMainloop *context=eApp): context(*context), bActive(false) { }
+ ~eTimer() { if (bActive) stop(); }
+
+ PSignal0<void> timeout;
+
+ bool isActive() { return bActive; }
+
+ timeval &getNextActivation() { return nextActivation; }
+
+ void start(long msec, bool b=false);
+ void stop();
+ void changeInterval(long msek);
+ void startLongTimer( int seconds );
+ bool operator<(const eTimer& t) const { return nextActivation < t.nextActivation; }
+};
+#endif // SWIG
+