preparation for allowing to use wxTimer in wxBase (heavily modified patch 1113088):
1. Changed wxTimer to use wxTimerImpl 2. Added Unix-specific generic timer implementation 3. Added wxAppTraits::CreateTimerImpl() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45544 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
73
include/wx/private/timer.h
Normal file
73
include/wx/private/timer.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/private/timerimpl.h
|
||||
// Purpose: Base class for wxTimer implementations
|
||||
// Author: Lukasz Michalski <lmichalski@sf.net>
|
||||
// Created: 31.10.2006
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006-2007 wxWidgets dev team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TIMERIMPL_H_BASE_
|
||||
#define _WX_TIMERIMPL_H_BASE_
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/event.h"
|
||||
#include "wx/timer.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTimerImpl: abstract base class for wxTimer implementations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_BASE wxTimerImpl
|
||||
{
|
||||
public:
|
||||
// default ctor, SetOwner() must be called after it (wxTimer does it)
|
||||
wxTimerImpl(wxTimer *owner);
|
||||
|
||||
// this must be called initially but may be also called later
|
||||
void SetOwner(wxEvtHandler *owner, int timerid);
|
||||
|
||||
// empty but virtual base class dtor, the caller is responsible for
|
||||
// stopping the timer before it's destroyed (it can't be done from here as
|
||||
// it's too late)
|
||||
virtual ~wxTimerImpl() { }
|
||||
|
||||
|
||||
// start the timer. When overriding call base version first.
|
||||
virtual bool Start(int milliseconds = -1, bool oneShot = false);
|
||||
|
||||
// stop the timer, only called if the timer is really running (unlike
|
||||
// wxTimer::Stop())
|
||||
virtual void Stop() = 0;
|
||||
|
||||
// return true if the timer is running
|
||||
virtual bool IsRunning() const = 0;
|
||||
|
||||
// this should be called by the port-specific code when the timer expires
|
||||
virtual void Notify() { m_timer->Notify(); }
|
||||
|
||||
// the default implementation of wxTimer::Notify(): generate a wxEVT_TIMER
|
||||
void SendEvent();
|
||||
|
||||
|
||||
// accessors for wxTimer:
|
||||
wxEvtHandler *GetOwner() const { return m_owner; }
|
||||
int GetId() const { return m_idTimer; }
|
||||
int GetInterval() const { return m_milli; }
|
||||
bool IsOneShot() const { return m_oneShot; }
|
||||
|
||||
protected:
|
||||
wxTimer *m_timer;
|
||||
|
||||
wxEvtHandler *m_owner;
|
||||
|
||||
int m_idTimer; // id passed to wxTimerEvent
|
||||
int m_milli; // the timer interval
|
||||
bool m_oneShot; // true if one shot
|
||||
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxTimerImpl);
|
||||
};
|
||||
|
||||
#endif // _WX_TIMERIMPL_H_BASE_
|
Reference in New Issue
Block a user