Name the base animation class wxGenericAnimation with a wxAnimation shim class
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
#include "wx/bitmap.h"
|
#include "wx/bitmap.h"
|
||||||
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxAnimation;
|
class WXDLLIMPEXP_FWD_CORE wxAnimation;
|
||||||
|
//class WXDLLIMPEXP_FWD_CORE wxAnimationGeneric;
|
||||||
|
|
||||||
extern WXDLLIMPEXP_DATA_CORE(wxAnimation) wxNullAnimation;
|
extern WXDLLIMPEXP_DATA_CORE(wxAnimation) wxNullAnimation;
|
||||||
extern WXDLLIMPEXP_DATA_CORE(const char) wxAnimationCtrlNameStr[];
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxAnimationCtrlNameStr[];
|
||||||
@@ -32,11 +33,11 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxAnimationCtrlNameStr[];
|
|||||||
|
|
||||||
WX_DECLARE_LIST_WITH_DECL(wxAnimationDecoder, wxAnimationDecoderList, class WXDLLIMPEXP_ADV);
|
WX_DECLARE_LIST_WITH_DECL(wxAnimationDecoder, wxAnimationDecoderList, class WXDLLIMPEXP_ADV);
|
||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxAnimation : public wxObject
|
class WXDLLIMPEXP_ADV wxGenericAnimation : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxAnimation() {}
|
wxGenericAnimation() {}
|
||||||
wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY)
|
wxGenericAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY)
|
||||||
{ LoadFile(name, type); }
|
{ LoadFile(name, type); }
|
||||||
|
|
||||||
virtual bool IsOk() const
|
virtual bool IsOk() const
|
||||||
@@ -71,7 +72,7 @@ public:
|
|||||||
static void CleanUpHandlers();
|
static void CleanUpHandlers();
|
||||||
static void InitStandardHandlers();
|
static void InitStandardHandlers();
|
||||||
|
|
||||||
wxDECLARE_DYNAMIC_CLASS(wxAnimation);
|
wxDECLARE_DYNAMIC_CLASS(wxGenericAnimation);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -138,6 +139,18 @@ private:
|
|||||||
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
|
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
|
||||||
#include "wx/gtk/animate.h"
|
#include "wx/gtk/animate.h"
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_ADV wxAnimation : public wxGenericAnimation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxAnimation()
|
||||||
|
: wxGenericAnimation() {}
|
||||||
|
wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY)
|
||||||
|
: wxGenericAnimation(name, type) {}
|
||||||
|
private:
|
||||||
|
wxDECLARE_DYNAMIC_CLASS(wxAnimation);
|
||||||
|
};
|
||||||
|
|
||||||
#include "wx/generic/animate.h"
|
#include "wx/generic/animate.h"
|
||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxAnimationCtrl : public wxGenericAnimationCtrl
|
class WXDLLIMPEXP_ADV wxAnimationCtrl : public wxGenericAnimationCtrl
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: wx/generic/animate.h
|
// Name: wx/generic/animate.h
|
||||||
// Purpose: wxAnimation and wxAnimationCtrl
|
// Purpose: wxGenericAnimation and wxGenericAnimationCtrl
|
||||||
// Author: Julian Smart and Guillermo Rodriguez Garcia
|
// Author: Julian Smart and Guillermo Rodriguez Garcia
|
||||||
// Modified by: Francesco Montorsi
|
// Modified by: Francesco Montorsi
|
||||||
// Created: 13/8/99
|
// Created: 13/8/99
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "wx/bitmap.h"
|
#include "wx/bitmap.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxAnimationCtrl
|
// wxGenericAnimationCtrl
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxGenericAnimationCtrl: public wxAnimationCtrlBase
|
class WXDLLIMPEXP_ADV wxGenericAnimationCtrl: public wxAnimationCtrlBase
|
||||||
|
@@ -346,7 +346,7 @@ public:
|
|||||||
@note This method is only available when using the generic version of
|
@note This method is only available when using the generic version of
|
||||||
@c wxAnimation and @c wxAnimationCtrl.
|
@c wxAnimation and @c wxAnimationCtrl.
|
||||||
*/
|
*/
|
||||||
wxPoint GetFramePosition(unsigned int frame) const;
|
virtual wxPoint GetFramePosition(unsigned int frame) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the size of the given animation frame.
|
Returns the size of the given animation frame.
|
||||||
@@ -354,7 +354,7 @@ public:
|
|||||||
@note This method is only available when using the generic version of
|
@note This method is only available when using the generic version of
|
||||||
@c wxAnimation and @c wxAnimationCtrl.
|
@c wxAnimation and @c wxAnimationCtrl.
|
||||||
*/
|
*/
|
||||||
wxSize GetFrameSize(unsigned int frame) const;
|
virtual wxSize GetFrameSize(unsigned int frame) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the type of disposal that should be done for the given
|
Returns the type of disposal that should be done for the given
|
||||||
@@ -363,7 +363,7 @@ public:
|
|||||||
@note This method is only available when using the generic version of
|
@note This method is only available when using the generic version of
|
||||||
@c wxAnimation and @c wxAnimationCtrl.
|
@c wxAnimation and @c wxAnimationCtrl.
|
||||||
*/
|
*/
|
||||||
wxAnimationDisposal GetDisposalMethod(unsigned int frame) const;
|
virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the colour that should be treated as transparent. Returns @c
|
Returns the colour that should be treated as transparent. Returns @c
|
||||||
@@ -373,7 +373,7 @@ public:
|
|||||||
@note This method is only available when using the generic version of
|
@note This method is only available when using the generic version of
|
||||||
@c wxAnimation and @c wxAnimationCtrl.
|
@c wxAnimation and @c wxAnimationCtrl.
|
||||||
*/
|
*/
|
||||||
wxColour GetTransparentColour(unsigned int frame) const;
|
virtual wxColour GetTransparentColour(unsigned int frame) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the colour that should be on the animation's background, if any.
|
Returns the colour that should be on the animation's background, if any.
|
||||||
@@ -382,7 +382,7 @@ public:
|
|||||||
@note This method is only available when using the generic version of
|
@note This method is only available when using the generic version of
|
||||||
@c wxAnimation and @c wxAnimationCtrl.
|
@c wxAnimation and @c wxAnimationCtrl.
|
||||||
*/
|
*/
|
||||||
wxColour GetBackgroundColour() const;
|
virtual wxColour GetBackgroundColour() const;
|
||||||
|
|
||||||
|
|
||||||
static inline wxAnimationDecoderList& GetHandlers();
|
static inline wxAnimationDecoderList& GetHandlers();
|
||||||
|
@@ -34,6 +34,7 @@ const char wxAnimationCtrlNameStr[] = "animationctrl";
|
|||||||
// global object
|
// global object
|
||||||
wxAnimation wxNullAnimation;
|
wxAnimation wxNullAnimation;
|
||||||
|
|
||||||
|
wxIMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxGenericAnimation);
|
||||||
wxIMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl);
|
wxIMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl);
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrl, wxAnimationCtrlBase);
|
wxIMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrl, wxAnimationCtrlBase);
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/generic/animateg.cpp
|
// Name: src/generic/animateg.cpp
|
||||||
// Purpose: wxAnimation and wxAnimationCtrl
|
// Purpose: wxGenericAnimation and wxGenericAnimationCtrl
|
||||||
// Author: Julian Smart and Guillermo Rodriguez Garcia
|
// Author: Julian Smart and Guillermo Rodriguez Garcia
|
||||||
// Modified by: Francesco Montorsi
|
// Modified by: Francesco Montorsi
|
||||||
// Created: 13/8/99
|
// Created: 13/8/99
|
||||||
@@ -32,31 +32,31 @@
|
|||||||
#include "wx/listimpl.cpp"
|
#include "wx/listimpl.cpp"
|
||||||
WX_DEFINE_LIST(wxAnimationDecoderList)
|
WX_DEFINE_LIST(wxAnimationDecoderList)
|
||||||
|
|
||||||
wxAnimationDecoderList wxAnimation::sm_handlers;
|
wxAnimationDecoderList wxGenericAnimation::sm_handlers;
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxAnimation
|
// wxAnimation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxObject);
|
wxIMPLEMENT_DYNAMIC_CLASS(wxGenericAnimation, wxObject);
|
||||||
#define M_ANIMDATA static_cast<wxAnimationDecoder*>(m_refData)
|
#define M_ANIMDATA static_cast<wxAnimationDecoder*>(m_refData)
|
||||||
|
|
||||||
wxSize wxAnimation::GetSize() const
|
wxSize wxGenericAnimation::GetSize() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxDefaultSize, wxT("invalid animation") );
|
wxCHECK_MSG( IsOk(), wxDefaultSize, wxT("invalid animation") );
|
||||||
|
|
||||||
return M_ANIMDATA->GetAnimationSize();
|
return M_ANIMDATA->GetAnimationSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int wxAnimation::GetFrameCount() const
|
unsigned int wxGenericAnimation::GetFrameCount() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") );
|
wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") );
|
||||||
|
|
||||||
return M_ANIMDATA->GetFrameCount();
|
return M_ANIMDATA->GetFrameCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxImage wxAnimation::GetFrame(unsigned int i) const
|
wxImage wxGenericAnimation::GetFrame(unsigned int i) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxNullImage, wxT("invalid animation") );
|
wxCHECK_MSG( IsOk(), wxNullImage, wxT("invalid animation") );
|
||||||
|
|
||||||
@@ -66,49 +66,49 @@ wxImage wxAnimation::GetFrame(unsigned int i) const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxAnimation::GetDelay(unsigned int i) const
|
int wxGenericAnimation::GetDelay(unsigned int i) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") );
|
wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") );
|
||||||
|
|
||||||
return M_ANIMDATA->GetDelay(i);
|
return M_ANIMDATA->GetDelay(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint wxAnimation::GetFramePosition(unsigned int frame) const
|
wxPoint wxGenericAnimation::GetFramePosition(unsigned int frame) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxDefaultPosition, wxT("invalid animation") );
|
wxCHECK_MSG( IsOk(), wxDefaultPosition, wxT("invalid animation") );
|
||||||
|
|
||||||
return M_ANIMDATA->GetFramePosition(frame);
|
return M_ANIMDATA->GetFramePosition(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxAnimation::GetFrameSize(unsigned int frame) const
|
wxSize wxGenericAnimation::GetFrameSize(unsigned int frame) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxDefaultSize, wxT("invalid animation") );
|
wxCHECK_MSG( IsOk(), wxDefaultSize, wxT("invalid animation") );
|
||||||
|
|
||||||
return M_ANIMDATA->GetFrameSize(frame);
|
return M_ANIMDATA->GetFrameSize(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxAnimationDisposal wxAnimation::GetDisposalMethod(unsigned int frame) const
|
wxAnimationDisposal wxGenericAnimation::GetDisposalMethod(unsigned int frame) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxANIM_UNSPECIFIED, wxT("invalid animation") );
|
wxCHECK_MSG( IsOk(), wxANIM_UNSPECIFIED, wxT("invalid animation") );
|
||||||
|
|
||||||
return M_ANIMDATA->GetDisposalMethod(frame);
|
return M_ANIMDATA->GetDisposalMethod(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour wxAnimation::GetTransparentColour(unsigned int frame) const
|
wxColour wxGenericAnimation::GetTransparentColour(unsigned int frame) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid animation") );
|
wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid animation") );
|
||||||
|
|
||||||
return M_ANIMDATA->GetTransparentColour(frame);
|
return M_ANIMDATA->GetTransparentColour(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour wxAnimation::GetBackgroundColour() const
|
wxColour wxGenericAnimation::GetBackgroundColour() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid animation") );
|
wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid animation") );
|
||||||
|
|
||||||
return M_ANIMDATA->GetBackgroundColour();
|
return M_ANIMDATA->GetBackgroundColour();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxAnimation::LoadFile(const wxString& filename, wxAnimationType type)
|
bool wxGenericAnimation::LoadFile(const wxString& filename, wxAnimationType type)
|
||||||
{
|
{
|
||||||
wxFileInputStream stream(filename);
|
wxFileInputStream stream(filename);
|
||||||
if ( !stream.IsOk() )
|
if ( !stream.IsOk() )
|
||||||
@@ -117,7 +117,7 @@ bool wxAnimation::LoadFile(const wxString& filename, wxAnimationType type)
|
|||||||
return Load(stream, type);
|
return Load(stream, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type)
|
bool wxGenericAnimation::Load(wxInputStream &stream, wxAnimationType type)
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type)
|
|||||||
// animation decoders
|
// animation decoders
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxAnimation::AddHandler( wxAnimationDecoder *handler )
|
void wxGenericAnimation::AddHandler( wxAnimationDecoder *handler )
|
||||||
{
|
{
|
||||||
// Check for an existing handler of the type being added.
|
// Check for an existing handler of the type being added.
|
||||||
if (FindHandler( handler->GetType() ) == 0)
|
if (FindHandler( handler->GetType() ) == 0)
|
||||||
@@ -190,7 +190,7 @@ void wxAnimation::AddHandler( wxAnimationDecoder *handler )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxAnimation::InsertHandler( wxAnimationDecoder *handler )
|
void wxGenericAnimation::InsertHandler( wxAnimationDecoder *handler )
|
||||||
{
|
{
|
||||||
// Check for an existing handler of the type being added.
|
// Check for an existing handler of the type being added.
|
||||||
if (FindHandler( handler->GetType() ) == 0)
|
if (FindHandler( handler->GetType() ) == 0)
|
||||||
@@ -206,7 +206,7 @@ void wxAnimation::InsertHandler( wxAnimationDecoder *handler )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxAnimationDecoder *wxAnimation::FindHandler( wxAnimationType animType )
|
const wxAnimationDecoder *wxGenericAnimation::FindHandler( wxAnimationType animType )
|
||||||
{
|
{
|
||||||
wxAnimationDecoderList::compatibility_iterator node = sm_handlers.GetFirst();
|
wxAnimationDecoderList::compatibility_iterator node = sm_handlers.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -218,7 +218,7 @@ const wxAnimationDecoder *wxAnimation::FindHandler( wxAnimationType animType )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxAnimation::InitStandardHandlers()
|
void wxGenericAnimation::InitStandardHandlers()
|
||||||
{
|
{
|
||||||
#if wxUSE_GIF
|
#if wxUSE_GIF
|
||||||
AddHandler(new wxGIFDecoder);
|
AddHandler(new wxGIFDecoder);
|
||||||
@@ -228,7 +228,7 @@ void wxAnimation::InitStandardHandlers()
|
|||||||
#endif // wxUSE_ICO_CUR
|
#endif // wxUSE_ICO_CUR
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxAnimation::CleanUpHandlers()
|
void wxGenericAnimation::CleanUpHandlers()
|
||||||
{
|
{
|
||||||
wxAnimationDecoderList::compatibility_iterator node = sm_handlers.GetFirst();
|
wxAnimationDecoderList::compatibility_iterator node = sm_handlers.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -252,8 +252,8 @@ class wxAnimationModule: public wxModule
|
|||||||
wxDECLARE_DYNAMIC_CLASS(wxAnimationModule);
|
wxDECLARE_DYNAMIC_CLASS(wxAnimationModule);
|
||||||
public:
|
public:
|
||||||
wxAnimationModule() {}
|
wxAnimationModule() {}
|
||||||
bool OnInit() wxOVERRIDE { wxAnimation::InitStandardHandlers(); return true; }
|
bool OnInit() wxOVERRIDE { wxGenericAnimation::InitStandardHandlers(); return true; }
|
||||||
void OnExit() wxOVERRIDE { wxAnimation::CleanUpHandlers(); }
|
void OnExit() wxOVERRIDE { wxGenericAnimation::CleanUpHandlers(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS(wxAnimationModule, wxModule);
|
wxIMPLEMENT_DYNAMIC_CLASS(wxAnimationModule, wxModule);
|
||||||
|
Reference in New Issue
Block a user