]> git.saurik.com Git - wxWidgets.git/blob - include/wx/animate.h
updated version to 2.8.1
[wxWidgets.git] / include / wx / animate.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/animate.h
3 // Purpose: wxAnimation and wxAnimationCtrl
4 // Author: Julian Smart and Guillermo Rodriguez Garcia
5 // Modified by: Francesco Montorsi
6 // Created: 13/8/99
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_ANIMATE_H_
13 #define _WX_ANIMATE_H_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_ANIMATIONCTRL
18
19 #include "wx/animdecod.h"
20 #include "wx/control.h"
21 #include "wx/timer.h"
22 #include "wx/bitmap.h"
23
24 class WXDLLIMPEXP_ADV wxAnimation;
25
26 extern WXDLLIMPEXP_DATA_ADV(wxAnimation) wxNullAnimation;
27 extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxAnimationCtrlNameStr[];
28
29
30 // ----------------------------------------------------------------------------
31 // wxAnimationBase
32 // ----------------------------------------------------------------------------
33
34 class WXDLLIMPEXP_ADV wxAnimationBase : public wxGDIObject
35 {
36 public:
37 wxAnimationBase() {}
38
39 virtual bool IsOk() const = 0;
40
41 // can be -1
42 virtual int GetDelay(unsigned int frame) const = 0;
43
44 virtual unsigned int GetFrameCount() const = 0;
45 virtual wxImage GetFrame(unsigned int frame) const = 0;
46 virtual wxSize GetSize() const = 0;
47
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;
52
53 protected:
54 DECLARE_ABSTRACT_CLASS(wxAnimationBase)
55 };
56
57
58
59 // ----------------------------------------------------------------------------
60 // wxAnimationCtrlBase
61 // ----------------------------------------------------------------------------
62
63 // do not autoresize to the animation's size when SetAnimation() is called
64 #define wxAC_NO_AUTORESIZE (0x0010)
65
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 (wxNO_BORDER)
69
70 class WXDLLIMPEXP_ADV wxAnimationCtrlBase : public wxControl
71 {
72 public:
73 wxAnimationCtrlBase() { }
74
75 // public API
76 virtual bool LoadFile(const wxString& filename,
77 wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
78
79 virtual void SetAnimation(const wxAnimation &anim) = 0;
80 virtual wxAnimation GetAnimation() const = 0;
81
82 virtual bool Play() = 0;
83 virtual void Stop() = 0;
84
85 virtual bool IsPlaying() const = 0;
86
87 virtual void SetInactiveBitmap(const wxBitmap &bmp);
88
89 // always return the original bitmap set in this control
90 wxBitmap GetInactiveBitmap() const
91 { return m_bmpStatic; }
92
93 protected:
94 // the inactive bitmap as it was set by the user
95 wxBitmap m_bmpStatic;
96
97 // the inactive bitmap currently shown in the control
98 // (may differ in the size from m_bmpStatic)
99 wxBitmap m_bmpStaticReal;
100
101 // updates m_bmpStaticReal from m_bmpStatic if needed
102 virtual void UpdateStaticImage();
103
104 // called by SetInactiveBitmap
105 virtual void DisplayStaticImage() = 0;
106
107 private:
108 DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase)
109 };
110
111
112 // ----------------------------------------------------------------------------
113 // include the platform-specific version of the wxAnimationCtrl class
114 // ----------------------------------------------------------------------------
115
116 #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
117 #include "wx/gtk/animate.h"
118 #else
119 #include "wx/generic/animate.h"
120 #endif
121
122 #endif // wxUSE_ANIMATIONCTRL
123
124 #endif // _WX_ANIMATE_H_