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_ANIMATEH__
13 #define _WX_ANIMATEH__
17 #if wxUSE_ANIMATIONCTRL
19 #include "wx/animdecod.h"
20 #include "wx/control.h"
22 #include "wx/bitmap.h"
24 class WXDLLIMPEXP_ADV wxAnimation
;
26 extern WXDLLIMPEXP_DATA_ADV(wxAnimation
) wxNullAnimation
;
27 extern WXDLLIMPEXP_DATA_ADV(const wxChar
) wxAnimationCtrlNameStr
[];
30 // ----------------------------------------------------------------------------
32 // ----------------------------------------------------------------------------
34 class WXDLLIMPEXP_ADV wxAnimationBase
: public wxGDIObject
39 virtual bool IsOk() const = 0;
42 virtual int GetDelay(size_t i
) const = 0;
44 virtual size_t GetFrameCount() const = 0;
45 virtual wxImage
GetFrame(size_t i
) const = 0;
46 virtual wxSize
GetSize() const = 0;
48 virtual bool LoadFile(const wxString
&name
, wxAnimationType type
= wxANIMATION_TYPE_ANY
) = 0;
49 virtual bool Load(wxInputStream
&stream
, wxAnimationType type
= wxANIMATION_TYPE_ANY
) = 0;
52 DECLARE_ABSTRACT_CLASS(wxAnimationBase
)
57 // ----------------------------------------------------------------------------
58 // wxAnimationCtrlBase
59 // ----------------------------------------------------------------------------
61 // do not autoresize to the animation's size when SetAnimation() is called
62 #define wxAC_NO_AUTORESIZE (0x0010)
64 // default style does not include wxAC_NO_AUTORESIZE, that is, the control
65 // auto-resizes by default to fit the new animation when SetAnimation() is called
66 #define wxAC_DEFAULT_STYLE (wxNO_BORDER)
68 class WXDLLIMPEXP_ADV wxAnimationCtrlBase
: public wxControl
71 wxAnimationCtrlBase() {}
75 virtual bool LoadFile(const wxString
& filename
, wxAnimationType type
= wxANIMATION_TYPE_ANY
) = 0;
77 virtual void SetAnimation(const wxAnimation
&anim
) = 0;
78 virtual wxAnimation
GetAnimation() const = 0;
80 virtual bool Play() = 0;
81 virtual void Stop() = 0;
83 virtual bool IsPlaying() const = 0;
85 virtual void SetInactiveBitmap(const wxBitmap
&bmp
);
87 // always return the original bitmap set in this control
88 wxBitmap
GetInactiveBitmap() const
89 { return m_bmpStatic
; }
92 // the inactive bitmap as it was set by the user
95 // the inactive bitmap currently shown in the control
96 // (may differ in the size from m_bmpStatic)
97 wxBitmap m_bmpStaticReal
;
99 // updates m_bmpStaticReal from m_bmpStatic if needed
100 virtual void UpdateStaticImage();
102 // called by SetInactiveBitmap
103 virtual void DisplayStaticImage() = 0;
106 DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase
)
110 // ----------------------------------------------------------------------------
111 // include the platform-specific version of the wxAnimationCtrl class
112 // ----------------------------------------------------------------------------
114 #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
115 #include "wx/gtk/animate.h"
117 #include "wx/generic/animate.h"
120 #endif // wxUSE_ANIMATIONCTRL
122 #endif // _WX_ANIMATEH__