diff --git a/include/wx/animate.h b/include/wx/animate.h index e731aae1be..b6b1ea2706 100644 --- a/include/wx/animate.h +++ b/include/wx/animate.h @@ -21,6 +21,7 @@ #include "wx/bitmap.h" class WXDLLIMPEXP_FWD_CORE wxAnimation; +//class WXDLLIMPEXP_FWD_CORE wxAnimationGeneric; extern WXDLLIMPEXP_DATA_CORE(wxAnimation) wxNullAnimation; 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); -class WXDLLIMPEXP_ADV wxAnimation : public wxObject +class WXDLLIMPEXP_ADV wxGenericAnimation : public wxObject { public: - wxAnimation() {} - wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY) + wxGenericAnimation() {} + wxGenericAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY) { LoadFile(name, type); } virtual bool IsOk() const @@ -71,7 +72,7 @@ public: static void CleanUpHandlers(); static void InitStandardHandlers(); - wxDECLARE_DYNAMIC_CLASS(wxAnimation); + wxDECLARE_DYNAMIC_CLASS(wxGenericAnimation); }; @@ -138,6 +139,18 @@ private: #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/animate.h" #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" class WXDLLIMPEXP_ADV wxAnimationCtrl : public wxGenericAnimationCtrl diff --git a/include/wx/generic/animate.h b/include/wx/generic/animate.h index fe38bd7ef2..b8b2407cf4 100644 --- a/include/wx/generic/animate.h +++ b/include/wx/generic/animate.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/generic/animate.h -// Purpose: wxAnimation and wxAnimationCtrl +// Purpose: wxGenericAnimation and wxGenericAnimationCtrl // Author: Julian Smart and Guillermo Rodriguez Garcia // Modified by: Francesco Montorsi // Created: 13/8/99 @@ -14,7 +14,7 @@ #include "wx/bitmap.h" // ---------------------------------------------------------------------------- -// wxAnimationCtrl +// wxGenericAnimationCtrl // ---------------------------------------------------------------------------- class WXDLLIMPEXP_ADV wxGenericAnimationCtrl: public wxAnimationCtrlBase diff --git a/interface/wx/animate.h b/interface/wx/animate.h index 612665c474..55d924e1e5 100644 --- a/interface/wx/animate.h +++ b/interface/wx/animate.h @@ -346,7 +346,7 @@ public: @note This method is only available when using the generic version of @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. @@ -354,7 +354,7 @@ public: @note This method is only available when using the generic version of @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 @@ -363,7 +363,7 @@ public: @note This method is only available when using the generic version of @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 @@ -373,7 +373,7 @@ public: @note This method is only available when using the generic version of @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. @@ -382,7 +382,7 @@ public: @note This method is only available when using the generic version of @c wxAnimation and @c wxAnimationCtrl. */ - wxColour GetBackgroundColour() const; + virtual wxColour GetBackgroundColour() const; static inline wxAnimationDecoderList& GetHandlers(); diff --git a/src/common/animatecmn.cpp b/src/common/animatecmn.cpp index 561463a83d..323fc702a2 100644 --- a/src/common/animatecmn.cpp +++ b/src/common/animatecmn.cpp @@ -34,6 +34,7 @@ const char wxAnimationCtrlNameStr[] = "animationctrl"; // global object wxAnimation wxNullAnimation; +wxIMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxGenericAnimation); wxIMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl); wxIMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrl, wxAnimationCtrlBase); diff --git a/src/generic/animateg.cpp b/src/generic/animateg.cpp index 423784a53b..b9dd67b64f 100644 --- a/src/generic/animateg.cpp +++ b/src/generic/animateg.cpp @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // Name: src/generic/animateg.cpp -// Purpose: wxAnimation and wxAnimationCtrl +// Purpose: wxGenericAnimation and wxGenericAnimationCtrl // Author: Julian Smart and Guillermo Rodriguez Garcia // Modified by: Francesco Montorsi // Created: 13/8/99 @@ -32,31 +32,31 @@ #include "wx/listimpl.cpp" WX_DEFINE_LIST(wxAnimationDecoderList) -wxAnimationDecoderList wxAnimation::sm_handlers; +wxAnimationDecoderList wxGenericAnimation::sm_handlers; // ---------------------------------------------------------------------------- // wxAnimation // ---------------------------------------------------------------------------- -wxIMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericAnimation, wxObject); #define M_ANIMDATA static_cast(m_refData) -wxSize wxAnimation::GetSize() const +wxSize wxGenericAnimation::GetSize() const { wxCHECK_MSG( IsOk(), wxDefaultSize, wxT("invalid animation") ); return M_ANIMDATA->GetAnimationSize(); } -unsigned int wxAnimation::GetFrameCount() const +unsigned int wxGenericAnimation::GetFrameCount() const { wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") ); 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") ); @@ -66,49 +66,49 @@ wxImage wxAnimation::GetFrame(unsigned int i) const return ret; } -int wxAnimation::GetDelay(unsigned int i) const +int wxGenericAnimation::GetDelay(unsigned int i) const { wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") ); 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") ); 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") ); 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") ); 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") ); return M_ANIMDATA->GetTransparentColour(frame); } -wxColour wxAnimation::GetBackgroundColour() const +wxColour wxGenericAnimation::GetBackgroundColour() const { wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid animation") ); return M_ANIMDATA->GetBackgroundColour(); } -bool wxAnimation::LoadFile(const wxString& filename, wxAnimationType type) +bool wxGenericAnimation::LoadFile(const wxString& filename, wxAnimationType type) { wxFileInputStream stream(filename); if ( !stream.IsOk() ) @@ -117,7 +117,7 @@ bool wxAnimation::LoadFile(const wxString& filename, wxAnimationType type) return Load(stream, type); } -bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type) +bool wxGenericAnimation::Load(wxInputStream &stream, wxAnimationType type) { UnRef(); @@ -170,7 +170,7 @@ bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type) // animation decoders // ---------------------------------------------------------------------------- -void wxAnimation::AddHandler( wxAnimationDecoder *handler ) +void wxGenericAnimation::AddHandler( wxAnimationDecoder *handler ) { // Check for an existing handler of the type being added. 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. 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(); while (node) @@ -218,7 +218,7 @@ const wxAnimationDecoder *wxAnimation::FindHandler( wxAnimationType animType ) return 0; } -void wxAnimation::InitStandardHandlers() +void wxGenericAnimation::InitStandardHandlers() { #if wxUSE_GIF AddHandler(new wxGIFDecoder); @@ -228,7 +228,7 @@ void wxAnimation::InitStandardHandlers() #endif // wxUSE_ICO_CUR } -void wxAnimation::CleanUpHandlers() +void wxGenericAnimation::CleanUpHandlers() { wxAnimationDecoderList::compatibility_iterator node = sm_handlers.GetFirst(); while (node) @@ -252,8 +252,8 @@ class wxAnimationModule: public wxModule wxDECLARE_DYNAMIC_CLASS(wxAnimationModule); public: wxAnimationModule() {} - bool OnInit() wxOVERRIDE { wxAnimation::InitStandardHandlers(); return true; } - void OnExit() wxOVERRIDE { wxAnimation::CleanUpHandlers(); } + bool OnInit() wxOVERRIDE { wxGenericAnimation::InitStandardHandlers(); return true; } + void OnExit() wxOVERRIDE { wxGenericAnimation::CleanUpHandlers(); } }; wxIMPLEMENT_DYNAMIC_CLASS(wxAnimationModule, wxModule);