]> git.saurik.com Git - wxWidgets.git/blob - include/wx/animate.h
Rewrite selection event code for wxListBox.
[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_ANIMATEH__
13 #define _WX_ANIMATEH__
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(size_t i) const = 0;
43
44 virtual size_t GetFrameCount() const = 0;
45 virtual wxImage GetFrame(size_t i) const = 0;
46 virtual wxSize GetSize() const = 0;
47
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;
50
51 protected:
52 DECLARE_ABSTRACT_CLASS(wxAnimationBase)
53 };
54
55
56
57 // ----------------------------------------------------------------------------
58 // wxAnimationCtrlBase
59 // ----------------------------------------------------------------------------
60
61 // do not autoresize to the animation's size when SetAnimation() is called
62 #define wxAC_NO_AUTORESIZE (0x0010)
63
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)
67
68 class WXDLLIMPEXP_ADV wxAnimationCtrlBase : public wxControl
69 {
70 public:
71 wxAnimationCtrlBase() {}
72
73 public: // public API
74
75 virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
76
77 virtual void SetAnimation(const wxAnimation &anim) = 0;
78 virtual wxAnimation GetAnimation() const = 0;
79
80 virtual bool Play() = 0;
81 virtual void Stop() = 0;
82
83 virtual bool IsPlaying() const = 0;
84
85 virtual void SetInactiveBitmap(const wxBitmap &bmp);
86 wxBitmap GetInactiveBitmap() const
87 { return m_bmpStatic; }
88
89 protected:
90 wxBitmap m_bmpStatic;
91
92 private:
93 DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase)
94 };
95
96
97 // ----------------------------------------------------------------------------
98 // include the platform-specific version of the wxAnimationCtrl class
99 // ----------------------------------------------------------------------------
100
101 #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
102 #include "wx/gtk/animate.h"
103 #else
104 #include "wx/generic/animate.h"
105 #endif
106
107 #endif // wxUSE_ANIMATIONCTRL
108
109 #endif // _WX_ANIMATEH__