|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Declaration of CSAnimMifPlugin class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SANIMMIFPLUGIN_H |
|
20 #define SANIMMIFPLUGIN_H |
|
21 |
|
22 #include "sanimsvgpluginbase.h" |
|
23 |
|
24 /** |
|
25 * Start-up Image plug-in for images and animations in MIF format. |
|
26 * |
|
27 * @lib None |
|
28 * @since S60 3.2 |
|
29 */ |
|
30 NONSHARABLE_CLASS( CSAnimMifPlugin ) : public CSAnimSvgPluginBase |
|
31 { |
|
32 |
|
33 public: |
|
34 |
|
35 /** |
|
36 * Constructs a CSAnimMifPlugin object. |
|
37 * |
|
38 * @since S60 3.2 |
|
39 * |
|
40 * @param aConstructionParameters Construction parameters from ECom. |
|
41 * May NOT be NULL. |
|
42 * @return The new object |
|
43 */ |
|
44 static CSAnimMifPlugin* NewL( TAny* aConstructionParameters ); |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 * |
|
49 * @since S60 3.2 |
|
50 */ |
|
51 virtual ~CSAnimMifPlugin(); |
|
52 |
|
53 /** |
|
54 * Call-back function for call-back timer. |
|
55 * |
|
56 * @since S60 3.2 |
|
57 */ |
|
58 void TimerExpired(); |
|
59 |
|
60 private: |
|
61 |
|
62 /** |
|
63 * Load the image. |
|
64 * From CSAnimPlugin. |
|
65 * |
|
66 * @since S60 3.2 |
|
67 * |
|
68 * @param aFs Fileserver reference. |
|
69 * @param aFileName Name of the image file to load. |
|
70 * @param aStatus Request to complete when image has been loaded. |
|
71 */ |
|
72 virtual void Load( |
|
73 RFs& aFs, |
|
74 const TDesC& aFileName, |
|
75 TRequestStatus& aStatus ); |
|
76 |
|
77 /** |
|
78 * Show the image/animation. |
|
79 * From CSAnimPlugin. |
|
80 * |
|
81 * @since S60 3.2 |
|
82 * |
|
83 * @param aStatus Request to complete when image has been drawn / animation |
|
84 * has finished. |
|
85 */ |
|
86 virtual void Start( TRequestStatus& aStatus ); |
|
87 |
|
88 /** |
|
89 * Cancel loading / showing the image / animation. |
|
90 * From CSAnimPlugin. |
|
91 * |
|
92 * @since S60 3.2 |
|
93 */ |
|
94 virtual void Cancel(); |
|
95 |
|
96 /** |
|
97 * Get the backgroud colour of the image. |
|
98 * Should only be called after successfully loading the image. |
|
99 * From CSAnimImagePlugin. |
|
100 * |
|
101 * @since S60 3.2 |
|
102 * |
|
103 * @return The backgroud colour requested for the image. |
|
104 */ |
|
105 virtual TRgb BackroundColour() const; |
|
106 |
|
107 /** |
|
108 * From MSvgRequestObserver |
|
109 * |
|
110 * @since S60 3.2 |
|
111 */ |
|
112 virtual void UpdateScreen(); |
|
113 |
|
114 private: |
|
115 |
|
116 /** |
|
117 * First phase constructor. |
|
118 * |
|
119 * @since S60 3.2 |
|
120 * |
|
121 * @param aConstructionParameters Construction parameters from ECom. |
|
122 * May NOT be NULL. |
|
123 */ |
|
124 CSAnimMifPlugin( TAny* aConstructionParameters ); |
|
125 |
|
126 /** |
|
127 * Second phase constructor. |
|
128 * |
|
129 * @since S60 3.2 |
|
130 */ |
|
131 void ConstructL(); |
|
132 |
|
133 /** |
|
134 * Load the image from file. |
|
135 * |
|
136 * @since S60 3.2 |
|
137 * |
|
138 * @param aFs Fileserver reference. |
|
139 * @param aFileName Name of the image file to load. |
|
140 */ |
|
141 void LoadL( RFs& aFs, const TDesC& aFileName ); |
|
142 |
|
143 /** |
|
144 * Read array of images from file. |
|
145 * |
|
146 * @since S60 3.2 |
|
147 * |
|
148 * @param aFile File to read from. |
|
149 * @param aPosition Position in the file where the array starts. |
|
150 * @param aLength Length of the array data in the file. |
|
151 */ |
|
152 void ReadIconArrayL( |
|
153 RFile& aFile, |
|
154 const TInt32 aPosition, |
|
155 const TInt32 aLength ); |
|
156 |
|
157 /** |
|
158 * Read icon data from file from the position pointed by the parameter data. |
|
159 * |
|
160 * @since S60 3.2 |
|
161 * |
|
162 * @param aFile File to read from. |
|
163 * @param aData Information on the position and length of the icon data in |
|
164 * the file. |
|
165 */ |
|
166 void ReadIconOffsetElementL( RFile& aFile, const TDesC8& aData ); |
|
167 |
|
168 /** |
|
169 * Inform observer to refresh its view. |
|
170 * |
|
171 * @since S60 3.2 |
|
172 */ |
|
173 void RefreshView(); |
|
174 |
|
175 private: |
|
176 |
|
177 /** Default constructor. */ |
|
178 CSAnimMifPlugin(); |
|
179 /** Copy constructor. */ |
|
180 CSAnimMifPlugin( const CSAnimMifPlugin& ); |
|
181 /** Assignment operator. */ |
|
182 CSAnimMifPlugin& operator=( const CSAnimMifPlugin& ); |
|
183 |
|
184 private: // data |
|
185 |
|
186 /** Timer for timing the frame showing durations. Owned. May not be NULL. */ |
|
187 CPeriodic* iTimer; |
|
188 |
|
189 /** Array of animation frames. */ |
|
190 RPointerArray<CFbsBitmap> iFrames; |
|
191 |
|
192 /** Bitmap to hold the mask of the image to be shown. Owned. May not be NULL. */ |
|
193 CFbsBitmap* iDummy; |
|
194 |
|
195 /** Indicates which frame is currently shown. */ |
|
196 TInt iCurrentFrame; |
|
197 |
|
198 }; |
|
199 |
|
200 #endif // SANIMMIFPLUGIN_H |