1 /* |
|
2 * Copyright (c) 2008-2008 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: Control for single station logo |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CIRSTATIONLOGOCONTROL_H |
|
20 #define C_CIRSTATIONLOGOCONTROL_H |
|
21 |
|
22 #include <alf/alfcontrol.h> |
|
23 |
|
24 #include "irstationinformationdata.h" |
|
25 #include "irimageconverterobserver.h" |
|
26 |
|
27 class CAlfImageVisual; |
|
28 class CIRImageConverter; |
|
29 class CIRStationLogoData; |
|
30 class MIRLogoControlObserver; |
|
31 |
|
32 /** |
|
33 * Station Logo Control |
|
34 * |
|
35 * @since S60 v3.2 |
|
36 */ |
|
37 class CIRStationLogoControl : public CAlfControl, |
|
38 public MIRImageConverterObserver |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * Adds the control to the control group and to layout hierarchy. |
|
45 * |
|
46 * @param aAlfEnv The Alfred environment. |
|
47 * @param aControlGroupId The control group that this control is to be added to. |
|
48 * @param aParentLayout The parent layout for the visuals. |
|
49 */ |
|
50 static CIRStationLogoControl* NewL( CAlfEnv& aAlfEnv, TInt aControlGroupId, |
|
51 CAlfLayout* aParentLayout = NULL ); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 ~CIRStationLogoControl(); |
|
57 |
|
58 /** |
|
59 * Prepares the logo graphics for specified ID. |
|
60 * |
|
61 * @param aId The identifier for the logo. |
|
62 */ |
|
63 void PrepareLogoL( TInt aId ); |
|
64 |
|
65 /** |
|
66 * Switches to specified logo. |
|
67 * |
|
68 * @param aId The identifier for the logo. |
|
69 */ |
|
70 TBool SwitchToLogoL( TInt aId ); |
|
71 |
|
72 /** |
|
73 * Sets the raw data for all the logos. |
|
74 * |
|
75 * @param aIdArray Identifiers to be used for the logos. |
|
76 * @param aRawData The raw graphics data for each logo. |
|
77 */ |
|
78 void SetLogosL( const RArray<TInt>& aIdArray, const CPtrC8Array& aRawData ); |
|
79 |
|
80 /** |
|
81 * Updates one logo. |
|
82 * |
|
83 * @param aId The ID of the logo to be updated. |
|
84 * If such ID is not found, it is added. |
|
85 * @param aRawData The raw data of the logo. |
|
86 * If the data is a KNullDesC8, it is removed. |
|
87 */ |
|
88 void UpdateLogoL( TInt aId, const TDesC8& aRawData ); |
|
89 |
|
90 |
|
91 /** |
|
92 * Sets logo fade style. |
|
93 * |
|
94 * @param aFadeStyle The style of the logo fading. |
|
95 */ |
|
96 void SetLogoFadeStyle( TIRFadeStyle aFadeStyle ); |
|
97 /** |
|
98 * Sets the observer for this control. |
|
99 * |
|
100 * @param aObserver The observer for this control. |
|
101 */ |
|
102 void SetLogoControlObserver( MIRLogoControlObserver& aObserver ); |
|
103 |
|
104 // from CAlfControl |
|
105 void VisualLayoutUpdated( CAlfVisual& aVisual ); |
|
106 |
|
107 |
|
108 // from MVRImageConverterObserver |
|
109 void HandleImageConversionEventL( MIRImageConverterObserver::TIRImageConversionEvent aEvent, |
|
110 TInt aId, |
|
111 TInt aError ); |
|
112 void FadeOutLogo(TInt aId); |
|
113 |
|
114 private: // Methods |
|
115 |
|
116 /** |
|
117 * The types of delayed showing of logo. |
|
118 */ |
|
119 enum TIRLogoFadeDelayType |
|
120 { |
|
121 EIRLogoNoDelay, |
|
122 EIRDelayedTextureImage, |
|
123 EIRDelayedDefaultImage |
|
124 }; |
|
125 |
|
126 /** |
|
127 * Default constructor. |
|
128 */ |
|
129 CIRStationLogoControl(); |
|
130 |
|
131 /** |
|
132 * Second phase constructor. |
|
133 * |
|
134 * @param aAlfEnv The Alfred environmennt. |
|
135 * @param aControlGroupId The control group ID for the controls. |
|
136 * @param aParentLayout The parent layout for the visuals. |
|
137 */ |
|
138 void ConstructL( CAlfEnv& aAlfEnv, TInt aControlGroupId, CAlfLayout* aParentLayout ); |
|
139 |
|
140 /** |
|
141 * Provides the station logo data for specified id. |
|
142 * |
|
143 * @param aId The identifier for the logo. |
|
144 */ |
|
145 CIRStationLogoData* LogoDataForId( TInt aId ); |
|
146 |
|
147 /** |
|
148 * Starts to convert the graphics for specified logo |
|
149 * |
|
150 * @param aLogoData The logo data to be converted |
|
151 */ |
|
152 void StartConversionL( CIRStationLogoData& aLogoData ); |
|
153 |
|
154 /** |
|
155 * Fades the station logo in. |
|
156 * |
|
157 * @param aVisual The logo to be faded in. |
|
158 */ |
|
159 void FadeInStationLogoL( CAlfVisual& aVisual ); |
|
160 |
|
161 /** |
|
162 * Fades the current logo out. If logo is not the default logo, deletes it's data |
|
163 * after the fading (ansynchronously). |
|
164 * |
|
165 * @param aVisual The logo to be faded out. |
|
166 */ |
|
167 void FadeOutCurrentLogo( CAlfVisual& aVisual ); |
|
168 |
|
169 /** |
|
170 * Returns target point for logo fade out. |
|
171 * |
|
172 * @param aVisual The visual to be faded out. |
|
173 * @return Target point. |
|
174 */ |
|
175 TAlfTimedPoint FadeOutTargetPoint( CAlfVisual& aVisual ) const; |
|
176 |
|
177 /** |
|
178 * Returns start point for logo fade in. |
|
179 * |
|
180 * @param aVisual The visual to be faded in. |
|
181 * @return Start point. |
|
182 */ |
|
183 TAlfTimedPoint FadeInStartPoint( CAlfVisual& aVisual ) const; |
|
184 |
|
185 |
|
186 /** |
|
187 * Updates iLogodata Array. |
|
188 */ |
|
189 void DestroyPreviousLogosL( const RArray<TInt>& aIdArray, const CPtrC8Array& aRawData ); |
|
190 /** |
|
191 * Updates iLogodata Array. |
|
192 */ |
|
193 void DefaultlogoHandlingL( const RArray<TInt>& aIdArray, const CPtrC8Array& aRawData ); |
|
194 |
|
195 |
|
196 private: // Members |
|
197 |
|
198 /** |
|
199 * The image converter. |
|
200 * Owned. |
|
201 */ |
|
202 CIRImageConverter* iCurrentImageConverter; |
|
203 |
|
204 /** |
|
205 * The logo data for all stations. |
|
206 * Owned. |
|
207 */ |
|
208 RPointerArray<CIRStationLogoData> iLogoData; |
|
209 |
|
210 /** |
|
211 * The parent layout for the logos. |
|
212 * Not owned. |
|
213 */ |
|
214 CAlfDeckLayout* iDeck; |
|
215 |
|
216 /** |
|
217 * The size that is used for image conversions |
|
218 */ |
|
219 TSize iVisualSize; |
|
220 |
|
221 /** |
|
222 * The mif bitmap id for default logo |
|
223 */ |
|
224 TInt iBitmapId; |
|
225 |
|
226 /** |
|
227 * The mif mask id for default logo |
|
228 */ |
|
229 TInt iMaskId; |
|
230 |
|
231 /** |
|
232 * The ID for the current logo. KErrNotFound for the default logo |
|
233 */ |
|
234 TInt iCurrentId; |
|
235 |
|
236 /** |
|
237 * The fading identification for situations when the graphics aren't ready |
|
238 */ |
|
239 TIRLogoFadeDelayType iDelayedFadeIn; |
|
240 |
|
241 /** |
|
242 * Style of the logo fading. |
|
243 */ |
|
244 TIRFadeStyle iFadeStyle; |
|
245 /** |
|
246 * Used to store logo. |
|
247 */ |
|
248 TInt iCount; |
|
249 /** |
|
250 * Used for logo storage. |
|
251 */ |
|
252 TInt iRet; |
|
253 /** |
|
254 * Used for logo storage. |
|
255 */ |
|
256 TInt iLogoDisplay; |
|
257 /** |
|
258 * Used for Handling Error Conditions |
|
259 * During Logo Conversion. |
|
260 */ |
|
261 TInt iError; |
|
262 /** |
|
263 * Used for Handling Logo FadeOut |
|
264 */ |
|
265 TBool iFadeOut; |
|
266 |
|
267 MIRLogoControlObserver* iLogoControlObserver; |
|
268 }; |
|
269 |
|
270 #endif // C_CIRSTATIONLOGOCONTROL_H |
|