1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxAnimation and wxAnimationCtrl
4 // Author: Julian Smart and Guillermo Rodriguez Garcia
5 // Modified by: Francesco Montorsi
8 // Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_ANIMATE_H_
13 #define _WX_ANIMATE_H_
17 #if wxUSE_ANIMATIONCTRL
19 #include "wx/animdecod.h"
20 #include "wx/control.h"
22 #include "wx/bitmap.h"
24 class WXDLLIMPEXP_FWD_ADV wxAnimation
;
26 extern WXDLLIMPEXP_DATA_ADV(wxAnimation
) wxNullAnimation
;
27 extern WXDLLIMPEXP_DATA_ADV(const char) wxAnimationCtrlNameStr
[];
30 // ----------------------------------------------------------------------------
32 // ----------------------------------------------------------------------------
34 class WXDLLIMPEXP_ADV wxAnimationBase
: public wxObject
39 virtual bool IsOk() const = 0;
42 virtual int GetDelay(unsigned int frame
) const = 0;
44 virtual unsigned int GetFrameCount() const = 0;
45 virtual wxImage
GetFrame(unsigned int frame
) const = 0;
46 virtual wxSize
GetSize() const = 0;
48 virtual bool LoadFile(const wxString
& name
,
49 wxAnimationType type
= wxANIMATION_TYPE_ANY
) = 0;
50 virtual bool Load(wxInputStream
& stream
,
51 wxAnimationType type
= wxANIMATION_TYPE_ANY
) = 0;
54 DECLARE_ABSTRACT_CLASS(wxAnimationBase
)
59 // ----------------------------------------------------------------------------
60 // wxAnimationCtrlBase
61 // ----------------------------------------------------------------------------
63 // do not autoresize to the animation's size when SetAnimation() is called
64 #define wxAC_NO_AUTORESIZE (0x0010)
66 // default style does not include wxAC_NO_AUTORESIZE, that is, the control
67 // auto-resizes by default to fit the new animation when SetAnimation() is called
68 #define wxAC_DEFAULT_STYLE (wxBORDER_NONE)
70 class WXDLLIMPEXP_ADV wxAnimationCtrlBase
: public wxControl
73 wxAnimationCtrlBase() { }
76 virtual bool LoadFile(const wxString
& filename
,
77 wxAnimationType type
= wxANIMATION_TYPE_ANY
) = 0;
78 virtual bool Load(wxInputStream
& stream
,
79 wxAnimationType type
= wxANIMATION_TYPE_ANY
) = 0;
81 virtual void SetAnimation(const wxAnimation
&anim
) = 0;
82 virtual wxAnimation
GetAnimation() const = 0;
84 virtual bool Play() = 0;
85 virtual void Stop() = 0;
87 virtual bool IsPlaying() const = 0;
89 virtual void SetInactiveBitmap(const wxBitmap
&bmp
);
91 // always return the original bitmap set in this control
92 wxBitmap
GetInactiveBitmap() const
93 { return m_bmpStatic
; }
96 // the inactive bitmap as it was set by the user
99 // the inactive bitmap currently shown in the control
100 // (may differ in the size from m_bmpStatic)
101 wxBitmap m_bmpStaticReal
;
103 // updates m_bmpStaticReal from m_bmpStatic if needed
104 virtual void UpdateStaticImage();
106 // called by SetInactiveBitmap
107 virtual void DisplayStaticImage() = 0;
110 DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase
)
114 // ----------------------------------------------------------------------------
115 // include the platform-specific version of the wxAnimationCtrl class
116 // ----------------------------------------------------------------------------
118 #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
119 #include "wx/gtk/animate.h"
121 #include "wx/generic/animate.h"
124 #endif // wxUSE_ANIMATIONCTRL
126 #endif // _WX_ANIMATE_H_