X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c2ca375c5620209d77a88d2d378bdcdedbc82e7e..4b263e5ef358411a345dee9ffef3ba69c19be40e:/include/wx/unix/private/timer.h diff --git a/include/wx/unix/private/timer.h b/include/wx/unix/private/timer.h index cdcf53b3d2..6275b53d91 100644 --- a/include/wx/unix/private/timer.h +++ b/include/wx/unix/private/timer.h @@ -3,7 +3,6 @@ // Purpose: wxTimer for wxBase (unix) // Author: Lukasz Michalski // Created: 15/01/2005 -// RCS-ID: $Id$ // Copyright: (c) Lukasz Michalski // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -11,6 +10,8 @@ #ifndef _WX_UNIX_PRIVATE_TIMER_H_ #define _WX_UNIX_PRIVATE_TIMER_H_ +#if wxUSE_TIMER + #include "wx/private/timer.h" // the type used for milliseconds is large enough for microseconds too but @@ -21,7 +22,9 @@ typedef wxMilliClock_t wxUsecClock_t; // wxTimer implementation class for Unix platforms // ---------------------------------------------------------------------------- -class wxUnixTimerImpl : public wxTimerImpl +// NB: we have to export at least this symbol from the shared library, because +// it's used by wxDFB's wxCore +class WXDLLIMPEXP_BASE wxUnixTimerImpl : public wxTimerImpl { public: wxUnixTimerImpl(wxTimer *timer); @@ -31,10 +34,17 @@ public: virtual bool Start(int milliseconds = -1, bool oneShot = false); virtual void Stop(); + // for wxTimerScheduler only: resets the internal flag indicating that the + // timer is running + void MarkStopped() + { + wxASSERT_MSG( m_isRunning, wxT("stopping non-running timer?") ); + + m_isRunning = false; + } + private: bool m_isRunning; - - friend class wxTimerScheduler; }; // ---------------------------------------------------------------------------- @@ -101,8 +111,9 @@ public: // it returns false if there are no timers bool GetNext(wxUsecClock_t *remaining) const; - // trigger the timer event for all timers which have expired - void NotifyExpired(); + // trigger the timer event for all timers which have expired, return true + // if any did + bool NotifyExpired(); private: // ctor and dtor are private, this is a singleton class only created by @@ -122,10 +133,6 @@ private: static wxTimerScheduler *ms_instance; }; -// this helper function currently only exists for Unix platforms but could be -// moved to wx/stopwatch.h if it turns out to be useful elsewhere -// -// returns the number of microseconds since the Epoch -extern wxUsecClock_t wxGetLocalTimeUsec(); +#endif // wxUSE_TIMER #endif // _WX_UNIX_PRIVATE_TIMER_H_