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:
@@ -58,6 +58,7 @@ public:
|
|||||||
// same as ctor above
|
// same as ctor above
|
||||||
void SetOwner(wxEvtHandler *owner, int timerid = -1)
|
void SetOwner(wxEvtHandler *owner, int timerid = -1)
|
||||||
{ m_owner = owner; m_idTimer = timerid; }
|
{ m_owner = owner; m_idTimer = timerid; }
|
||||||
|
wxEvtHandler* GetOwner() const { return m_owner; }
|
||||||
|
|
||||||
virtual ~wxTimerBase();
|
virtual ~wxTimerBase();
|
||||||
|
|
||||||
|
@@ -57,6 +57,7 @@ void wxTimerBase::Notify()
|
|||||||
wxCHECK_RET( m_owner, _T("wxTimer::Notify() should be overridden.") );
|
wxCHECK_RET( m_owner, _T("wxTimer::Notify() should be overridden.") );
|
||||||
|
|
||||||
wxTimerEvent event(m_idTimer, m_milli);
|
wxTimerEvent event(m_idTimer, m_milli);
|
||||||
|
event.SetEventObject(this);
|
||||||
(void)m_owner->ProcessEvent(event);
|
(void)m_owner->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -175,7 +175,7 @@ void wxTimerScheduler::NotifyTimers()
|
|||||||
// wxTimer
|
// wxTimer
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer,wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||||
|
|
||||||
wxTimerScheduler *gs_scheduler = NULL;
|
wxTimerScheduler *gs_scheduler = NULL;
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
// wxTimer
|
// wxTimer
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||||
|
|
||||||
extern "C" gint timeout_callback( gpointer data )
|
extern "C" gint timeout_callback( gpointer data )
|
||||||
{
|
{
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
// wxTimer
|
// wxTimer
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||||
|
|
||||||
extern "C" gint timeout_callback( gpointer data )
|
extern "C" gint timeout_callback( gpointer data )
|
||||||
{
|
{
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#include "wx/timer.h"
|
#include "wx/timer.h"
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#include "wx/timer.h"
|
#include "wx/timer.h"
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include "wx/motif/private.h"
|
#include "wx/motif/private.h"
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject);
|
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler);
|
||||||
|
|
||||||
WX_DECLARE_VOIDPTR_HASH_MAP(wxTimer*, wxTimerHashMap);
|
WX_DECLARE_VOIDPTR_HASH_MAP(wxTimer*, wxTimerHashMap);
|
||||||
|
|
||||||
|
@@ -62,7 +62,7 @@ void WINAPI wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD);
|
|||||||
// macros
|
// macros
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
|
@@ -46,7 +46,7 @@ ULONG wxTimerProc(HWND hwnd, ULONG, int nIdTimer, ULONG);
|
|||||||
// macros
|
// macros
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
|
||||||
|
|
||||||
void wxTimer::Init()
|
void wxTimer::Init()
|
||||||
{
|
{
|
||||||
|
@@ -87,6 +87,7 @@ public:
|
|||||||
|
|
||||||
DEC_PYCALLBACK__(Notify);
|
DEC_PYCALLBACK__(Notify);
|
||||||
PYPRIVATE;
|
PYPRIVATE;
|
||||||
|
DECLARE_ABSTRACT_CLASS(wxPyTimer)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -34,6 +34,8 @@ enum {
|
|||||||
%{
|
%{
|
||||||
//IMP_PYCALLBACK__(wxPyTimer, wxTimer, Notify);
|
//IMP_PYCALLBACK__(wxPyTimer, wxTimer, Notify);
|
||||||
|
|
||||||
|
IMPLEMENT_ABSTRACT_CLASS(wxPyTimer, wxTimer);
|
||||||
|
|
||||||
void wxPyTimer::Notify() {
|
void wxPyTimer::Notify() {
|
||||||
bool found;
|
bool found;
|
||||||
bool blocked = wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
@@ -54,7 +56,7 @@ void wxPyTimer::base_Notify() {
|
|||||||
%name(Timer) class wxPyTimer : public wxEvtHandler
|
%name(Timer) class wxPyTimer : public wxEvtHandler
|
||||||
{
|
{
|
||||||
public:
|
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
|
// 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
|
// Set the owner instance that will receive the EVT_TIMER events using the
|
||||||
// given id.
|
// given id.
|
||||||
void SetOwner(wxEvtHandler *owner, int id = -1);
|
void SetOwner(wxEvtHandler *owner, int id = -1);
|
||||||
|
wxEvtHandler* GetOwner();
|
||||||
|
|
||||||
// start the timer: if milliseconds == -1, use the same value as for the
|
// start the timer: if milliseconds == -1, use the same value as for the
|
||||||
// last Start()
|
// last Start()
|
||||||
@@ -141,3 +143,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
%init %{
|
||||||
|
wxPyPtrTypeMap_Add("wxTimer", "wxPyTimer");
|
||||||
|
%}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user