1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface definitions wxTimer
7 // Created: 18-June-1999
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
20 // generate notifications periodically until the timer is stopped (default)
23 // only send the notification once and then stop the timer
28 %constant wxEventType wxEVT_TIMER;
31 //---------------------------------------------------------------------------
35 //IMP_PYCALLBACK__(wxPyTimer, wxTimer, Notify);
37 void wxPyTimer::Notify() {
39 bool blocked = wxPyBeginBlockThreads();
40 if ((found = wxPyCBH_findCallback(m_myInst, "Notify")))
41 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
42 wxPyEndBlockThreads(blocked);
46 void wxPyTimer::base_Notify() {
54 %name(Timer) class wxPyTimer : public wxEvtHandler
57 %pythonAppend wxPyTimer "self._setCallbackInfo(self, Timer, 0)"
60 // if you don't call SetOwner() or provide an owner in the contstructor
61 // then you must override Notify() inorder to receive the timer
62 // notification. If the owner is set then it will get the timer
63 // notifications which can be handled with EVT_TIMER.
64 wxPyTimer(wxEvtHandler *owner=NULL, int id = -1);
67 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1);
69 // Set the owner instance that will receive the EVT_TIMER events using the
71 void SetOwner(wxEvtHandler *owner, int id = -1);
74 // start the timer: if milliseconds == -1, use the same value as for the
77 // it is now valid to call Start() multiple times: this just restarts the
78 // timer if it is already running
79 virtual bool Start(int milliseconds = -1, bool oneShot = False);
84 // override this in your wxTimer-derived class if you want to process timer
85 // messages in it, use non default ctor or SetOwner() otherwise
86 //virtual void Notify();
88 // return True if the timer is running
89 virtual bool IsRunning() const;
91 // get the (last) timer interval in the milliseconds
92 int GetInterval() const;
94 // return True if the timer is one shot
95 bool IsOneShot() const;
97 // return the timer ID
104 %# For backwards compatibility with 2.4
105 class PyTimer(Timer):
106 def __init__(self, notify):
115 EVT_TIMER = wx.PyEventBinder( wxEVT_TIMER, 1 )
121 class wxTimerEvent : public wxEvent
124 wxTimerEvent(int timerid = 0, int interval = 0);
125 int GetInterval() const;
130 // wxTimerRunner: starts the timer in its ctor, stops in the dtor
134 %nokwargs wxTimerRunner;
135 wxTimerRunner(wxTimer& timer);
136 wxTimerRunner(wxTimer& timer, int milli, bool oneShot = False);
139 void Start(int milli, bool oneShot = False);
143 //---------------------------------------------------------------------------