]> git.saurik.com Git - wxWidgets.git/blame - include/wx/animate.h
Make storing non-trivial data in wxThreadSpecificInfo possible.
[wxWidgets.git] / include / wx / animate.h
CommitLineData
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
72045d57
VZ
7// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
870cf35c
VZ
11#ifndef _WX_ANIMATE_H_
12#define _WX_ANIMATE_H_
72045d57
VZ
13
14#include "wx/defs.h"
15
16#if wxUSE_ANIMATIONCTRL
17
c2f12218
PC
18#include "wx/animdecod.h"
19#include "wx/control.h"
20#include "wx/timer.h"
8e458bb5 21#include "wx/bitmap.h"
72045d57 22
b5dbe15d 23class WXDLLIMPEXP_FWD_ADV wxAnimation;
72045d57 24
943d32e1 25extern WXDLLIMPEXP_DATA_ADV(wxAnimation) wxNullAnimation;
23318a53 26extern WXDLLIMPEXP_DATA_ADV(const char) wxAnimationCtrlNameStr[];
72045d57
VZ
27
28
29// ----------------------------------------------------------------------------
30// wxAnimationBase
31// ----------------------------------------------------------------------------
32
8f884a0d 33class WXDLLIMPEXP_ADV wxAnimationBase : public wxObject
72045d57
VZ
34{
35public:
36 wxAnimationBase() {}
37
38 virtual bool IsOk() const = 0;
39
40 // can be -1
870cf35c 41 virtual int GetDelay(unsigned int frame) const = 0;
72045d57 42
870cf35c
VZ
43 virtual unsigned int GetFrameCount() const = 0;
44 virtual wxImage GetFrame(unsigned int frame) const = 0;
72045d57
VZ
45 virtual wxSize GetSize() const = 0;
46
870cf35c
VZ
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;
72045d57
VZ
51
52protected:
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
2fd0ada5 67#define wxAC_DEFAULT_STYLE (wxBORDER_NONE)
72045d57 68
72045d57
VZ
69class WXDLLIMPEXP_ADV wxAnimationCtrlBase : public wxControl
70{
71public:
870cf35c 72 wxAnimationCtrlBase() { }
72045d57 73
870cf35c
VZ
74 // public API
75 virtual bool LoadFile(const wxString& filename,
76 wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
462167a9
VZ
77 virtual bool Load(wxInputStream& stream,
78 wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
72045d57
VZ
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
1bd2ceb5
RR
88 virtual void SetInactiveBitmap(const wxBitmap &bmp);
89
90 // always return the original bitmap set in this control
8e458bb5
RR
91 wxBitmap GetInactiveBitmap() const
92 { return m_bmpStatic; }
93
94protected:
1bd2ceb5 95 // the inactive bitmap as it was set by the user
8e458bb5
RR
96 wxBitmap m_bmpStatic;
97
1bd2ceb5
RR
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
72045d57
VZ
108private:
109 DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase)
110};
111
112
113// ----------------------------------------------------------------------------
114// include the platform-specific version of the wxAnimationCtrl class
115// ----------------------------------------------------------------------------
116
5f8047a6 117#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
72045d57
VZ
118 #include "wx/gtk/animate.h"
119#else
120 #include "wx/generic/animate.h"
121#endif
122
870cf35c 123#endif // wxUSE_ANIMATIONCTRL
72045d57 124
870cf35c 125#endif // _WX_ANIMATE_H_