From 2cd78b2a875c3b7abd8a9f1025e164124fae0088 Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Sat, 5 May 2007 14:59:25 +0000
Subject: [PATCH] added wxTimerEvent::GetTimer()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45830 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/timer.tex  |  7 +++++++
 include/wx/timer.h       | 16 +++++++++-------
 src/common/timercmn.cpp  |  2 +-
 src/common/timerimpl.cpp |  3 +--
 4 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/docs/latex/wx/timer.tex b/docs/latex/wx/timer.tex
index 78a3a6218d..d52233931b 100644
--- a/docs/latex/wx/timer.tex
+++ b/docs/latex/wx/timer.tex
@@ -199,3 +199,10 @@ void MyFrame::OnTimer(wxTimerEvent& event)
 
 Returns the interval of the timer which generated this event.
 
+
+\membersection{wxTimerEvent::GetTimer}\label{wxtimereventgettimer}
+
+\constfunc{wxTimer\&}{GetTimer}{\void}
+
+Returns the timer object which generated this event.
+
diff --git a/include/wx/timer.h b/include/wx/timer.h
index 346b98deee..3135963190 100644
--- a/include/wx/timer.h
+++ b/include/wx/timer.h
@@ -152,23 +152,25 @@ private:
 class WXDLLIMPEXP_BASE wxTimerEvent : public wxEvent
 {
 public:
-    wxTimerEvent(int timerid = 0, int interval = 0) : wxEvent(timerid)
+    wxTimerEvent(wxTimer& timer)
+        : wxEvent(timer.GetId(), wxEVT_TIMER),
+          m_timer(timer)
     {
-        m_eventType = wxEVT_TIMER;
-
-        m_interval = interval;
+        SetEventObject(timer.GetOwner());
     }
 
     // accessors
-    int GetInterval() const { return m_interval; }
+    int GetInterval() const { return m_timer.GetInterval(); }
+    wxTimer& GetTimer() const { return m_timer; }
 
     // implement the base class pure virtual
     virtual wxEvent *Clone() const { return new wxTimerEvent(*this); }
 
 private:
-    int m_interval;
+    wxTimer& m_timer;
 
-    DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTimerEvent)
+    DECLARE_ABSTRACT_CLASS(wxTimerEvent)
+    DECLARE_NO_ASSIGN_CLASS(wxTimerEvent)
 };
 
 typedef void (wxEvtHandler::*wxTimerEventFunction)(wxTimerEvent&);
diff --git a/src/common/timercmn.cpp b/src/common/timercmn.cpp
index bb89232709..8cfe29d113 100644
--- a/src/common/timercmn.cpp
+++ b/src/common/timercmn.cpp
@@ -39,7 +39,7 @@
 // wxWin macros
 // ----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxTimerEvent, wxEvent)
+IMPLEMENT_ABSTRACT_CLASS(wxTimerEvent, wxEvent)
 
 // ============================================================================
 // wxTimerBase implementation
diff --git a/src/common/timerimpl.cpp b/src/common/timerimpl.cpp
index d952af816f..3f94268d21 100644
--- a/src/common/timerimpl.cpp
+++ b/src/common/timerimpl.cpp
@@ -47,8 +47,7 @@ void wxTimerImpl::SetOwner(wxEvtHandler *owner, int timerid)
 
 void wxTimerImpl::SendEvent()
 {
-    wxTimerEvent event(m_idTimer, m_milli);
-    event.SetEventObject(m_owner);
+    wxTimerEvent event(*m_timer);
     (void)m_owner->ProcessEvent(event);
 }
 
-- 
2.50.0

