// Purpose: interface of wxTimer
// Author: wxWidgets team
// RCS-ID: $Id$
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+// generate notifications periodically until the timer is stopped (default)
+#define wxTIMER_CONTINUOUS false
+
+// only send the notification once and then stop the timer
+#define wxTIMER_ONE_SHOT true
+
+wxEventType wxEVT_TIMER;
+
+
/**
@class wxTimer
used and SetOwner() wasn't called.
Perform whatever action which is to be taken periodically here.
+
+ Notice that throwing exceptions from this method is currently not
+ supported, use event-based timer handling approach if an exception can
+ be thrown while handling timer notifications.
*/
virtual void Notify();
};
+/**
+ @class wxTimerRunner
+
+ Starts the timer in its ctor, stops in the dtor.
+*/
+class wxTimerRunner
+{
+public:
+ wxTimerRunner(wxTimer& timer);
+ wxTimerRunner(wxTimer& timer, int milli, bool oneShot = false);
+ void Start(int milli, bool oneShot = false);
+ ~wxTimerRunner();
+};
/**
@class wxTimerEvent
- wxTimerEvent object is passed to the event handler of timer events.
+ wxTimerEvent object is passed to the event handler of timer events
+ (see wxTimer::SetOwner).
For example:
private:
wxTimer m_timer;
+ wxDECLARE_EVENT_TABLE();
};
- BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_TIMER(TIMER_ID, MyFrame::OnTimer)
- END_EVENT_TABLE()
+ wxEND_EVENT_TABLE()
MyFrame::MyFrame()
: m_timer(this, TIMER_ID)
class wxTimerEvent : public wxEvent
{
public:
+ wxTimerEvent();
+ wxTimerEvent(wxTimer& timer);
+
/**
Returns the interval of the timer which generated this event.
*/