]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/animatctrl.tex
sorting support for generic version (patch 1765087 from Bo)
[wxWidgets.git] / docs / latex / wx / animatctrl.tex
CommitLineData
72045d57
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: animatctrl.tex
3%% Purpose: wxAnimationCtrl documentation
4%% Author: Francesco Montorsi
5%% Created: 24-9-2006
6%% RCS-ID: $Id$
7%% Copyright: (c) 2006 Francesco Montorsi
8%% License: wxWindows license
9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
11\section{\class{wxAnimationCtrl}}\label{wxanimationctrl}
12
13This is a static control which displays an animation.
14wxAnimationCtrl API is simple as possible and won't give you full control on the
15animation; if you need it then use \helpref{wxMediaCtrl}{wxmediactrl}.
16
17This control is useful to display a (small) animation while doing a long task
18(e.g. a "throbber").
19
20It is only available if \texttt{wxUSE\_ANIMATIONCTRL} is set to $1$ (the default).
21
22\wxheading{Derived from}
23
24\helpref{wxControl}{wxcontrol}\\
25\helpref{wxWindow}{wxwindow}\\
26\helpref{wxEvtHandler}{wxevthandler}\\
27\helpref{wxObject}{wxobject}
28
29\wxheading{Include files}
30
31<wx/animate.h>
32
a7af285d
VZ
33\wxheading{Library}
34
35\helpref{wxAdv}{librarieslist}
36
72045d57
VZ
37\wxheading{Window styles}
38
39\twocolwidtha{5cm}%
40\begin{twocollist}\itemsep=0pt
c2f12218
PC
41\twocolitem{\windowstyle{wxAC\_DEFAULT\_STYLE}}{The default style: wxNO\_BORDER.}
42\twocolitem{\windowstyle{wxAC\_NO\_AUTORESIZE}}{By default, the control will adjust
72045d57
VZ
43its size to exactly fit to the size of the animation when \helpref{SetAnimation}{wxanimationctrlsetanimation}
44is called. If this style flag is given, the control will not change its size}
45\end{twocollist}
46
47%\wxheading{Event handling}
48%
49%\twocolwidtha{7cm}%
50%\begin{twocollist}\itemsep=0pt
51%\twocolitem{{\bf EVT\_ANIMATION\_END(id, func)}}{}
52%\end{twocollist}
53
54\wxheading{See also}
55
56\helpref{wxAnimation}{wxanimation}
57
58
59\latexignore{\rtfignore{\wxheading{Members}}}
60
61\membersection{wxAnimationCtrl::wxAnimationCtrl}\label{wxanimationctrl}
62
63\func{}{wxAnimationCtrl}{\param{wxWindow *}{parent},\rtfsp
64\param{wxWindowID}{ id},\rtfsp
65\param{const wxAnimation\& }{anim},\rtfsp
66\param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
67\param{const wxSize\& }{size = wxDefaultSize},\rtfsp
68\param{long}{ style = wxAC\_DEFAULT\_STYLE},\rtfsp
69\param{const wxString\& }{name = ``animationctrl"}}
70
71Initializes the object and calls \helpref{Create}{wxanimationctrlcreate} with
72all the parameters.
73
74
75\membersection{wxAnimationCtrl::Create}\label{wxanimationctrlcreate}
76
77\func{bool}{Create}{\param{wxWindow *}{parent},\rtfsp
78\param{wxWindowID}{ id},\rtfsp
79\param{const wxAnimation\& }{anim},\rtfsp
80\param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
81\param{const wxSize\& }{size = wxDefaultSize},\rtfsp
82\param{long}{ style = wxAC\_DEFAULT\_STYLE},\rtfsp
83\param{const wxString\& }{name = ``animationctrl"}}
84
85\wxheading{Parameters}
86
70fc30ae 87\docparam{parent}{Parent window, must be non-\NULL.}
72045d57
VZ
88
89\docparam{id}{The identifier for the control.}
90
91\docparam{anim}{The initial animation shown in the control.}
92
93\docparam{pos}{Initial position.}
94
95\docparam{size}{Initial size.}
96
97\docparam{style}{The window style, see {\tt wxAC\_*} flags.}
98
99\docparam{name}{Control name.}
100
101After control creation you must explicitely call \helpref{Play}{wxanimationctrlplay}
102to start to play the animation. Until that function won't be called, the first frame
103of the animation is displayed.
104
105\wxheading{Return value}
106
107\true if the control was successfully created or \false if creation failed.
108
109
110\membersection{wxAnimationCtrl::GetAnimation}\label{wxanimationctrlgetanimation}
111
112\constfunc{wxAnimation}{GetAnimation}{\void}
113
114Returns the animation associated with this control.
115
116
8e458bb5
RR
117\membersection{wxAnimationCtrl::GetInactiveBitmap}\label{wxanimationctrlgetinactivebitmap}
118
119\constfunc{wxBitmap}{GetInactiveBitmap}{\void}
120
121Returns the inactive bitmap shown in this control when the;
122see \helpref{SetInactiveBitmap}{wxanimationctrlsetinactivebitmap} for more info.
123
124
72045d57
VZ
125\membersection{wxAnimationCtrl::IsPlaying}\label{wxanimationctrlisplaying}
126
127\constfunc{bool}{IsPlaying}{\void}
128
129Returns \true if the animation is being played.
130
131
132\membersection{wxAnimationCtrl::LoadFile}\label{wxanimationctrlloadfile}
133
134\func{bool}{LoadFile}{\param{const wxString \&}{ file}, \param{wxAnimationType }{ animType = wxANIMATION\_TYPE\_ANY}}
135
136Loads the animation from the given file and calls \helpref{SetAnimation}{wxanimationctrlsetanimation}.
137See \helpref{wxAnimation::LoadFile}{wxanimationloadfile} for more info.
138
139
140\membersection{wxAnimationCtrl::Play}\label{wxanimationctrlplay}
141
142\func{bool}{Play}{\void}
143
144Starts playing the animation.
145The animation is always played in loop mode (unless the last frame of the animation
146has an infinite delay time) and always start from the first frame
70fc30ae 147(even if you \helpref{stopped}{wxanimationctrlstop} it while some other frame was
72045d57
VZ
148displayed).
149
150
151\membersection{wxAnimationCtrl::SetAnimation}\label{wxanimationctrlsetanimation}
152
153\func{void}{SetAnimation}{\param{const wxAnimation \&}{ anim}}
154
155Sets the animation to play in this control.
156If the previous animation is being played, it's \helpref{Stopped}{wxanimationctrlstop}.
157
8e458bb5
RR
158Until \helpref{Play}{wxanimationctrlplay} isn't called, a static image, the first
159frame of the given animation or the background colour will be shown
160(see \helpref{SetInactiveBitmap}{wxanimationctrlsetinactivebitmap} for more info).
161
162
163\membersection{wxAnimationCtrl::SetInactiveBitmap}\label{wxanimationctrlsetinactivebitmap}
164
165\func{void}{SetInactiveBitmap}{\param{const wxBitmap\& }{bmp}}
72045d57 166
8e458bb5
RR
167Sets the bitmap to show on the control when it's not playing an animation.
168If you set as inactive bitmap {\tt wxNullBitmap} (which is the default), then the
169first frame of the animation is instead shown when the control is inactive; in this case,
170if there's no valid animation associated with the control (see \helpref{SetAnimation}{wxanimationctrlsetanimation}),
171then the background colour of the window is shown.
72045d57 172
8e458bb5
RR
173If the control is not playing the animation, the given bitmap will be immediately
174shown, otherwise it will be shown as soon as \helpref{Stop}{wxanimationctrlstop}
175is called.
72045d57 176
1bd2ceb5
RR
177Note that the inactive bitmap, if smaller than the control's size, will be centered in
178the control; if bigger, it will be stretched to fit it.
179
180
72045d57
VZ
181\membersection{wxAnimationCtrl::Stop}\label{wxanimationctrlstop}
182
183\func{void}{Stop}{\void}
184
185Stops playing the animation.
8e458bb5
RR
186The control will show the first frame of the animation, a custom static image or
187the window's background colour as specified by the
188last \helpref{SetInactiveBitmap}{wxanimationctrlsetinactivebitmap} call.
b67a86d5 189