]>
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 | ||
19 | #include <wx/defs.h> | |
20 | #include <wx/string.h> | |
21 | #include <wx/gdicmn.h> | |
22 | #include <wx/list.h> | |
23 | #include <wx/timer.h> | |
24 | #include <wx/bitmap.h> | |
25 | #include <wx/colour.h> | |
26 | #include <wx/control.h> | |
27 | #include <wx/animdecod.h> | |
28 | ||
29 | class WXDLLIMPEXP_ADV wxAnimation; | |
30 | ||
31 | extern WXDLLEXPORT_DATA(wxAnimation) wxNullAnimation; | |
32 | extern WXDLLEXPORT_DATA(const wxChar) wxAnimationCtrlNameStr[]; | |
33 | ||
34 | ||
35 | // ---------------------------------------------------------------------------- | |
36 | // wxAnimationBase | |
37 | // ---------------------------------------------------------------------------- | |
38 | ||
39 | class WXDLLEXPORT wxAnimationBase : public wxGDIObject | |
40 | { | |
41 | public: | |
42 | wxAnimationBase() {} | |
43 | ||
44 | virtual bool IsOk() const = 0; | |
45 | ||
46 | // can be -1 | |
47 | virtual int GetDelay(size_t i) const = 0; | |
48 | ||
49 | virtual size_t GetFrameCount() const = 0; | |
50 | virtual wxImage GetFrame(size_t i) const = 0; | |
51 | virtual wxSize GetSize() const = 0; | |
52 | ||
53 | virtual bool LoadFile(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; | |
54 | virtual bool Load(wxInputStream &stream, wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; | |
55 | ||
56 | protected: | |
57 | DECLARE_ABSTRACT_CLASS(wxAnimationBase) | |
58 | }; | |
59 | ||
60 | ||
61 | ||
62 | // ---------------------------------------------------------------------------- | |
63 | // wxAnimationCtrlBase | |
64 | // ---------------------------------------------------------------------------- | |
65 | ||
66 | // do not autoresize to the animation's size when SetAnimation() is called | |
67 | #define wxAC_NO_AUTORESIZE (0x0010) | |
68 | ||
69 | // default style does not include wxAC_NO_AUTORESIZE, that is, the control | |
70 | // auto-resizes by default to fit the new animation when SetAnimation() is called | |
71 | #define wxAC_DEFAULT_STYLE (wxNO_BORDER) | |
72 | ||
73 | ||
74 | class WXDLLIMPEXP_ADV wxAnimationCtrlBase : public wxControl | |
75 | { | |
76 | public: | |
77 | wxAnimationCtrlBase() {} | |
78 | ||
79 | public: // public API | |
80 | ||
81 | virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; | |
82 | ||
83 | virtual void SetAnimation(const wxAnimation &anim) = 0; | |
84 | virtual wxAnimation GetAnimation() const = 0; | |
85 | ||
86 | virtual bool Play() = 0; | |
87 | virtual void Stop() = 0; | |
88 | ||
89 | virtual bool IsPlaying() const = 0; | |
90 | ||
91 | private: | |
92 | DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase) | |
93 | }; | |
94 | ||
95 | ||
96 | // ---------------------------------------------------------------------------- | |
97 | // include the platform-specific version of the wxAnimationCtrl class | |
98 | // ---------------------------------------------------------------------------- | |
99 | ||
100 | #if defined(__WXGTK__) | |
101 | #include "wx/gtk/animate.h" | |
102 | #else | |
103 | #include "wx/generic/animate.h" | |
104 | #endif | |
105 | ||
106 | #endif // wxUSE_ANIMATIONCTRL | |
107 | ||
108 | #endif // _WX_ANIMATEH__ |