Add GetOwner accessor and fix wxRTTI inheritance for wxTimer. Set the
timer as the event object in wxTimerEvents. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27196 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
0fab3a5a1a
commit
313feadc84
@ -58,6 +58,7 @@ public:
|
||||
// same as ctor above
|
||||
void SetOwner(wxEvtHandler *owner, int timerid = -1)
|
||||
{ m_owner = owner; m_idTimer = timerid; }
|
||||
wxEvtHandler* GetOwner() const { return m_owner; }
|
||||
|
||||
virtual ~wxTimerBase();
|
||||
|
||||
|
@ -57,6 +57,7 @@ void wxTimerBase::Notify()
|
||||
wxCHECK_RET( m_owner, _T("wxTimer::Notify() should be overridden.") );
|
||||
|
||||
wxTimerEvent event(m_idTimer, m_milli);
|
||||
event.SetEventObject(this);
|
||||
(void)m_owner->ProcessEvent(event);
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ void wxTimerScheduler::NotifyTimers()
|
||||
// wxTimer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer,wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||
|
||||
wxTimerScheduler *gs_scheduler = NULL;
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
// wxTimer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||
|
||||
extern "C" gint timeout_callback( gpointer data )
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
// wxTimer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||
|
||||
extern "C" gint timeout_callback( gpointer data )
|
||||
{
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "wx/timer.h"
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||
#endif
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "wx/timer.h"
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||
#endif
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "wx/motif/private.h"
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject);
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler);
|
||||
|
||||
WX_DECLARE_VOIDPTR_HASH_MAP(wxTimer*, wxTimerHashMap);
|
||||
|
||||
|
@ -62,7 +62,7 @@ void WINAPI wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD);
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
|
@ -46,7 +46,7 @@ ULONG wxTimerProc(HWND hwnd, ULONG, int nIdTimer, ULONG);
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||
|
||||
void wxTimer::Init()
|
||||
{
|
||||
|
@ -87,6 +87,7 @@ public:
|
||||
|
||||
DEC_PYCALLBACK__(Notify);
|
||||
PYPRIVATE;
|
||||
DECLARE_ABSTRACT_CLASS(wxPyTimer)
|
||||
};
|
||||
|
||||
|
||||
|
@ -34,6 +34,8 @@ enum {
|
||||
%{
|
||||
//IMP_PYCALLBACK__(wxPyTimer, wxTimer, Notify);
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxPyTimer, wxTimer);
|
||||
|
||||
void wxPyTimer::Notify() {
|
||||
bool found;
|
||||
bool blocked = wxPyBeginBlockThreads();
|
||||
@ -54,7 +56,7 @@ void wxPyTimer::base_Notify() {
|
||||
%name(Timer) class wxPyTimer : public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
%pythonAppend wxPyTimer "self._setCallbackInfo(self, Timer, 0)"
|
||||
%pythonAppend wxPyTimer "self._setCallbackInfo(self, Timer, 0); self._setOORInfo(self)"
|
||||
|
||||
|
||||
// if you don't call SetOwner() or provide an owner in the contstructor
|
||||
@ -69,7 +71,7 @@ public:
|
||||
// Set the owner instance that will receive the EVT_TIMER events using the
|
||||
// given id.
|
||||
void SetOwner(wxEvtHandler *owner, int id = -1);
|
||||
|
||||
wxEvtHandler* GetOwner();
|
||||
|
||||
// start the timer: if milliseconds == -1, use the same value as for the
|
||||
// last Start()
|
||||
@ -141,3 +143,7 @@ public:
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
%init %{
|
||||
wxPyPtrTypeMap_Add("wxTimer", "wxPyTimer");
|
||||
%}
|
||||
//---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user