]>
git.saurik.com Git - wxWidgets.git/blob - interface/animate.h
83584781336751964f85e4aeafc1806b6c83eda5
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.
62 The identifier for the control.
65 The initial animation shown in the control.
74 The window style, see wxAC_* flags.
79 @returns @true if the control was successfully created or @false if
82 bool Create(wxWindow
* parent
, wxWindowID id
,
83 const wxAnimation
& anim
,
84 const wxPoint
& pos
= wxDefaultPosition
,
85 const wxSize
& size
= wxDefaultSize
,
86 long style
= wxAC_DEFAULT_STYLE
,
87 const wxString
& name
= "animationctrl");
90 Returns the animation associated with this control.
92 wxAnimation
GetAnimation();
95 Returns the inactive bitmap shown in this control when the;
96 see SetInactiveBitmap() for more info.
98 wxBitmap
GetInactiveBitmap();
101 Returns @true if the animation is being played.
106 Loads the animation from the given file and calls SetAnimation().
107 See wxAnimation::LoadFile for more info.
109 bool LoadFile(const wxString
& file
,
110 wxAnimationType animType
= wxANIMATION_TYPE_ANY
);
113 Starts playing the animation.
114 The animation is always played in loop mode (unless the last frame of the
116 has an infinite delay time) and always start from the first frame
117 (even if you @ref stop() stopped it while some other frame was
123 Sets the animation to play in this control.
124 If the previous animation is being played, it's @ref stop() Stopped.
126 Until Play() isn't called, a static image, the first
127 frame of the given animation or the background colour will be shown
128 (see SetInactiveBitmap() for more info).
130 void SetAnimation(const wxAnimation
& anim
);
133 Sets the bitmap to show on the control when it's not playing an animation.
134 If you set as inactive bitmap @c wxNullBitmap (which is the default), then the
135 first frame of the animation is instead shown when the control is inactive; in
137 if there's no valid animation associated with the control (see
138 wxAnimationCtrl::SetAnimation),
139 then the background colour of the window is shown.
141 If the control is not playing the animation, the given bitmap will be
143 shown, otherwise it will be shown as soon as Stop()
146 Note that the inactive bitmap, if smaller than the control's size, will be
148 the control; if bigger, it will be stretched to fit it.
150 void SetInactiveBitmap(const wxBitmap
& bmp
);
153 Stops playing the animation.
154 The control will show the first frame of the animation, a custom static image or
155 the window's background colour as specified by the
156 last SetInactiveBitmap() call.
166 This class encapsulates the concept of a platform-dependent animation.
167 An animation is a sequence of frames of the same size.
168 Sound is not supported by wxAnimation.
180 class wxAnimation
: public wxGDIObject
185 Loads an animation from a file.
188 The name of the file to load.
191 See LoadFile for more info.
194 wxAnimation(const wxAnimation
& anim
);
195 wxAnimation(const wxString
& name
,
196 wxAnimationType type
= wxANIMATION_TYPE_ANY
);
201 See @ref overview_refcountdestruct "reference-counted object destruction" for
207 Returns the delay for the i-th frame in milliseconds.
208 If @c -1 is returned the frame is to be displayed forever.
210 int GetDelay(unsigned int i
);
213 Returns the i-th frame as a wxImage.
215 wxImage
GetFrame(unsigned int i
);
218 Returns the number of frames for this animation.
220 unsigned int GetFrameCount();
223 Returns the size of the animation.
228 Returns @true if animation data is present.
230 #define bool IsOk() /* implementation is private */
233 Loads an animation from the given stream.
236 The stream to use to load the animation.
239 One of the following values:
245 Load an animated GIF file.
255 Try to autodetect the filetype.
257 @returns @true if the operation succeeded, @false otherwise.
259 bool Load(wxInputStream
& stream
,
260 wxAnimationType type
= wxANIMATION_TYPE_ANY
);
263 Loads an animation from a file.
269 One of the following values:
275 Load an animated GIF file.
285 Try to autodetect the filetype.
287 @returns @true if the operation succeeded, @false otherwise.
289 bool LoadFile(const wxString
& name
,
290 wxAnimationType type
= wxANIMATION_TYPE_ANY
);
293 Assignment operator, using @ref overview_trefcount "reference counting".
295 wxAnimation
operator =(const wxAnimation
& brush
);