26
|
1 |
/*
|
|
2 |
* Copyright (c) 2008-2009 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: ALF TK utilities
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef C_GLXUIUTILITY_H
|
|
22 |
#define C_GLXUIUTILITY_H
|
|
23 |
|
|
24 |
// external incudes
|
|
25 |
#include <e32base.h>
|
|
26 |
#include <gdi.h>
|
|
27 |
|
|
28 |
#include <alf/alfenv.h> //for action observers
|
|
29 |
|
|
30 |
// Internal includes
|
|
31 |
#include <mglxtvobserver.h> // for inteface MGlxTvObserver
|
|
32 |
|
|
33 |
// constants
|
|
34 |
const TUint KGlxDefaultVisibleItemsGranularity = 15;
|
|
35 |
const TUint KGlxQHDVisibleItemsGranularity = 20;
|
|
36 |
const TUint KGlxVGAVisibleItemsGranularity = 21;
|
|
37 |
|
|
38 |
class MGlxSkinChangeObserver;
|
|
39 |
class CGlxSkinChangeMonitor;
|
|
40 |
class CCoeAppUi;
|
|
41 |
class CGlxSettingsModel;
|
|
42 |
class CGlxTextureManager;
|
|
43 |
class CAlfEnv;
|
|
44 |
class CAlfDisplay;
|
|
45 |
class CAlfTexture;
|
|
46 |
class CAlfControl;
|
|
47 |
class CGlxTv;
|
|
48 |
class CGlxResolutionManager;
|
|
49 |
class CGlxScreenFurniture;
|
|
50 |
class CAknLocalScreenClearer;
|
|
51 |
|
|
52 |
//class CHgContextUtility;
|
|
53 |
/**
|
|
54 |
* Enumeration for different types of navigations that occur from one view to the next
|
|
55 |
*/
|
|
56 |
enum TGlxNavigationDirection
|
|
57 |
{
|
|
58 |
EGlxNavigationForwards,
|
|
59 |
EGlxNavigationBackwards,
|
|
60 |
EGlxNavigationNext,
|
|
61 |
EGlxNavigationPrevious
|
|
62 |
};
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Enumeration for screen orientation of the application.
|
|
66 |
*/
|
|
67 |
enum TGlxOrientation
|
|
68 |
{
|
|
69 |
EGlxOrientationUninitialised, /**< For internal use only */
|
|
70 |
EGlxOrientationDefault, /**< Default orientation for the device */
|
|
71 |
EGlxOrientationTextEntry, /**< Text entry orientation for the device */
|
|
72 |
EGlxOrientationLandscape /**< Landscape orientation */
|
|
73 |
};
|
|
74 |
|
|
75 |
/**
|
|
76 |
* CGlxUiUtility
|
|
77 |
*
|
|
78 |
* Alf utils
|
|
79 |
*
|
|
80 |
* @lib glxalfutils.lib
|
|
81 |
*
|
|
82 |
* @internal reviewed 12/06/2007 by Dave Schofield
|
|
83 |
*/
|
|
84 |
class CGlxUiUtility : public CBase,
|
|
85 |
public MGlxTvObserver , // for TV Out
|
|
86 |
public MAlfActionObserver //FOR layout change notifications
|
|
87 |
{
|
|
88 |
|
|
89 |
public:
|
|
90 |
/**
|
|
91 |
* Get the single instance of the utility and increment the reference count.
|
|
92 |
* The caller must call Close() when the utility is no longer needed.
|
|
93 |
* @return Pointer to the single instance of the UiUtility.
|
|
94 |
*/
|
|
95 |
IMPORT_C static CGlxUiUtility* UtilityL();
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Decrement the reference count of the utility and delete it if the count
|
|
99 |
* becomes zero.
|
|
100 |
*/
|
|
101 |
IMPORT_C void Close();
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Get a pointer to the Alf environment.
|
|
105 |
* @return The ALF environment owned by the AlfUtility.
|
|
106 |
*/
|
|
107 |
IMPORT_C CAlfEnv* Env();
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Get a pointer to the Alf display.
|
|
111 |
* @return The ALF display owned by ALF.
|
|
112 |
*/
|
|
113 |
IMPORT_C CAlfDisplay* Display() const;
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Shows the Alf display in full screen.
|
|
117 |
*/
|
|
118 |
IMPORT_C static void ShowAlfDisplayL();
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Hides the Alf display so that Avkon screen can take over the whole screen
|
|
122 |
* and Avkon dialog can show the status pane.
|
|
123 |
*/
|
|
124 |
IMPORT_C static void HideAlfDisplayL();
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Return the GlxTextureManager owned by the UiUtility.
|
|
128 |
* This pointer is only guaranteed to be valid until the UiUtility is Close()d.
|
|
129 |
* @return The GlxTextureManager owned by the UiUtility
|
|
130 |
*/
|
|
131 |
IMPORT_C CGlxTextureManager& GlxTextureManager();
|
|
132 |
|
|
133 |
/**
|
|
134 |
* @return The current direction of the switch between views
|
|
135 |
*/
|
|
136 |
IMPORT_C TGlxNavigationDirection ViewNavigationDirection();
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Set the current direction of the switch between views
|
|
140 |
* @param aDirection The direction of the navigation
|
|
141 |
*/
|
|
142 |
IMPORT_C void SetViewNavigationDirection(TGlxNavigationDirection aDirection);
|
|
143 |
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Helper function to return display size
|
|
147 |
* @return Display size
|
|
148 |
*/
|
|
149 |
IMPORT_C TSize DisplaySize() const;
|
|
150 |
|
|
151 |
/**
|
|
152 |
* Get an id of a text style corresponding to the font and size
|
|
153 |
* @param aFontId The Avkon logical font Id
|
|
154 |
* @param aSizeInPixels The size of the text
|
|
155 |
* @return The Id of the Text style in the UiTextStyleManager
|
|
156 |
*/
|
|
157 |
IMPORT_C TInt TextStyleIdL(TInt aFontId, TInt aSizeInPixels);
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Set the screen orientation of the application.
|
|
161 |
* @param aOrientation The new orientation.
|
|
162 |
*/
|
|
163 |
IMPORT_C void SetAppOrientationL(TGlxOrientation aOrientation);
|
|
164 |
/**
|
|
165 |
* @return The current screen orientation of the application.
|
|
166 |
*/
|
|
167 |
IMPORT_C TGlxOrientation AppOrientation() const;
|
|
168 |
|
|
169 |
/**
|
|
170 |
* ScreenFurniture
|
|
171 |
* @return pointer to CGlxScreenFurniture
|
|
172 |
*/
|
|
173 |
IMPORT_C CGlxScreenFurniture* ScreenFurniture();
|
|
174 |
|
|
175 |
/**
|
|
176 |
* This method can be used to check whether pen support is enabled.
|
|
177 |
* @return ETrue if pen support is enabled, otherwise EFalse.
|
|
178 |
*/
|
|
179 |
IMPORT_C TBool IsPenSupported();
|
|
180 |
|
|
181 |
/**
|
|
182 |
* This method can be used to set the image size required for Rotation.
|
|
183 |
* @param aRotatedImageSize the image size to be set.
|
|
184 |
*/
|
|
185 |
IMPORT_C void SetRotatedImageSize(TSize aRotatedImageSize);
|
|
186 |
|
|
187 |
/**
|
|
188 |
* This method can be used to Get the image size required for Rotation.
|
|
189 |
* @return the image size for the image to be rotated.
|
|
190 |
*/
|
|
191 |
IMPORT_C TSize GetRotatedImageSize();
|
|
192 |
|
|
193 |
/**
|
|
194 |
* This method can be used to get Icon Size for Grid Widget
|
|
195 |
* @return const TSize.
|
|
196 |
*/
|
|
197 |
IMPORT_C TSize GetGridIconSize();
|
|
198 |
IMPORT_C TBool IsExitingState();
|
|
199 |
|
|
200 |
IMPORT_C void SetExitingState(TBool aIsExiting);
|
|
201 |
/**
|
|
202 |
* Forcibly start the Thumbnail Manager daemon process
|
|
203 |
* @param none
|
|
204 |
* @return TInt
|
|
205 |
*/
|
|
206 |
IMPORT_C TInt StartTNMDaemon();
|
|
207 |
|
|
208 |
/**
|
|
209 |
* To stop the Thumbnail Manager daemon process so as to stop force generation of thumbnails
|
|
210 |
* @param none
|
|
211 |
* @return TInt
|
|
212 |
*/
|
|
213 |
IMPORT_C TInt StopTNMDaemon();
|
|
214 |
|
|
215 |
/**
|
|
216 |
* Get the number of items left for Thumbnail generation
|
|
217 |
* @return TInt number of items left for TN generation
|
|
218 |
*/
|
|
219 |
IMPORT_C TInt GetItemsLeftCount();
|
|
220 |
/**
|
|
221 |
* Returns Visible items granularity based on feature
|
|
222 |
* layout (i.e., qHD, VGA)
|
|
223 |
* @return TInt visible items granularity / count
|
|
224 |
*/
|
|
225 |
IMPORT_C TInt VisibleItemsInPageGranularityL();
|
|
226 |
|
|
227 |
/**
|
|
228 |
* @return The current Grid toolbar being used
|
|
229 |
*/
|
|
230 |
IMPORT_C CAknToolbar* GetGridToolBar();
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Set the current Grid toolbar being used
|
|
234 |
* @param aToolbar Current Toolbar
|
|
235 |
*/
|
|
236 |
IMPORT_C void SetGridToolBar(CAknToolbar* aToolbar);
|
|
237 |
|
|
238 |
/**
|
|
239 |
* Display Blank screen
|
|
240 |
*/
|
|
241 |
IMPORT_C void CGlxUiUtility::DisplayScreenClearerL();
|
|
242 |
|
|
243 |
/**
|
|
244 |
* Destroy Blank screen
|
|
245 |
*/
|
|
246 |
IMPORT_C void CGlxUiUtility::DestroyScreenClearer();
|
|
247 |
|
|
248 |
/**
|
|
249 |
* SetTNMDaemonPSKeyvalue
|
|
250 |
* @return Error code(TInt)
|
|
251 |
*/
|
|
252 |
IMPORT_C TInt SetTNMDaemonPSKeyvalue();
|
|
253 |
|
|
254 |
/**
|
|
255 |
* Get Keyguard on/off PSKeyvalue
|
|
256 |
* @return 0 keyguard off
|
|
257 |
* 1 keyguard on
|
|
258 |
*/
|
|
259 |
IMPORT_C TInt GetKeyguardStatus();
|
|
260 |
|
|
261 |
/**
|
|
262 |
* This method returns the foreground status
|
|
263 |
* @return ETrue if forground; otherwise EFalse.
|
|
264 |
*/
|
|
265 |
IMPORT_C TBool GetForegroundStatus();
|
|
266 |
|
|
267 |
/**
|
|
268 |
* This method will store the foreground status
|
|
269 |
* @param aForeground the foreground status.
|
|
270 |
*/
|
|
271 |
IMPORT_C void SetForegroundStatus(TBool aForeground);
|
|
272 |
|
|
273 |
public: // from class MGlxTvObserver
|
|
274 |
|
|
275 |
/**
|
|
276 |
* @ref MGlxTvObserver::HandleTvStatusChangedL
|
|
277 |
*/
|
|
278 |
IMPORT_C void HandleTvStatusChangedL( TTvChangeType aChangeType );
|
|
279 |
|
|
280 |
|
|
281 |
public://from MAlfActionObserver
|
|
282 |
|
|
283 |
/**
|
|
284 |
* @ref MAlfActionObserver::HandleActionL
|
|
285 |
*/
|
|
286 |
void HandleActionL (const TAlfActionCommand &aActionCommand);
|
|
287 |
public:
|
|
288 |
|
|
289 |
/**
|
|
290 |
*Add MGlxSkinChangeObserver to skin change observers array.
|
|
291 |
*@param aObserver Reference of the MGlxSkinChangeObserver.
|
|
292 |
*/
|
|
293 |
IMPORT_C void AddSkinChangeObserverL(MGlxSkinChangeObserver& aObserver);
|
|
294 |
|
|
295 |
|
|
296 |
/**
|
|
297 |
*Remove MGlxSkinChangeObserver from skin change observers array.
|
|
298 |
*@param aObserver Reference of the MGlxSkinChangeObserver.
|
|
299 |
*/
|
|
300 |
IMPORT_C void RemoveSkinChangeObserver(MGlxSkinChangeObserver& aObserver);
|
|
301 |
|
|
302 |
public:
|
|
303 |
// Callback for periodic timer, static,
|
|
304 |
static TInt PeriodicCallback( TAny* aPtr );
|
|
305 |
|
|
306 |
// Non-static func called from periodic timer
|
|
307 |
void CreateAlfEnvCallbackL();
|
|
308 |
private:
|
|
309 |
/**
|
|
310 |
* C++ default constructor.
|
|
311 |
*/
|
|
312 |
CGlxUiUtility();
|
|
313 |
/**
|
|
314 |
* 2nd phase constructor.
|
|
315 |
*/
|
|
316 |
void ConstructL();
|
|
317 |
/**
|
|
318 |
* Destructor.
|
|
319 |
*/
|
|
320 |
~CGlxUiUtility();
|
|
321 |
|
|
322 |
/** 2-phase constructor */
|
|
323 |
static CGlxUiUtility* NewL();
|
|
324 |
|
|
325 |
private:
|
|
326 |
/**
|
|
327 |
* Create the secondary TV Out Display
|
|
328 |
*/
|
|
329 |
void CreateTvOutDisplayL();
|
|
330 |
|
|
331 |
/**
|
|
332 |
* Destroy the secondary TV Out Display
|
|
333 |
*/
|
|
334 |
void DestroyTvOutDisplay();
|
|
335 |
/**
|
|
336 |
* Calculate the Grid Icon Size for Grid Widget. It always calculate
|
|
337 |
* size for Landscape orientation. This is done to avoid saving two
|
|
338 |
* different thumbnail icons in Thumbnail database.
|
|
339 |
*/
|
|
340 |
void GridIconSizeL();
|
|
341 |
|
|
342 |
/**
|
|
343 |
* Create Alf environment
|
|
344 |
*/
|
|
345 |
void CreateAlfEnvL();
|
|
346 |
|
|
347 |
// internal class to contain details of a style
|
|
348 |
private:
|
|
349 |
class TGlxTextStyle
|
|
350 |
{
|
|
351 |
public:
|
|
352 |
TGlxTextStyle( TInt aFontId, TInt aSizeInPixels, TInt aStyleId )
|
|
353 |
: iFontId(aFontId), iSizeInPixels( aSizeInPixels ), iStyleId( aStyleId )
|
|
354 |
{};
|
|
355 |
public:
|
|
356 |
TInt iFontId;
|
|
357 |
TInt iSizeInPixels;
|
|
358 |
TInt iStyleId;
|
|
359 |
};
|
|
360 |
|
|
361 |
private:
|
|
362 |
/** Pointer to the appui (not owned) */
|
|
363 |
CCoeAppUi* iAppUi;
|
|
364 |
|
|
365 |
/** The Alf environment (owned) */
|
|
366 |
CAlfEnv* iEnv;
|
|
367 |
|
|
368 |
/** The Alf display used by the control (not owned) */
|
|
369 |
CAlfDisplay* iAlfDisplay;
|
|
370 |
|
|
371 |
/** The texture manager (owned) */
|
|
372 |
CGlxTextureManager* iGlxTextureManager;
|
|
373 |
|
|
374 |
/** Avkon control hosting the TV Alf display (owned) */
|
|
375 |
CAlfDisplay* iTvDisplay;
|
|
376 |
|
|
377 |
/** Pointer to TvOut monitoring object (owned) */
|
|
378 |
CGlxTv* iGlxTvOut;
|
|
379 |
|
|
380 |
/** Pointer to resolution manager object (owned) */
|
|
381 |
CGlxResolutionManager* iGlxResolutionManager;
|
|
382 |
|
|
383 |
/** Application settings model */
|
|
384 |
CGlxSettingsModel* iSettingsModel;
|
|
385 |
|
|
386 |
/// Current navigation direction between views
|
|
387 |
TGlxNavigationDirection iNavigationDirection;
|
|
388 |
|
|
389 |
/** Array of details of created styles */
|
|
390 |
RArray<TGlxTextStyle> iTextStyles;
|
|
391 |
|
|
392 |
/** Screen orientation of the application */
|
|
393 |
TGlxOrientation iOrientation;
|
|
394 |
|
|
395 |
/** Avkon control for monitoring skin changes*/
|
|
396 |
CGlxSkinChangeMonitor* iGlxSkinChangeMonitor;
|
|
397 |
|
|
398 |
TBool iShared;
|
|
399 |
TSize iGridIconSize;
|
|
400 |
|
|
401 |
CGlxScreenFurniture* iScreenFurniture;
|
|
402 |
TBool iIsExiting;
|
|
403 |
//Added to give the Image size to the Coverflow Widget for Rotation
|
|
404 |
TSize iRotatedImageSize;
|
|
405 |
|
|
406 |
//current Toolbar being used
|
|
407 |
CAknToolbar* iToolbar;
|
|
408 |
CPeriodic* iPeriodic;
|
|
409 |
CAknLocalScreenClearer* iClearer;
|
|
410 |
|
|
411 |
/** The foreground status flag */
|
|
412 |
TBool iIsForeground;
|
|
413 |
};
|
|
414 |
|
|
415 |
|
|
416 |
#endif // C_GLXALFUTILITY_H
|