|
1 /* |
|
2 * Copyright (c) 2005-2006 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: Header for CIRStationsViewContainer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CIRSTATIONSVIEWCONTAINER_H |
|
20 #define CIRSTATIONSVIEWCONTAINER_H |
|
21 |
|
22 #include <aknlists.h> |
|
23 #include <EIKLBX.H> |
|
24 #include <aknsfld.h> |
|
25 #include <eikclb.h> |
|
26 |
|
27 #include "irimageconverterobserver.h" |
|
28 |
|
29 class CIRStationsView; |
|
30 class CIRStationsViewContainer; |
|
31 class CAknIconArray; |
|
32 class CIRImageConverter; |
|
33 /** |
|
34 * This classes are used for Advertisements |
|
35 */ |
|
36 class CIRFilteredModel; |
|
37 class MIRListBoxArray; |
|
38 class CIRAdvertisingListBox; |
|
39 /** |
|
40 * Container for Search Results View. |
|
41 */ |
|
42 class CIRStationsViewContainer : public CCoeControl/*public CAknDoubleStyleListBox*/ , public MEikListBoxObserver, |
|
43 public MIRImageConverterObserver |
|
44 { |
|
45 |
|
46 public: // Methods |
|
47 |
|
48 |
|
49 /** |
|
50 * NewL. |
|
51 * Two-phased constructor. |
|
52 * Create a CIRStationsViewContainer object, which will draw itself to aRect |
|
53 * @param aRect The rectangle this view will be drawn to. |
|
54 * @param aView The Stations/TopStations view's instance. |
|
55 * @return a pointer to the created instance of CIRStationsViewContainer. |
|
56 */ |
|
57 static CIRStationsViewContainer* NewL( CIRStationsView& aView, const TRect& aRect ); |
|
58 |
|
59 /** |
|
60 * NewLC. |
|
61 * Two-phased constructor. |
|
62 * Create a CIRStationsViewContainer object, which will draw itself to aRect |
|
63 * @param aRect The rectangle this view will be drawn to. |
|
64 * @param aView The Stations/TopStations view's instance. |
|
65 * @return a pointer to the created instance of CIRStationsViewContainer. |
|
66 */ |
|
67 static CIRStationsViewContainer* NewLC( CIRStationsView& aView, const TRect& aRect ); |
|
68 /** |
|
69 * ConstructL |
|
70 * 2nd phase constructor. |
|
71 */ |
|
72 void ConstructL( const TRect& aRect); |
|
73 |
|
74 /** |
|
75 * CIRStationsViewContainer() |
|
76 * C++ default constructor. |
|
77 * @param aView View of this container. |
|
78 */ |
|
79 CIRStationsViewContainer(CIRStationsView& aView); |
|
80 |
|
81 /** |
|
82 * ~CIRStationsViewContainer() |
|
83 * Destructor. |
|
84 */ |
|
85 ~CIRStationsViewContainer(); |
|
86 |
|
87 /** |
|
88 * UpdateSearchResultsViewL() |
|
89 * updates the search results data to the search results list |
|
90 */ |
|
91 void UpdateStationsViewL(); |
|
92 |
|
93 /** |
|
94 * HandleLogoErrorL() |
|
95 * called from the iStationsView when the logo is not downloaded |
|
96 */ |
|
97 void HandleLogoErrorL(); |
|
98 |
|
99 |
|
100 // from base class CCoeControl |
|
101 |
|
102 /** |
|
103 * From CCoeControl |
|
104 * @see CCoeControl::OfferKeyEventL() |
|
105 */ |
|
106 |
|
107 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
108 |
|
109 /** |
|
110 * From MEikListBoxObserver HandleListBoxEventL |
|
111 */ |
|
112 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
113 |
|
114 |
|
115 |
|
116 /** |
|
117 * From CCoeControl |
|
118 * |
|
119 * @see CCoeControl::GetHelpContext( TCoeHelpContext& aContext ) const |
|
120 */ |
|
121 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
122 |
|
123 /** |
|
124 * GetCurrentItemIndex() |
|
125 * returns the index of the currently selected item |
|
126 */ |
|
127 TInt GetCurrentItemIndex() const; |
|
128 |
|
129 /** |
|
130 * GetListBoxTopIndex() |
|
131 * returns the index of the top item |
|
132 */ |
|
133 TInt GetListBoxTopIndex() const; |
|
134 |
|
135 /** |
|
136 * CountComponentControls() const |
|
137 * returns the number of components in the view. |
|
138 */ |
|
139 TInt CountComponentControls() const; |
|
140 |
|
141 /** |
|
142 * ComponentControl() |
|
143 * returns the pointer to the control |
|
144 */ |
|
145 CCoeControl* ComponentControl(TInt aIndex) const ; |
|
146 |
|
147 /** |
|
148 * SizeChanged() |
|
149 * Responds to changes to the size and position of the contents of this control. |
|
150 */ |
|
151 void SizeChanged(); |
|
152 |
|
153 /** |
|
154 * HandleResourceChange() |
|
155 * Handles a change to the control's resources. |
|
156 */ |
|
157 void HandleResourceChange(TInt aType); |
|
158 /* |
|
159 * CreateFindBoxL() |
|
160 * Creates the find box for dynamic filtering |
|
161 */ |
|
162 CAknSearchField* CreateFindBoxL(CEikListBox* aListBox, |
|
163 CTextListBoxModel* aModel, CAknSearchField::TSearchFieldStyle aStyle); |
|
164 /* |
|
165 * DisableFindBox() |
|
166 * disable the listbox when foxus is not present |
|
167 */ |
|
168 void DisableFindBox(); |
|
169 |
|
170 /** |
|
171 * Function : Comparestrings |
|
172 * Function called to get the actual index of the station |
|
173 */ |
|
174 void Comparestrings(); |
|
175 |
|
176 /** |
|
177 * HandleImageConversionEventL() |
|
178 * from base class MIRImageConverterObserver |
|
179 */ |
|
180 void HandleImageConversionEventL( MIRImageConverterObserver::TIRImageConversionEvent aEvent, |
|
181 TInt aId, TInt aError ); |
|
182 /** |
|
183 * PresetLogoDownloadL() |
|
184 * Used to download the logos depending the preset values. |
|
185 */ |
|
186 void PresetLogoDownloadL(CIRIsdsPreset* aPreset); |
|
187 /** |
|
188 * CreateCustomListBoxL() |
|
189 * Creates the custom listbox and updates the list according to that |
|
190 */ |
|
191 void CreateCustomListBoxL(); |
|
192 /** |
|
193 * CreateListBoxL() |
|
194 * Creates ListBox depending upon the presence of Advertisement |
|
195 */ |
|
196 void CreateListBoxL(); |
|
197 /** |
|
198 * OpenUrlL() |
|
199 * Used to connect to advertisement url |
|
200 */ |
|
201 void OpenUrlL( const TDesC& aHttpLink ); |
|
202 /** |
|
203 * GetLogoNotSupported() |
|
204 * returns whether the advertisement is supported by the sdk r not |
|
205 */ |
|
206 TBool GetLogoNotSupported(); |
|
207 /** |
|
208 * Creates default (empty) icon |
|
209 * |
|
210 * @return Default icon |
|
211 */ |
|
212 CGulIcon* CreateDefaultIconL(); |
|
213 /* |
|
214 * GetFilterdModelPointer() |
|
215 * returns pointer to filtered model. |
|
216 */ |
|
217 CIRFilteredModel* GetFilterdModelPointer(); |
|
218 /* |
|
219 * GetSearchBoxPointer() |
|
220 * returns the search box pointer. |
|
221 */ |
|
222 CAknSearchField* GetSearchBoxPointer(); |
|
223 private: //Methods |
|
224 |
|
225 |
|
226 // from base class CCoeControl |
|
227 /** |
|
228 * From CCoeControl |
|
229 * |
|
230 * @see CCoeControl::Draw( const TRect& aRect ) const |
|
231 */ |
|
232 void Draw( const TRect& aRect ) const; |
|
233 /** |
|
234 * StartConvertL() |
|
235 * used to convert the images depending the index passed |
|
236 * |
|
237 */ |
|
238 void StartConvertL( CIRImageConverter& aConverter, TInt aIndex, TInt aId ); |
|
239 /** |
|
240 * Formats list item string with given arguments |
|
241 * |
|
242 * @param aFirstRow text for first row |
|
243 * @param aSecondRow text for second row |
|
244 * @param aIconId Icon ID used on item |
|
245 */ |
|
246 HBufC* FormatItemStringLC( const TDesC& aFirstRow, TInt aIconId ); |
|
247 /* |
|
248 * iFilteredFlag |
|
249 * This flag is set when dynamic filtering is done and |
|
250 * will be reseted when the characters in the filter box is deleted |
|
251 */ |
|
252 TBool iFilteredFlag; |
|
253 |
|
254 private: |
|
255 /** |
|
256 * iItemArray |
|
257 * array for the listbox model |
|
258 */ |
|
259 CDesCArray* iItemArray; |
|
260 /** |
|
261 * iView |
|
262 * Data for CIRStationsView view |
|
263 */ |
|
264 CIRStationsView& iView; |
|
265 |
|
266 /* |
|
267 * iCurrentItemConverter |
|
268 * instance of CIRImageConverter |
|
269 */ |
|
270 CIRImageConverter* iCurrentItemConverter; |
|
271 |
|
272 /** |
|
273 * boolean for forcibly getting the logo from cache |
|
274 */ |
|
275 TBool iForceGet; |
|
276 |
|
277 /** |
|
278 * response from the cache for the availability of logo(CacheNotValid,NotCached,CacheUseable) |
|
279 */ |
|
280 TInt iResult; |
|
281 |
|
282 /** |
|
283 * to keep track of the icon array index |
|
284 */ |
|
285 TInt iIconIndex; |
|
286 |
|
287 |
|
288 /** |
|
289 * to keep track of the logo url index(for temporary) |
|
290 */ |
|
291 TInt iLogoIndex; |
|
292 |
|
293 /* |
|
294 * iInvalidIconIndices |
|
295 * instance of RArray |
|
296 */ |
|
297 RArray<TInt> iInvalidIconIndices; |
|
298 |
|
299 /* |
|
300 * iLogosArray |
|
301 * instance of RArray |
|
302 */ |
|
303 RArray<TInt> iLogosArray; |
|
304 |
|
305 /* |
|
306 * iNoLogosArray |
|
307 * instance of RArray |
|
308 */ |
|
309 RArray<TInt> iNoLogosArray; |
|
310 |
|
311 |
|
312 CFbsBitmap* iAdBitmap; |
|
313 /** |
|
314 * iAdRequestStatusFlag |
|
315 * sets when a request for advertisement is made. |
|
316 */ |
|
317 TBool iAdRequestStatusFlag; |
|
318 /* |
|
319 * iConverter |
|
320 * instance of CIRImageConverter |
|
321 */ |
|
322 CIRImageConverter* iConverter; |
|
323 |
|
324 /* |
|
325 * iFilteredModel |
|
326 * Instance for CIRFilteredModel |
|
327 */ |
|
328 CIRFilteredModel* iFilteredModel; |
|
329 /* |
|
330 * iAdPresent |
|
331 * returns whether the advetisment is present or not |
|
332 */ |
|
333 TBool iAdPresent; |
|
334 /* |
|
335 * iBgContext |
|
336 * Instance of CAknsBasicBackgroundControlContext |
|
337 */ |
|
338 CAknsBasicBackgroundControlContext* iBgContext; |
|
339 /* |
|
340 * iAdvString |
|
341 * sets the advertisement string |
|
342 */ |
|
343 HBufC* iAdvString; |
|
344 /* |
|
345 * iListBoxArray |
|
346 * Instance of MIRListBoxArray |
|
347 */ |
|
348 MIRListBoxArray* iListBoxArray; |
|
349 /* |
|
350 * iRequestForAdvertisement |
|
351 * sets when the request for advertisment conversation is made |
|
352 */ |
|
353 TBool iRequestForAdvertisement; |
|
354 /* |
|
355 * iLogoDownloadError |
|
356 * sets when the advertisment future is not supported |
|
357 */ |
|
358 TBool iLogoDownloadError; |
|
359 /* |
|
360 * iLandScapeCount |
|
361 * used to call the aknfind s HandlePopupFindSizeChanged function only once |
|
362 */ |
|
363 TInt iLandScapeCount; |
|
364 |
|
365 /* |
|
366 * iSearchTextBox |
|
367 * Instance for CAknSearchField; |
|
368 */ |
|
369 CAknSearchField* iStationsSearchBox; |
|
370 public: |
|
371 |
|
372 /** |
|
373 * iStationsListBox |
|
374 * Instance of the Stations ListBox |
|
375 */ |
|
376 CIRAdvertisingListBox* iStationsListBox; |
|
377 /** |
|
378 * Temporary preset to store url and the logo data |
|
379 */ |
|
380 CIRIsdsPreset *iTempPreset; |
|
381 /* |
|
382 * iFindString |
|
383 * Used to Get the Entered Search string |
|
384 */ |
|
385 TBuf<KSearchBoxTextLength> iFindString; |
|
386 /** |
|
387 * Temporary preset to store the raw data of Advertisements |
|
388 */ |
|
389 CIRIsdsPreset* iAdvPreset; |
|
390 TInt iError; |
|
391 }; |
|
392 |
|
393 #endif // CIRSTATIONSVIEWCONTAINER_H |