added wxTimerEvent::GetTimer()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45830 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -199,3 +199,10 @@ void MyFrame::OnTimer(wxTimerEvent& event)
|
|||||||
|
|
||||||
Returns the interval of the timer which generated this 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.
|
||||||
|
|
||||||
|
@@ -152,23 +152,25 @@ private:
|
|||||||
class WXDLLIMPEXP_BASE wxTimerEvent : public wxEvent
|
class WXDLLIMPEXP_BASE wxTimerEvent : public wxEvent
|
||||||
{
|
{
|
||||||
public:
|
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;
|
SetEventObject(timer.GetOwner());
|
||||||
|
|
||||||
m_interval = interval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// accessors
|
// 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
|
// implement the base class pure virtual
|
||||||
virtual wxEvent *Clone() const { return new wxTimerEvent(*this); }
|
virtual wxEvent *Clone() const { return new wxTimerEvent(*this); }
|
||||||
|
|
||||||
private:
|
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&);
|
typedef void (wxEvtHandler::*wxTimerEventFunction)(wxTimerEvent&);
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
// wxWin macros
|
// wxWin macros
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTimerEvent, wxEvent)
|
IMPLEMENT_ABSTRACT_CLASS(wxTimerEvent, wxEvent)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxTimerBase implementation
|
// wxTimerBase implementation
|
||||||
|
@@ -47,8 +47,7 @@ void wxTimerImpl::SetOwner(wxEvtHandler *owner, int timerid)
|
|||||||
|
|
||||||
void wxTimerImpl::SendEvent()
|
void wxTimerImpl::SendEvent()
|
||||||
{
|
{
|
||||||
wxTimerEvent event(m_idTimer, m_milli);
|
wxTimerEvent event(*m_timer);
|
||||||
event.SetEventObject(m_owner);
|
|
||||||
(void)m_owner->ProcessEvent(event);
|
(void)m_owner->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user