X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/943d32e1c6fbd658b6e460fcb20058d3958f5d77..438959cca892a7651634cc3a7aad4819ac49b23c:/include/wx/animate.h diff --git a/include/wx/animate.h b/include/wx/animate.h index c10a05ba47..fd9ca49320 100644 --- a/include/wx/animate.h +++ b/include/wx/animate.h @@ -9,34 +9,29 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_ANIMATEH__ -#define _WX_ANIMATEH__ +#ifndef _WX_ANIMATE_H_ +#define _WX_ANIMATE_H_ #include "wx/defs.h" #if wxUSE_ANIMATIONCTRL -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "wx/animdecod.h" +#include "wx/control.h" +#include "wx/timer.h" +#include "wx/bitmap.h" -class WXDLLIMPEXP_ADV wxAnimation; +class WXDLLIMPEXP_FWD_ADV wxAnimation; extern WXDLLIMPEXP_DATA_ADV(wxAnimation) wxNullAnimation; -extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxAnimationCtrlNameStr[]; +extern WXDLLIMPEXP_DATA_ADV(const char) wxAnimationCtrlNameStr[]; // ---------------------------------------------------------------------------- // wxAnimationBase // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_ADV wxAnimationBase : public wxGDIObject +class WXDLLIMPEXP_ADV wxAnimationBase : public wxObject { public: wxAnimationBase() {} @@ -44,14 +39,16 @@ public: virtual bool IsOk() const = 0; // can be -1 - virtual int GetDelay(size_t i) const = 0; + virtual int GetDelay(unsigned int frame) const = 0; - virtual size_t GetFrameCount() const = 0; - virtual wxImage GetFrame(size_t i) const = 0; + virtual unsigned int GetFrameCount() const = 0; + virtual wxImage GetFrame(unsigned int frame) const = 0; virtual wxSize GetSize() const = 0; - virtual bool LoadFile(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; - virtual bool Load(wxInputStream &stream, wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; + virtual bool LoadFile(const wxString& name, + wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; + virtual bool Load(wxInputStream& stream, + wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; protected: DECLARE_ABSTRACT_CLASS(wxAnimationBase) @@ -68,17 +65,18 @@ protected: // default style does not include wxAC_NO_AUTORESIZE, that is, the control // auto-resizes by default to fit the new animation when SetAnimation() is called -#define wxAC_DEFAULT_STYLE (wxNO_BORDER) - +#define wxAC_DEFAULT_STYLE (wxBORDER_NONE) class WXDLLIMPEXP_ADV wxAnimationCtrlBase : public wxControl { public: - wxAnimationCtrlBase() {} - -public: // public API + wxAnimationCtrlBase() { } - virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; + // public API + virtual bool LoadFile(const wxString& filename, + wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; + virtual bool Load(wxInputStream& stream, + wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; virtual void SetAnimation(const wxAnimation &anim) = 0; virtual wxAnimation GetAnimation() const = 0; @@ -88,6 +86,26 @@ public: // public API virtual bool IsPlaying() const = 0; + virtual void SetInactiveBitmap(const wxBitmap &bmp); + + // always return the original bitmap set in this control + wxBitmap GetInactiveBitmap() const + { return m_bmpStatic; } + +protected: + // the inactive bitmap as it was set by the user + wxBitmap m_bmpStatic; + + // the inactive bitmap currently shown in the control + // (may differ in the size from m_bmpStatic) + wxBitmap m_bmpStaticReal; + + // updates m_bmpStaticReal from m_bmpStatic if needed + virtual void UpdateStaticImage(); + + // called by SetInactiveBitmap + virtual void DisplayStaticImage() = 0; + private: DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase) }; @@ -97,12 +115,12 @@ private: // include the platform-specific version of the wxAnimationCtrl class // ---------------------------------------------------------------------------- -#if defined(__WXGTK__) +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/animate.h" #else #include "wx/generic/animate.h" #endif -#endif // wxUSE_ANIMATIONCTRL +#endif // wxUSE_ANIMATIONCTRL -#endif // _WX_ANIMATEH__ +#endif // _WX_ANIMATE_H_