X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/72045d5768a126191a907bc640c28e81a11afdd6..fae803f27be8ae1c4fe8f8775b333cc0fc80bdee:/include/wx/generic/animate.h diff --git a/include/wx/generic/animate.h b/include/wx/generic/animate.h index a244d32ccd..fd7ee2a824 100644 --- a/include/wx/generic/animate.h +++ b/include/wx/generic/animate.h @@ -12,63 +12,36 @@ #ifndef _WX_GENERIC_ANIMATEH__ #define _WX_GENERIC_ANIMATEH__ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class WXDLLIMPEXP_ADV wxAnimationBase; -class WXDLLIMPEXP_ADV wxAnimationPlayer; -class WXDLLEXPORT wxImage; -class WXDLLEXPORT wxGIFDecoder; -class WXDLLEXPORT wxAnimation; - +#include "wx/bitmap.h" // ---------------------------------------------------------------------------- // wxAnimation // ---------------------------------------------------------------------------- -WX_DECLARE_LIST(wxAnimationDecoder, wxAnimationDecoderList); +WX_DECLARE_LIST_WITH_DECL(wxAnimationDecoder, wxAnimationDecoderList, class WXDLLIMPEXP_ADV); class WXDLLIMPEXP_ADV wxAnimation : public wxAnimationBase { public: - wxAnimation(const wxAnimation &tocopy) - { Ref(tocopy); } - wxAnimation() {} - ~wxAnimation() { UnRef(); } - - wxAnimation &operator= (const wxAnimation &tocopy) - { - Ref(tocopy); - return *this; - } - - bool operator == (const wxAnimation& anim) const - { return m_refData == anim.m_refData; } - bool operator != (const wxAnimation& anim) const - { return m_refData != anim.m_refData; } - - bool IsOk() const + virtual bool IsOk() const { return m_refData != NULL; } - size_t GetFrameCount() const; - int GetDelay(size_t i) const; - wxImage GetFrame(size_t i) const; - wxSize GetSize() const; + virtual size_t GetFrameCount() const; + virtual int GetDelay(size_t i) const; + virtual wxImage GetFrame(size_t i) const; + virtual wxSize GetSize() const; - bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY); - bool Load(wxInputStream &stream, wxAnimationType type = wxANIMATION_TYPE_ANY); + virtual bool LoadFile(const wxString& filename, + wxAnimationType type = wxANIMATION_TYPE_ANY); + virtual bool Load(wxInputStream& stream, + wxAnimationType type = wxANIMATION_TYPE_ANY); public: // extended interface used by the generic implementation of wxAnimationCtrl wxPoint GetFramePosition(size_t frame) const; + wxSize GetFrameSize(size_t frame) const; wxAnimationDisposal GetDisposalMethod(size_t frame) const; + wxColour GetTransparentColour(size_t frame) const; wxColour GetBackgroundColour() const; protected: @@ -83,7 +56,6 @@ public: static void CleanUpHandlers(); static void InitStandardHandlers(); -protected: DECLARE_DYNAMIC_CLASS(wxAnimation) }; @@ -95,7 +67,7 @@ protected: class WXDLLIMPEXP_ADV wxAnimationCtrl: public wxAnimationCtrlBase { public: - wxAnimationCtrl() {} + wxAnimationCtrl() { Init(); } wxAnimationCtrl(wxWindow *parent, wxWindowID id, const wxAnimation& anim = wxNullAnimation, @@ -104,9 +76,13 @@ public: long style = wxAC_DEFAULT_STYLE, const wxString& name = wxAnimationCtrlNameStr) { + Init(); + Create(parent, id, anim, pos, size, style, name); } + void Init(); + bool Create(wxWindow *parent, wxWindowID id, const wxAnimation& anim = wxNullAnimation, const wxPoint& pos = wxDefaultPosition, @@ -129,6 +105,8 @@ public: wxAnimation GetAnimation() const { return m_animation; } + void SetInactiveBitmap(const wxBitmap &bmp); + public: // event handlers void OnPaint(wxPaintEvent& event); @@ -161,10 +139,13 @@ protected: // internal utilities void FitToAnimation(); // Draw the background; use this when e.g. previous frame had wxANIM_TOBACKGROUND disposal. + void DisposeToBackground(); void DisposeToBackground(wxDC& dc); + void DisposeToBackground(wxDC& dc, const wxPoint &pos, const wxSize &sz); + void UpdateBackingStoreWithStaticImage(); void IncrementalUpdateBackingStore(); - void RebuildBackingStoreUpToFrame(size_t); + bool RebuildBackingStoreUpToFrame(size_t); void DrawFrame(wxDC &dc, size_t); virtual wxSize DoGetBestSize() const; @@ -182,6 +163,7 @@ protected: // on the screen private: + typedef wxAnimationCtrlBase base_type; DECLARE_DYNAMIC_CLASS(wxAnimationCtrl) DECLARE_EVENT_TABLE() };