]>
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" | |
72045d57 VZ |
22 | |
23 | class WXDLLIMPEXP_ADV wxAnimation; | |
24 | ||
943d32e1 RD |
25 | extern WXDLLIMPEXP_DATA_ADV(wxAnimation) wxNullAnimation; |
26 | extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxAnimationCtrlNameStr[]; | |
72045d57 VZ |
27 | |
28 | ||
29 | // ---------------------------------------------------------------------------- | |
30 | // wxAnimationBase | |
31 | // ---------------------------------------------------------------------------- | |
32 | ||
943d32e1 | 33 | class WXDLLIMPEXP_ADV wxAnimationBase : public wxGDIObject |
72045d57 VZ |
34 | { |
35 | public: | |
36 | wxAnimationBase() {} | |
37 | ||
38 | virtual bool IsOk() const = 0; | |
39 | ||
40 | // can be -1 | |
41 | virtual int GetDelay(size_t i) const = 0; | |
42 | ||
43 | virtual size_t GetFrameCount() const = 0; | |
44 | virtual wxImage GetFrame(size_t i) const = 0; | |
45 | virtual wxSize GetSize() const = 0; | |
46 | ||
47 | virtual bool LoadFile(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; | |
48 | virtual bool Load(wxInputStream &stream, wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; | |
49 | ||
50 | protected: | |
51 | DECLARE_ABSTRACT_CLASS(wxAnimationBase) | |
52 | }; | |
53 | ||
54 | ||
55 | ||
56 | // ---------------------------------------------------------------------------- | |
57 | // wxAnimationCtrlBase | |
58 | // ---------------------------------------------------------------------------- | |
59 | ||
60 | // do not autoresize to the animation's size when SetAnimation() is called | |
61 | #define wxAC_NO_AUTORESIZE (0x0010) | |
62 | ||
63 | // default style does not include wxAC_NO_AUTORESIZE, that is, the control | |
64 | // auto-resizes by default to fit the new animation when SetAnimation() is called | |
65 | #define wxAC_DEFAULT_STYLE (wxNO_BORDER) | |
66 | ||
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 | private: | |
86 | DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase) | |
87 | }; | |
88 | ||
89 | ||
90 | // ---------------------------------------------------------------------------- | |
91 | // include the platform-specific version of the wxAnimationCtrl class | |
92 | // ---------------------------------------------------------------------------- | |
93 | ||
94 | #if defined(__WXGTK__) | |
95 | #include "wx/gtk/animate.h" | |
96 | #else | |
97 | #include "wx/generic/animate.h" | |
98 | #endif | |
99 | ||
100 | #endif // wxUSE_ANIMATIONCTRL | |
101 | ||
102 | #endif // _WX_ANIMATEH__ |