]>
Commit | Line | Data |
---|---|---|
72045d57 VZ |
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 | ||
c2f12218 PC |
19 | #include "wx/animdecod.h" |
20 | #include "wx/control.h" | |
21 | #include "wx/timer.h" | |
8e458bb5 | 22 | #include "wx/bitmap.h" |
72045d57 VZ |
23 | |
24 | class WXDLLIMPEXP_ADV wxAnimation; | |
25 | ||
943d32e1 RD |
26 | extern WXDLLIMPEXP_DATA_ADV(wxAnimation) wxNullAnimation; |
27 | extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxAnimationCtrlNameStr[]; | |
72045d57 VZ |
28 | |
29 | ||
30 | // ---------------------------------------------------------------------------- | |
31 | // wxAnimationBase | |
32 | // ---------------------------------------------------------------------------- | |
33 | ||
943d32e1 | 34 | class WXDLLIMPEXP_ADV wxAnimationBase : public wxGDIObject |
72045d57 VZ |
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 | ||
72045d57 VZ |
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 | ||
1bd2ceb5 RR |
85 | virtual void SetInactiveBitmap(const wxBitmap &bmp); |
86 | ||
87 | // always return the original bitmap set in this control | |
8e458bb5 RR |
88 | wxBitmap GetInactiveBitmap() const |
89 | { return m_bmpStatic; } | |
90 | ||
91 | protected: | |
1bd2ceb5 | 92 | // the inactive bitmap as it was set by the user |
8e458bb5 RR |
93 | wxBitmap m_bmpStatic; |
94 | ||
1bd2ceb5 RR |
95 | // the inactive bitmap currently shown in the control |
96 | // (may differ in the size from m_bmpStatic) | |
97 | wxBitmap m_bmpStaticReal; | |
98 | ||
99 | // updates m_bmpStaticReal from m_bmpStatic if needed | |
100 | virtual void UpdateStaticImage(); | |
101 | ||
102 | // called by SetInactiveBitmap | |
103 | virtual void DisplayStaticImage() = 0; | |
104 | ||
72045d57 VZ |
105 | private: |
106 | DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase) | |
107 | }; | |
108 | ||
109 | ||
110 | // ---------------------------------------------------------------------------- | |
111 | // include the platform-specific version of the wxAnimationCtrl class | |
112 | // ---------------------------------------------------------------------------- | |
113 | ||
5f8047a6 | 114 | #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) |
72045d57 VZ |
115 | #include "wx/gtk/animate.h" |
116 | #else | |
117 | #include "wx/generic/animate.h" | |
118 | #endif | |
119 | ||
120 | #endif // wxUSE_ANIMATIONCTRL | |
121 | ||
122 | #endif // _WX_ANIMATEH__ |