Move the animation Impl classes to private headers
This commit is contained in:
@@ -184,13 +184,6 @@ private:
|
||||
: wxGenericAnimationCtrl(parent, id, anim, pos, size, style, name)
|
||||
{}
|
||||
|
||||
|
||||
static wxAnimationImpl* CreateAnimationImpl(wxAnimationImplType WXUNUSED(implType))
|
||||
{
|
||||
// For the generic widget we always use the generic impl and ignore the given type
|
||||
return new wxAnimationGenericImpl();
|
||||
}
|
||||
|
||||
private:
|
||||
wxDECLARE_DYNAMIC_CLASS(wxAnimationCtrl);
|
||||
};
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/animate.h
|
||||
// Purpose: wxAnimationGenericImpl and wxGenericAnimationCtrl
|
||||
// Purpose: wxGenericAnimationCtrl
|
||||
// Author: Julian Smart and Guillermo Rodriguez Garcia
|
||||
// Modified by: Francesco Montorsi
|
||||
// Created: 13/8/99
|
||||
@@ -13,43 +13,6 @@
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGenericAnimation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxAnimationGenericImpl : public wxAnimationImpl
|
||||
{
|
||||
public:
|
||||
wxAnimationGenericImpl() {}
|
||||
|
||||
virtual wxAnimationImplType GetImplType() wxOVERRIDE
|
||||
{ return wxANIMATION_IMPL_TYPE_GENERIC; }
|
||||
|
||||
virtual bool IsOk() const wxOVERRIDE
|
||||
{ return m_refData != NULL; }
|
||||
|
||||
virtual unsigned int GetFrameCount() const wxOVERRIDE;
|
||||
virtual int GetDelay(unsigned int i) const wxOVERRIDE;
|
||||
virtual wxImage GetFrame(unsigned int i) const wxOVERRIDE;
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
|
||||
virtual bool LoadFile(const wxString& filename,
|
||||
wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE;
|
||||
virtual bool Load(wxInputStream& stream,
|
||||
wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE;
|
||||
|
||||
// extended interface used only by the generic implementation of wxAnimationCtrl
|
||||
virtual wxPoint GetFramePosition(unsigned int frame) const;
|
||||
virtual wxSize GetFrameSize(unsigned int frame) const;
|
||||
virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const;
|
||||
virtual wxColour GetTransparentColour(unsigned int frame) const;
|
||||
virtual wxColour GetBackgroundColour() const;
|
||||
|
||||
protected:
|
||||
wxDECLARE_NO_COPY_CLASS(wxAnimationGenericImpl);
|
||||
wxDECLARE_DYNAMIC_CLASS(wxAnimationGenericImpl);
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGenericAnimationCtrl
|
||||
@@ -129,6 +92,8 @@ public: // extended API specific to this implementation of wxAnimateCtrl
|
||||
wxBitmap& GetBackingStore()
|
||||
{ return m_backingStore; }
|
||||
|
||||
static wxAnimationImpl* CreateAnimationImpl(wxAnimationImplType implType);
|
||||
|
||||
protected: // internal utilities
|
||||
|
||||
// resize this control to fit m_animation
|
||||
|
54
include/wx/generic/private/animate.h
Normal file
54
include/wx/generic/private/animate.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/private/animate.h
|
||||
// Purpose: wxAnimationGenericImpl
|
||||
// Author: Julian Smart and Guillermo Rodriguez Garcia
|
||||
// Modified by: Francesco Montorsi
|
||||
// Created: 13/8/99
|
||||
// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GENERIC_PRIVATE_ANIMATEH__
|
||||
#define _WX_GENERIC_PRIVATE_ANIMATEH__
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxAnimationGenericImpl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxAnimationGenericImpl : public wxAnimationImpl
|
||||
{
|
||||
public:
|
||||
wxAnimationGenericImpl() {}
|
||||
|
||||
virtual wxAnimationImplType GetImplType() wxOVERRIDE
|
||||
{ return wxANIMATION_IMPL_TYPE_GENERIC; }
|
||||
|
||||
virtual bool IsOk() const wxOVERRIDE
|
||||
{ return m_refData != NULL; }
|
||||
|
||||
virtual unsigned int GetFrameCount() const wxOVERRIDE;
|
||||
virtual int GetDelay(unsigned int i) const wxOVERRIDE;
|
||||
virtual wxImage GetFrame(unsigned int i) const wxOVERRIDE;
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
|
||||
virtual bool LoadFile(const wxString& filename,
|
||||
wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE;
|
||||
virtual bool Load(wxInputStream& stream,
|
||||
wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE;
|
||||
|
||||
// extended interface used only by the generic implementation of wxAnimationCtrl
|
||||
virtual wxPoint GetFramePosition(unsigned int frame) const;
|
||||
virtual wxSize GetFrameSize(unsigned int frame) const;
|
||||
virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const;
|
||||
virtual wxColour GetTransparentColour(unsigned int frame) const;
|
||||
virtual wxColour GetBackgroundColour() const;
|
||||
|
||||
protected:
|
||||
wxDECLARE_NO_COPY_CLASS(wxAnimationGenericImpl);
|
||||
wxDECLARE_DYNAMIC_CLASS(wxAnimationGenericImpl);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_GENERIC_PRIVATE_ANIMATEH__
|
@@ -14,62 +14,6 @@
|
||||
typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
|
||||
typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxAnimation
|
||||
// Unlike the generic wxAnimation object (see generic\animate.cpp), we won't
|
||||
// use directly wxAnimationHandlers as gdk-pixbuf already provides the
|
||||
// concept of handler and will automatically use the available handlers.
|
||||
// Like generic wxAnimation object, this implementation of wxAnimation is
|
||||
// refcounted so that assignment is very fast
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxAnimationGTKImpl : public wxAnimationImpl
|
||||
{
|
||||
public:
|
||||
wxAnimationGTKImpl()
|
||||
: m_pixbuf(NULL) {}
|
||||
~wxAnimationGTKImpl() { UnRef(); }
|
||||
|
||||
|
||||
virtual wxAnimationImplType GetImplType() wxOVERRIDE
|
||||
{ return wxANIMATION_IMPL_TYPE_NATIVE; }
|
||||
|
||||
virtual bool IsOk() const wxOVERRIDE
|
||||
{ return m_pixbuf != NULL; }
|
||||
|
||||
|
||||
// unfortunately GdkPixbufAnimation does not expose these info:
|
||||
|
||||
virtual unsigned int GetFrameCount() const wxOVERRIDE { return 0; }
|
||||
virtual wxImage GetFrame(unsigned int frame) const wxOVERRIDE;
|
||||
|
||||
// we can retrieve the delay for a frame only after building
|
||||
// a GdkPixbufAnimationIter...
|
||||
virtual int GetDelay(unsigned int WXUNUSED(frame)) const wxOVERRIDE { return 0; }
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
|
||||
virtual bool LoadFile(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE;
|
||||
virtual bool Load(wxInputStream &stream, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE;
|
||||
|
||||
// Implementation
|
||||
public: // used by GTK callbacks
|
||||
|
||||
GdkPixbufAnimation *GetPixbuf() const
|
||||
{ return m_pixbuf; }
|
||||
void SetPixbuf(GdkPixbufAnimation* p);
|
||||
|
||||
protected:
|
||||
GdkPixbufAnimation *m_pixbuf;
|
||||
|
||||
private:
|
||||
void UnRef();
|
||||
|
||||
typedef wxAnimationImpl base_type;
|
||||
wxDECLARE_NO_COPY_CLASS(wxAnimationGTKImpl);
|
||||
wxDECLARE_DYNAMIC_CLASS(wxAnimationGTKImpl);
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxAnimationCtrl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
71
include/wx/gtk/private/animate.h
Normal file
71
include/wx/gtk/private/animate.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/private/animate.h
|
||||
// Purpose: Animation classes
|
||||
// Author: Julian Smart and Guillermo Rodriguez Garcia
|
||||
// Modified by: Francesco Montorsi
|
||||
// Created: 13/8/99
|
||||
// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_PRIVATE_ANIMATEH__
|
||||
#define _WX_GTK_PRIVATE_ANIMATEH__
|
||||
|
||||
typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
|
||||
typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxAnimationGTKImpl
|
||||
// Unlike the generic wxAnimation object we won't use directly
|
||||
// wxAnimationDecoders as gdk-pixbuf already provides the concept of decoder and
|
||||
// will automatically use the available handlers.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxAnimationGTKImpl : public wxAnimationImpl
|
||||
{
|
||||
public:
|
||||
wxAnimationGTKImpl()
|
||||
: m_pixbuf(NULL) {}
|
||||
~wxAnimationGTKImpl() { UnRef(); }
|
||||
|
||||
|
||||
virtual wxAnimationImplType GetImplType() wxOVERRIDE
|
||||
{ return wxANIMATION_IMPL_TYPE_NATIVE; }
|
||||
|
||||
virtual bool IsOk() const wxOVERRIDE
|
||||
{ return m_pixbuf != NULL; }
|
||||
|
||||
|
||||
// unfortunately GdkPixbufAnimation does not expose these info:
|
||||
|
||||
virtual unsigned int GetFrameCount() const wxOVERRIDE { return 0; }
|
||||
virtual wxImage GetFrame(unsigned int frame) const wxOVERRIDE;
|
||||
|
||||
// we can retrieve the delay for a frame only after building
|
||||
// a GdkPixbufAnimationIter...
|
||||
virtual int GetDelay(unsigned int WXUNUSED(frame)) const wxOVERRIDE { return 0; }
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
|
||||
virtual bool LoadFile(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE;
|
||||
virtual bool Load(wxInputStream &stream, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE;
|
||||
|
||||
// Implementation
|
||||
public: // used by GTK callbacks
|
||||
|
||||
GdkPixbufAnimation *GetPixbuf() const
|
||||
{ return m_pixbuf; }
|
||||
void SetPixbuf(GdkPixbufAnimation* p);
|
||||
|
||||
protected:
|
||||
GdkPixbufAnimation *m_pixbuf;
|
||||
|
||||
private:
|
||||
void UnRef();
|
||||
|
||||
typedef wxAnimationImpl base_type;
|
||||
wxDECLARE_NO_COPY_CLASS(wxAnimationGTKImpl);
|
||||
wxDECLARE_DYNAMIC_CLASS(wxAnimationGTKImpl);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_GTK_PRIVATE_ANIMATEH__
|
@@ -16,6 +16,7 @@
|
||||
|
||||
#if wxUSE_ANIMATIONCTRL
|
||||
#include "wx/animate.h"
|
||||
#include "wx/generic/private/animate.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
@@ -594,7 +595,18 @@ void wxGenericAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//static
|
||||
wxAnimationImpl* wxGenericAnimationCtrl::CreateAnimationImpl(wxAnimationImplType WXUNUSED(implType))
|
||||
{
|
||||
// For the generic widget we always use the generic impl and ignore the given type
|
||||
return new wxAnimationGenericImpl();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helpers to safely access wxAnimationGenericImpl methods
|
||||
// ----------------------------------------------------------------------------
|
||||
#define ANIMATION (static_cast<wxAnimationGenericImpl*>(m_animation.GetImpl()))
|
||||
|
||||
wxPoint wxGenericAnimationCtrl::AnimationImplGetFramePosition(unsigned int frame) const
|
||||
|
@@ -13,6 +13,7 @@
|
||||
|
||||
#if wxUSE_ANIMATIONCTRL
|
||||
#include "wx/animate.h"
|
||||
#include "wx/gtk/private/animate.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/image.h"
|
||||
|
Reference in New Issue
Block a user