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