]>
git.saurik.com Git - wxWidgets.git/blob - interface/animate.h
24dbe307afe1889d97c47ba4053d41cf4485fcc8
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxAnimationCtrl class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxAnimationCtrl
13 This is a static control which displays an animation.
14 wxAnimationCtrl API is simple as possible and won't give you full control on the
15 animation; if you need it then use wxMediaCtrl.
17 This control is useful to display a (small) animation while doing a long task
20 It is only available if @c wxUSE_ANIMATIONCTRL is set to 1 (the default).
23 @style{wxAC_DEFAULT_STYLE}:
24 The default style: wxBORDER_NONE.
25 @style{wxAC_NO_AUTORESIZE}:
26 By default, the control will adjust its size to exactly fit to the
27 size of the animation when SetAnimation is called. If this style
28 flag is given, the control will not change its size
33 @appearance{animationctrl.png}
38 class wxAnimationCtrl
: public wxControl
42 Initializes the object and calls Create() with
45 wxAnimationCtrl(wxWindow
* parent
, wxWindowID id
,
46 const wxAnimation
& anim
,
47 const wxPoint
& pos
= wxDefaultPosition
,
48 const wxSize
& size
= wxDefaultSize
,
49 long style
= wxAC_DEFAULT_STYLE
,
50 const wxString
& name
= "animationctrl");
53 After control creation you must explicitely call Play()
54 to start to play the animation. Until that function won't be called, the first
56 of the animation is displayed.
59 Parent window, must be non-@NULL.
61 The identifier for the control.
63 The initial animation shown in the control.
69 The window style, see wxAC_* flags.
73 @returns @true if the control was successfully created or @false if
76 bool Create(wxWindow
* parent
, wxWindowID id
,
77 const wxAnimation
& anim
,
78 const wxPoint
& pos
= wxDefaultPosition
,
79 const wxSize
& size
= wxDefaultSize
,
80 long style
= wxAC_DEFAULT_STYLE
,
81 const wxString
& name
= "animationctrl");
84 Returns the animation associated with this control.
86 wxAnimation
GetAnimation();
89 Returns the inactive bitmap shown in this control when the;
90 see SetInactiveBitmap() for more info.
92 wxBitmap
GetInactiveBitmap();
95 Returns @true if the animation is being played.
100 Loads the animation from the given file and calls SetAnimation().
101 See wxAnimation::LoadFile for more info.
103 bool LoadFile(const wxString
& file
,
104 wxAnimationType animType
= wxANIMATION_TYPE_ANY
);
107 Starts playing the animation.
108 The animation is always played in loop mode (unless the last frame of the
110 has an infinite delay time) and always start from the first frame
111 (even if you @ref stop() stopped it while some other frame was
117 Sets the animation to play in this control.
118 If the previous animation is being played, it's @ref stop() Stopped.
119 Until Play() isn't called, a static image, the first
120 frame of the given animation or the background colour will be shown
121 (see SetInactiveBitmap() for more info).
123 void SetAnimation(const wxAnimation
& anim
);
126 Sets the bitmap to show on the control when it's not playing an animation.
127 If you set as inactive bitmap @c wxNullBitmap (which is the default), then the
128 first frame of the animation is instead shown when the control is inactive; in
130 if there's no valid animation associated with the control (see
131 wxAnimationCtrl::SetAnimation),
132 then the background colour of the window is shown.
133 If the control is not playing the animation, the given bitmap will be
135 shown, otherwise it will be shown as soon as Stop()
137 Note that the inactive bitmap, if smaller than the control's size, will be
139 the control; if bigger, it will be stretched to fit it.
141 void SetInactiveBitmap(const wxBitmap
& bmp
);
144 Stops playing the animation.
145 The control will show the first frame of the animation, a custom static image or
146 the window's background colour as specified by the
147 last SetInactiveBitmap() call.
157 This class encapsulates the concept of a platform-dependent animation.
158 An animation is a sequence of frames of the same size.
159 Sound is not supported by wxAnimation.
171 class wxAnimation
: public wxGDIObject
176 Loads an animation from a file.
179 The name of the file to load.
181 See LoadFile for more info.
184 wxAnimation(const wxAnimation
& anim
);
185 wxAnimation(const wxString
& name
,
186 wxAnimationType type
= wxANIMATION_TYPE_ANY
);
191 See @ref overview_refcountdestruct "reference-counted object destruction" for
197 Returns the delay for the i-th frame in milliseconds.
198 If @c -1 is returned the frame is to be displayed forever.
200 int GetDelay(unsigned int i
);
203 Returns the i-th frame as a wxImage.
205 wxImage
GetFrame(unsigned int i
);
208 Returns the number of frames for this animation.
210 unsigned int GetFrameCount();
213 Returns the size of the animation.
218 Returns @true if animation data is present.
223 Loads an animation from the given stream.
226 The stream to use to load the animation.
228 One of the following values:
241 Load an animated GIF file.
263 Try to autodetect the filetype.
265 @returns @true if the operation succeeded, @false otherwise.
267 bool Load(wxInputStream
& stream
,
268 wxAnimationType type
= wxANIMATION_TYPE_ANY
);
271 Loads an animation from a file.
276 One of the following values:
289 Load an animated GIF file.
311 Try to autodetect the filetype.
313 @returns @true if the operation succeeded, @false otherwise.
315 bool LoadFile(const wxString
& name
,
316 wxAnimationType type
= wxANIMATION_TYPE_ANY
);
319 Assignment operator, using @ref overview_trefcount "reference counting".
321 wxAnimation
operator =(const wxAnimation
& brush
);