]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/generic/animate.h
set eol-style
[wxWidgets.git] / include / wx / generic / animate.h
index 8b9dc201208df44c567f5f9db0dead0afb685b1f..efc1c2944679bcb2c7e3f4d93606ee903aa6bd11 100644 (file)
 #ifndef _WX_GENERIC_ANIMATEH__
 #define _WX_GENERIC_ANIMATEH__
 
 #ifndef _WX_GENERIC_ANIMATEH__
 #define _WX_GENERIC_ANIMATEH__
 
-#include <wx/defs.h>
-#include <wx/string.h>
-#include <wx/gdicmn.h>
-#include <wx/list.h>
-#include <wx/timer.h>
-#include <wx/bitmap.h>
-#include <wx/colour.h>
-#include <wx/control.h>
-#include <wx/animdecod.h>
-
-class WXDLLIMPEXP_ADV wxAnimationBase;
-class WXDLLIMPEXP_ADV wxAnimationPlayer;
-class WXDLLEXPORT     wxImage;
-class WXDLLEXPORT     wxGIFDecoder;
-class WXDLLIMPEXP_ADV wxAnimation;
-
+#include "wx/bitmap.h"
 
 // ----------------------------------------------------------------------------
 // wxAnimation
 // ----------------------------------------------------------------------------
 
 
 // ----------------------------------------------------------------------------
 // wxAnimation
 // ----------------------------------------------------------------------------
 
-WX_DECLARE_LIST(wxAnimationDecoder, wxAnimationDecoderList);
+WX_DECLARE_LIST_WITH_DECL(wxAnimationDecoder, wxAnimationDecoderList, class WXDLLIMPEXP_ADV);
 
 class WXDLLIMPEXP_ADV wxAnimation : public wxAnimationBase
 {
 public:
 
 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; }
 
         { return m_refData != NULL; }
 
-    size_t GetFrameCount() const;
-    int GetDelay(size_t i) const;
-    wxImage GetFrame(size_t i) const;
-    wxSize GetSize() const;
-
-    bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY);
-    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;
-    wxAnimationDisposal GetDisposalMethod(size_t frame) const;
+    virtual unsigned int GetFrameCount() const;
+    virtual int GetDelay(unsigned int i) const;
+    virtual wxImage GetFrame(unsigned int i) const;
+    virtual wxSize GetSize() const;
+
+    virtual bool LoadFile(const wxString& filename,
+                          wxAnimationType type = wxANIMATION_TYPE_ANY);
+    virtual bool Load(wxInputStream& stream,
+                      wxAnimationType type = wxANIMATION_TYPE_ANY);
+
+    // extended interface used by the generic implementation of wxAnimationCtrl
+    wxPoint GetFramePosition(unsigned int frame) const;
+    wxSize GetFrameSize(unsigned int frame) const;
+    wxAnimationDisposal GetDisposalMethod(unsigned int frame) const;
+    wxColour GetTransparentColour(unsigned int frame) const;
     wxColour GetBackgroundColour() const;
 
 protected:
     wxColour GetBackgroundColour() const;
 
 protected:
@@ -83,7 +55,6 @@ public:
     static void CleanUpHandlers();
     static void InitStandardHandlers();
 
     static void CleanUpHandlers();
     static void InitStandardHandlers();
 
-protected:
     DECLARE_DYNAMIC_CLASS(wxAnimation)
 };
 
     DECLARE_DYNAMIC_CLASS(wxAnimation)
 };
 
@@ -95,7 +66,7 @@ protected:
 class WXDLLIMPEXP_ADV wxAnimationCtrl: public wxAnimationCtrlBase
 {
 public:
 class WXDLLIMPEXP_ADV wxAnimationCtrl: public wxAnimationCtrlBase
 {
 public:
-    wxAnimationCtrl() {}
+    wxAnimationCtrl() { Init(); }
     wxAnimationCtrl(wxWindow *parent,
             wxWindowID id,
             const wxAnimation& anim = wxNullAnimation,
     wxAnimationCtrl(wxWindow *parent,
             wxWindowID id,
             const wxAnimation& anim = wxNullAnimation,
@@ -104,9 +75,13 @@ public:
             long style = wxAC_DEFAULT_STYLE,
             const wxString& name = wxAnimationCtrlNameStr)
     {
             long style = wxAC_DEFAULT_STYLE,
             const wxString& name = wxAnimationCtrlNameStr)
     {
+        Init();
+
         Create(parent, id, anim, pos, size, style, name);
     }
 
         Create(parent, id, anim, pos, size, style, name);
     }
 
+    void Init();
+
     bool Create(wxWindow *parent, wxWindowID id,
                 const wxAnimation& anim = wxNullAnimation,
                 const wxPoint& pos = wxDefaultPosition,
     bool Create(wxWindow *parent, wxWindowID id,
                 const wxAnimation& anim = wxNullAnimation,
                 const wxPoint& pos = wxDefaultPosition,
@@ -129,6 +104,11 @@ public:
     wxAnimation GetAnimation() const
         { return m_animation; }
 
     wxAnimation GetAnimation() const
         { return m_animation; }
 
+    virtual void SetInactiveBitmap(const wxBitmap &bmp);
+
+    // override base class method
+    virtual bool SetBackgroundColour(const wxColour& col);
+
 public:     // event handlers
 
     void OnPaint(wxPaintEvent& event);
 public:     // event handlers
 
     void OnPaint(wxPaintEvent& event);
@@ -161,16 +141,19 @@ protected:      // internal utilities
     void FitToAnimation();
 
     // Draw the background; use this when e.g. previous frame had wxANIM_TOBACKGROUND disposal.
     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);
+    void DisposeToBackground(wxDC& dc, const wxPoint &pos, const wxSize &sz);
 
     void IncrementalUpdateBackingStore();
 
     void IncrementalUpdateBackingStore();
-    void RebuildBackingStoreUpToFrame(size_t);
-    void DrawFrame(wxDC &dc, size_t);
+    bool RebuildBackingStoreUpToFrame(unsigned int);
+    void DrawFrame(wxDC &dc, unsigned int);
 
 
+    virtual void DisplayStaticImage();
     virtual wxSize DoGetBestSize() const;
 
 protected:
     virtual wxSize DoGetBestSize() const;
 
 protected:
-    size_t        m_currentFrame;     // Current frame
+    unsigned int  m_currentFrame;     // Current frame
     bool          m_looped;           // Looped, or not
     wxTimer       m_timer;            // The timer
     wxAnimation   m_animation;        // The animation
     bool          m_looped;           // Looped, or not
     wxTimer       m_timer;            // The timer
     wxAnimation   m_animation;        // The animation
@@ -182,6 +165,7 @@ protected:
                                       // on the screen
 
 private:
                                       // on the screen
 
 private:
+    typedef wxAnimationCtrlBase base_type;
     DECLARE_DYNAMIC_CLASS(wxAnimationCtrl)
     DECLARE_EVENT_TABLE()
 };
     DECLARE_DYNAMIC_CLASS(wxAnimationCtrl)
     DECLARE_EVENT_TABLE()
 };