1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxAnimation and wxAnimationCtrl
4 // Author: Julian Smart and Guillermo Rodriguez Garcia
5 // Modified by: Francesco Montorsi
7 // Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_ANIMATE_H_
12 #define _WX_ANIMATE_H_
16 #if wxUSE_ANIMATIONCTRL
18 #include "wx/animdecod.h"
19 #include "wx/control.h"
21 #include "wx/bitmap.h"
23 class WXDLLIMPEXP_FWD_ADV wxAnimation
;
25 extern WXDLLIMPEXP_DATA_ADV(wxAnimation
) wxNullAnimation
;
26 extern WXDLLIMPEXP_DATA_ADV(const char) wxAnimationCtrlNameStr
[];
29 // ----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
33 class WXDLLIMPEXP_ADV wxAnimationBase
: public wxObject
38 virtual bool IsOk() const = 0;
41 virtual int GetDelay(unsigned int frame
) const = 0;
43 virtual unsigned int GetFrameCount() const = 0;
44 virtual wxImage
GetFrame(unsigned int frame
) const = 0;
45 virtual wxSize
GetSize() const = 0;
47 virtual bool LoadFile(const wxString
& name
,
48 wxAnimationType type
= wxANIMATION_TYPE_ANY
) = 0;
49 virtual bool Load(wxInputStream
& stream
,
50 wxAnimationType type
= wxANIMATION_TYPE_ANY
) = 0;
53 DECLARE_ABSTRACT_CLASS(wxAnimationBase
)
58 // ----------------------------------------------------------------------------
59 // wxAnimationCtrlBase
60 // ----------------------------------------------------------------------------
62 // do not autoresize to the animation's size when SetAnimation() is called
63 #define wxAC_NO_AUTORESIZE (0x0010)
65 // default style does not include wxAC_NO_AUTORESIZE, that is, the control
66 // auto-resizes by default to fit the new animation when SetAnimation() is called
67 #define wxAC_DEFAULT_STYLE (wxBORDER_NONE)
69 class WXDLLIMPEXP_ADV wxAnimationCtrlBase
: public wxControl
72 wxAnimationCtrlBase() { }
75 virtual bool LoadFile(const wxString
& filename
,
76 wxAnimationType type
= wxANIMATION_TYPE_ANY
) = 0;
77 virtual bool Load(wxInputStream
& stream
,
78 wxAnimationType type
= wxANIMATION_TYPE_ANY
) = 0;
80 virtual void SetAnimation(const wxAnimation
&anim
) = 0;
81 virtual wxAnimation
GetAnimation() const = 0;
83 virtual bool Play() = 0;
84 virtual void Stop() = 0;
86 virtual bool IsPlaying() const = 0;
88 virtual void SetInactiveBitmap(const wxBitmap
&bmp
);
90 // always return the original bitmap set in this control
91 wxBitmap
GetInactiveBitmap() const
92 { return m_bmpStatic
; }
95 // the inactive bitmap as it was set by the user
98 // the inactive bitmap currently shown in the control
99 // (may differ in the size from m_bmpStatic)
100 wxBitmap m_bmpStaticReal
;
102 // updates m_bmpStaticReal from m_bmpStatic if needed
103 virtual void UpdateStaticImage();
105 // called by SetInactiveBitmap
106 virtual void DisplayStaticImage() = 0;
109 DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase
)
113 // ----------------------------------------------------------------------------
114 // include the platform-specific version of the wxAnimationCtrl class
115 // ----------------------------------------------------------------------------
117 #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
118 #include "wx/gtk/animate.h"
120 #include "wx/generic/animate.h"
123 #endif // wxUSE_ANIMATIONCTRL
125 #endif // _WX_ANIMATE_H_