1 bmpancli.h |
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #if !defined(__BMPANCLI_H__) |
|
18 #define __BMPANCLI_H__ |
|
19 |
|
20 #include <e32base.h> |
|
21 #include <w32std.h> |
|
22 #include <fbs.h> |
|
23 |
|
24 // |
|
25 // CFrameData |
|
26 // |
|
27 |
|
28 |
|
29 /** |
|
30 Encapsulates the information required for one frame of an animation. |
|
31 |
|
32 Each animation frame includes a bitmap that is displayed in a specified position |
|
33 for a specified length of time. You can optionally include a mask that either |
|
34 hides part of the bitmap, or makes part of the bitmap transparent so that the |
|
35 background can be seen. |
|
36 |
|
37 You will probably need to define several frames for a complete animation. |
|
38 When you have defined the frames you require, use CBitmapAnimClientData to |
|
39 construct the animation itself. |
|
40 |
|
41 @publishedAll |
|
42 @released |
|
43 */ |
|
44 class CBitmapFrameData : public CBase |
|
45 { |
|
46 public: |
|
47 IMPORT_C ~CBitmapFrameData(); |
|
48 IMPORT_C static CBitmapFrameData* NewL(); |
|
49 IMPORT_C static CBitmapFrameData* NewL(CFbsBitmap* aBitmap, CFbsBitmap* aMask=NULL); |
|
50 IMPORT_C static CBitmapFrameData* NewL(CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aIntervalInMilliSeconds, TPoint aPosition); |
|
51 // |
|
52 IMPORT_C void SetBitmap(CFbsBitmap* aBitmap); |
|
53 IMPORT_C void SetMask(CFbsBitmap* aMask); |
|
54 IMPORT_C void SetPosition(TPoint aPosition); |
|
55 IMPORT_C void SetInterval(TInt aIntervalInMilliSeconds); |
|
56 IMPORT_C void SetBitmapsOwnedExternally(TBool aOwnedExternally); |
|
57 // |
|
58 IMPORT_C CFbsBitmap* Bitmap() const; |
|
59 IMPORT_C CFbsBitmap* Mask() const; |
|
60 IMPORT_C TInt IntervalInMilliSeconds() const; |
|
61 IMPORT_C TPoint Position() const; |
|
62 IMPORT_C TBool BitmapsOwnedExternally() const; |
|
63 private: |
|
64 CBitmapFrameData(); |
|
65 private: |
|
66 CFbsBitmap* iBitmap; |
|
67 CFbsBitmap* iMaskBitmap; |
|
68 TBool iBitmapsOwnedExternally; |
|
69 TInt iIntervalInMilliSeconds; |
|
70 TPoint iPosition; |
|
71 }; |
|
72 |
|
73 |
|
74 // |
|
75 // CBitmapAnimClientData |
|
76 // |
|
77 |
|
78 |
|
79 /** |
|
80 Encapsulates one or more animation frames into an entire animation. |
|
81 |
|
82 In addition to specifying the frames you wish to include in your animation, |
|
83 you can also specify: |
|
84 |
|
85 - whether the animation will flash |
|
86 |
|
87 - whether the animation is played once, or continuously |
|
88 |
|
89 - the background frame that is drawn to clear each frame in the animation |
|
90 |
|
91 You can also specify a default frame interval that is used for all frames |
|
92 in an animation. If the interval is already set for any of the individual |
|
93 frames, that takes precedence. |
|
94 |
|
95 When you have defined your animation, use RBitmapAnim to play the animation. |
|
96 |
|
97 @publishedAll |
|
98 @released |
|
99 */ |
|
100 class CBitmapAnimClientData : public CBase |
|
101 { |
|
102 public: |
|
103 /** Animation play mode flags. |
|
104 |
|
105 The animation can be played in any of the ways described below. */ |
|
106 enum TPlayMode |
|
107 { |
|
108 /** Plays the animation once, from the first frame to the last one. */ |
|
109 EPlay = 0x00, |
|
110 /** Plays the animation from the first frame to the last one continuously. */ |
|
111 ECycle = 0x01, |
|
112 /** Plays the animation from the first frame to the last one then from the last |
|
113 frame to the first continuously. */ |
|
114 EBounce = 0x02 |
|
115 }; |
|
116 public: |
|
117 IMPORT_C static CBitmapAnimClientData* NewL(); |
|
118 IMPORT_C ~CBitmapAnimClientData(); |
|
119 // |
|
120 IMPORT_C void AppendFrameL(CBitmapFrameData* aFrame); |
|
121 IMPORT_C void ResetFrameArray(); |
|
122 IMPORT_C void SetBackgroundFrame(CBitmapFrameData* aBackgroundFrame); |
|
123 IMPORT_C void SetFlash(TBool aFlash); |
|
124 IMPORT_C void SetFrameInterval(TInt aFrameIntervalInMilliSeconds); |
|
125 IMPORT_C void SetPlayMode(TPlayMode aPlayMode); |
|
126 // |
|
127 IMPORT_C CBitmapFrameData* BackgroundFrame() const; |
|
128 IMPORT_C TBool Flash() const; |
|
129 IMPORT_C const CArrayPtrFlat<CBitmapFrameData>& FrameArray() const; |
|
130 IMPORT_C TInt FrameIntervalInMilliSeconds() const; |
|
131 IMPORT_C TPlayMode PlayMode() const; |
|
132 // |
|
133 IMPORT_C TInt DurationInMilliSeconds() const; |
|
134 IMPORT_C TSize Size() const; |
|
135 private: |
|
136 CBitmapAnimClientData(); |
|
137 private: |
|
138 TBool iFlash; |
|
139 TPlayMode iPlayMode; |
|
140 TInt iFrameIntervalInMilliSeconds; |
|
141 CArrayPtrFlat<CBitmapFrameData> iFrameArray; |
|
142 CBitmapFrameData* iBackgroundFrame; |
|
143 }; |
|
144 |
|
145 |
|
146 |
|
147 /** |
|
148 Enables a client to package animation data, and send it to the window server |
|
149 for display. |
|
150 |
|
151 Before using RBitmapAnim, a client must instantiate an RAnimDll. This provides |
|
152 a reference to the window server DLL that runs the animation specified through |
|
153 the RBitmapAnim() object. To complete construction, call ConstructL(). |
|
154 |
|
155 @publishedAll |
|
156 @released |
|
157 */ |
|
158 class RBitmapAnim : public RAnim |
|
159 { |
|
160 public: |
|
161 IMPORT_C RBitmapAnim(RAnimDll& aAnimDll); |
|
162 IMPORT_C void ConstructL(const RWindowBase& aWindow); |
|
163 IMPORT_C void DisplayFrameL(TInt aIndex); |
|
164 IMPORT_C void SetBitmapAnimDataL(const CBitmapAnimClientData& aBitmapAnimData); |
|
165 IMPORT_C void SetFlashL(TBool aFlash); |
|
166 IMPORT_C void SetFrameIntervalL(TInt aFrameIntervalInMilliSeconds); |
|
167 IMPORT_C void SetPlayModeL(CBitmapAnimClientData::TPlayMode aPlayMode); |
|
168 IMPORT_C void StartL(); |
|
169 IMPORT_C void StopL(); |
|
170 IMPORT_C void SetNumberOfCyclesL(TInt aNumberOfCycles); |
|
171 IMPORT_C void SetPositionL(TPoint aPosition); |
|
172 private: |
|
173 void SetAttributesL(const CBitmapAnimClientData& aBitmapAnimData); |
|
174 void SetBackgroundFrameL(const CBitmapFrameData& aFrame); |
|
175 void SetFrameArrayL(const CArrayPtrFlat<CBitmapFrameData>& aFrameArray); |
|
176 void SetFrameL(const CBitmapFrameData& aFrame, TInt aOpCode); |
|
177 }; |
|
178 |
|
179 #endif |