Move wxGenericAnimationCtrl::m_animation to the base class

API of wxAnimationCtrlBase practically forces the derived classes to
have such method, so just add it and make GetAnimation() a simple
non-virtual accessor.
This commit is contained in:
Vadim Zeitlin
2020-04-06 01:03:39 +02:00
parent b08db49bf6
commit 3678d67f92
4 changed files with 8 additions and 8 deletions

View File

@@ -101,7 +101,7 @@ public:
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
virtual void SetAnimation(const wxAnimation &anim) = 0;
virtual wxAnimation GetAnimation() const = 0;
wxAnimation GetAnimation() const { return m_animation; }
virtual bool Play() = 0;
virtual void Stop() = 0;
@@ -121,8 +121,11 @@ protected:
virtual wxAnimationImpl* DoCreateAnimationImpl() const = 0;
// This method allows derived classes access to wxAnimation::GetImpl().
wxAnimationImpl* GetAnimImpl(const wxAnimation& anim) const
{ return anim.GetImpl(); }
wxAnimationImpl* GetAnimImpl() const
{ return m_animation.GetImpl(); }
// The associated animation, possibly invalid/empty.
wxAnimation m_animation;
// the inactive bitmap as it was set by the user
wxBitmap m_bmpStatic;

View File

@@ -58,8 +58,6 @@ public:
{ return m_isPlaying; }
void SetAnimation(const wxAnimation &animation) wxOVERRIDE;
wxAnimation GetAnimation() const wxOVERRIDE
{ return m_animation; }
virtual void SetInactiveBitmap(const wxBitmap &bmp) wxOVERRIDE;
@@ -123,7 +121,6 @@ protected:
unsigned int m_currentFrame; // Current frame
bool m_looped; // Looped, or not
wxTimer m_timer; // The timer
wxAnimation m_animation; // The animation
bool m_isPlaying; // Is the animation playing?
bool m_useWinBackgroundColour; // Use animation bg colour or window bg colour?

View File

@@ -623,7 +623,7 @@ void wxGenericAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
// ----------------------------------------------------------------------------
// helpers to safely access wxAnimationGenericImpl methods
// ----------------------------------------------------------------------------
#define ANIMATION (static_cast<wxAnimationGenericImpl*>(GetAnimImpl(m_animation)))
#define ANIMATION (static_cast<wxAnimationGenericImpl*>(GetAnimImpl()))
wxPoint wxGenericAnimationCtrl::AnimationImplGetFramePosition(unsigned int frame) const
{

View File

@@ -473,7 +473,7 @@ void wxAnimationCtrl::OnTimer(wxTimerEvent& WXUNUSED(ev))
// helpers to safely access wxAnimationGTKImpl methods
#define ANIMATION (static_cast<wxAnimationGTKImpl*>(GetAnimImpl(m_animation)))
#define ANIMATION (static_cast<wxAnimationGTKImpl*>(GetAnimImpl()))
GdkPixbufAnimation* wxAnimationCtrl::AnimationImplGetPixbuf() const
{