|
1 /* |
|
2 * Copyright (c) 2006-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: Implements CHuiStatic, static data access and utility |
|
15 * functions such as timing. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include "uiacceltk/HuiStatic.h" // Class definition |
|
22 #include "uiacceltk/HuiUtil.h" |
|
23 #include "uiacceltk/HuiEnv.h" |
|
24 #include "HuiRenderPlugin.h" |
|
25 #include "huistatictlsdata.h" |
|
26 #include "uiacceltk/HuiProbe.h" |
|
27 #include <e32math.h> |
|
28 #include <eikenv.h> |
|
29 #include <flogger.h> |
|
30 #include <AknsUtils.h> |
|
31 #include <AknUtils.h> |
|
32 #include <AknBidiTextUtils.h> |
|
33 #include <bidivisual.h> |
|
34 #include "alfappfwproxyops.h" |
|
35 |
|
36 |
|
37 |
|
38 // Global writeable data, used in HW instead of TLS which relatively slow |
|
39 #ifndef __WINSCW__ |
|
40 TTlsData globalWriteableData; |
|
41 #endif |
|
42 |
|
43 void CleanupWg(TAny* aWg) |
|
44 { |
|
45 RWindowGroup* wg = static_cast<RWindowGroup*>(aWg); |
|
46 delete wg; |
|
47 } |
|
48 |
|
49 /** Dummy implementation for HuiProbe, to be used when external probe is not set */ |
|
50 NONSHARABLE_CLASS(TFakeProbe) : public MHuiProbe |
|
51 { |
|
52 public: |
|
53 virtual void ReportObjectLifeCycleEvent(const MHuiSessionObject&, TLifecycleEvent) {} |
|
54 virtual void ReportProgramFlowEvent(TProgramFlowPoint, TProgramFlowEvent) {} |
|
55 virtual void ReportProgramFlowEvent(const MHuiSessionObject&, TProgramFlowPoint, TProgramFlowEvent) {} |
|
56 void ReportFrameRate(TInt) const {} |
|
57 void AssociateWithCurrentSession(MHuiSessionObject&) {} |
|
58 }; |
|
59 |
|
60 |
|
61 NONSHARABLE_CLASS(CAppFwProxy): public CBase |
|
62 { |
|
63 public: |
|
64 class CAlfLayoutListener: public CActive |
|
65 { |
|
66 public: |
|
67 CAlfLayoutListener(CAppFwProxy& aNotif):CActive(CActive::EPriorityStandard), iNotif(aNotif) |
|
68 { |
|
69 CActiveScheduler::Add(this); |
|
70 iStatus = KErrNotFound; |
|
71 } |
|
72 |
|
73 ~CAlfLayoutListener() |
|
74 { |
|
75 Cancel(); |
|
76 } |
|
77 |
|
78 void RunL() |
|
79 { |
|
80 iNotif.iLayoutMirrored = (iStatus.Int() > 0); |
|
81 SetActive(); |
|
82 TAlfCommandParams params={EAlfIsMirrorred,0,0,0}; |
|
83 TPckgC<TAlfCommandParams> pkg(params); |
|
84 TBuf8<1> awkwardApiDummy; |
|
85 iNotif.iNotif.StartNotifierAndGetResponse(iStatus,TUid::Uid(KAlfAppFwProxyUid), pkg, awkwardApiDummy); } |
|
86 |
|
87 void DoCancel() |
|
88 { |
|
89 // just wait for notifier completion |
|
90 User::WaitForRequest(iStatus); |
|
91 } |
|
92 |
|
93 private: |
|
94 CAppFwProxy& iNotif; |
|
95 }; |
|
96 |
|
97 CAppFwProxy():iLayoutMirrored(KErrNotFound) |
|
98 {} |
|
99 |
|
100 ~CAppFwProxy() |
|
101 { |
|
102 if (iConnected) |
|
103 { |
|
104 iNotif.Close(); |
|
105 delete iLayoutUpdateAo; |
|
106 } |
|
107 } |
|
108 |
|
109 TBool Connect() |
|
110 { |
|
111 if (!iConnected) |
|
112 { |
|
113 // perhaps should check also whether eikon server / notifier server exists.. |
|
114 iConnected = (iNotif.Connect() == KErrNone); |
|
115 } |
|
116 return iConnected; |
|
117 } |
|
118 |
|
119 TBool LayoutMirrored() |
|
120 { |
|
121 if ( Connect() && iLayoutMirrored == KErrNotFound) |
|
122 { |
|
123 TRequestStatus status; |
|
124 TAlfCommandParams params={EAlfIsMirrorred,0,0,0}; |
|
125 TPckgC<TAlfCommandParams> pkg(params); |
|
126 TBuf8<1> awkwardApiDummy; |
|
127 iNotif.StartNotifierAndGetResponse(status,TUid::Uid(KAlfAppFwProxyUid), pkg, awkwardApiDummy); |
|
128 User::WaitForRequest(status); |
|
129 // order updates |
|
130 iLayoutUpdateAo = new CAlfLayoutListener(*this); |
|
131 if (iLayoutUpdateAo) |
|
132 { |
|
133 TRAP_IGNORE(iLayoutUpdateAo->RunL()); |
|
134 } |
|
135 |
|
136 iLayoutMirrored = (status.Int() > 0); |
|
137 } |
|
138 |
|
139 return iLayoutMirrored==KErrNotFound?EFalse:iLayoutMirrored; |
|
140 } |
|
141 |
|
142 TInt SoftKeyOrientation() |
|
143 { |
|
144 TInt ret = 0; |
|
145 if ( Connect() ) |
|
146 { |
|
147 TRequestStatus status; |
|
148 TAlfCommandParams params={EAlfCbaLocation,0,0,0}; |
|
149 TPckgC<TAlfCommandParams> pkg(params); |
|
150 TBuf8<1> awkwardApiDummy; |
|
151 iNotif.StartNotifierAndGetResponse(status,TUid::Uid(KAlfAppFwProxyUid), pkg, awkwardApiDummy); |
|
152 User::WaitForRequest(status); |
|
153 ret = status.Int(); |
|
154 } |
|
155 |
|
156 return ret; |
|
157 } |
|
158 |
|
159 TRect LayoutMetricsRect(TInt aType) |
|
160 { |
|
161 TRect ret=TRect(0,0,0,0); |
|
162 if ( Connect() ) |
|
163 { |
|
164 TRequestStatus status; |
|
165 TAlfCommandParams params={EAlfLayoutMetricsRect,aType,0,0}; |
|
166 TPckgC<TAlfCommandParams> pkg(params); |
|
167 TPckg<TRect> retpkg(ret); |
|
168 |
|
169 iNotif.StartNotifierAndGetResponse(status,TUid::Uid(KAlfAppFwProxyUid), pkg, retpkg); |
|
170 User::WaitForRequest(status); |
|
171 } |
|
172 |
|
173 return ret; |
|
174 } |
|
175 |
|
176 TInt GetCachedColor(TRgb& aRgb, const TAknsItemID& aID, |
|
177 const TInt aIndex ) |
|
178 { |
|
179 if ( Connect() ) |
|
180 { |
|
181 TRequestStatus status; |
|
182 TAlfCommandParams params={EAlfGetCachedColor,aID.iMajor,aID.iMinor,aIndex}; |
|
183 TPckgC<TAlfCommandParams> pkg(params); |
|
184 TPckg<TRgb> retpkg(aRgb); |
|
185 |
|
186 iNotif.StartNotifierAndGetResponse(status,TUid::Uid(KAlfAppFwProxyUid), pkg, retpkg); |
|
187 User::WaitForRequest(status); |
|
188 return status.Int(); |
|
189 } |
|
190 |
|
191 return KErrCouldNotConnect; |
|
192 } |
|
193 |
|
194 void GetSkinBitmapL(CFbsBitmap* aBitmap, CFbsBitmap* aMask, const TAknsItemID& aID, const TDesC& aFileName, TInt aBitmapId, |
|
195 TInt aMaskId, const TSize& aSize, TScaleMode aScaleMode) |
|
196 { |
|
197 if ( Connect() ) |
|
198 { |
|
199 TRequestStatus status; |
|
200 TAlfCommandParams2 params={EAlfGetSkinBitmap,aID.iMajor,aID.iMinor,aBitmapId,aMaskId,aFileName, aSize, aScaleMode}; |
|
201 TPckgC<TAlfCommandParams2> pkg(params); |
|
202 TInt2 handles = {0,0}; |
|
203 TPckg<TInt2> retpkg(handles); |
|
204 |
|
205 iNotif.StartNotifierAndGetResponse(status,TUid::Uid(KAlfAppFwProxyUid), pkg, retpkg); |
|
206 User::WaitForRequest(status); |
|
207 User::LeaveIfError(status.Int()); |
|
208 if (!handles.iInt1) |
|
209 { |
|
210 User::Leave(KErrNotFound); |
|
211 } |
|
212 User::LeaveIfError(aBitmap->Duplicate(handles.iInt1)); |
|
213 if ( aMask && handles.iInt2 ) |
|
214 { |
|
215 User::LeaveIfError(aMask->Duplicate(handles.iInt2)); |
|
216 } |
|
217 } |
|
218 } |
|
219 |
|
220 void GetSkinBackgroundBitmapL(CFbsBitmap* aBitmap, const TAknsItemID& aID ) |
|
221 { |
|
222 if ( Connect() ) |
|
223 { |
|
224 TRequestStatus status; |
|
225 TAlfCommandParams params={EAlfGetSkinBackgroundBitmap,aID.iMajor,aID.iMinor,0}; |
|
226 TPckgC<TAlfCommandParams> pkg(params); |
|
227 TInt handle = 0; |
|
228 TPckg<TInt> retpkg(handle); |
|
229 |
|
230 iNotif.StartNotifierAndGetResponse(status,TUid::Uid(KAlfAppFwProxyUid), pkg, retpkg); |
|
231 User::WaitForRequest(status); |
|
232 User::LeaveIfError(status.Int()); |
|
233 User::LeaveIfError(aBitmap->Duplicate(handle)); |
|
234 } |
|
235 } |
|
236 |
|
237 void GetCachedSkinItemDataArrayL(const TAknsItemID& aID, TInt aType, TAlfCachedSkinItemArray& aArray) |
|
238 { |
|
239 if ( Connect() ) |
|
240 { |
|
241 TRequestStatus status; |
|
242 TAlfCommandParams params={EGetCachedSkinItemData,aID.iMajor,aID.iMinor,aType}; |
|
243 TPckgC<TAlfCommandParams> pkg(params); |
|
244 TPckg<TAlfCachedSkinItemArray> retpkg(aArray); |
|
245 |
|
246 iNotif.StartNotifierAndGetResponse(status,TUid::Uid(KAlfAppFwProxyUid), pkg, retpkg); |
|
247 User::WaitForRequest(status); |
|
248 User::LeaveIfError(status.Int()); |
|
249 } |
|
250 } |
|
251 |
|
252 void GetListOfWindowGroupsL(TRequestStatus& aStatus, TPtr8& aPtr) |
|
253 { |
|
254 if ( Connect() ) |
|
255 { |
|
256 TAlfCommandParams params={EGetListOfWindowGroups,0,0,0}; |
|
257 TPckgC<TAlfCommandParams> pkg(params); |
|
258 iNotif.StartNotifierAndGetResponse(aStatus,TUid::Uid(KAlfAppFwProxyUid), pkg, aPtr); |
|
259 } |
|
260 } |
|
261 public: |
|
262 TBool iLayoutMirrored; |
|
263 RNotifier iNotif; |
|
264 TBool iConnected; |
|
265 CAlfLayoutListener* iLayoutUpdateAo; |
|
266 }; |
|
267 |
|
268 CHuiStatic* CHuiStatic::NewLC(CHuiEnv* aPrimaryEnv) |
|
269 { |
|
270 CHuiStatic* self = new (ELeave) CHuiStatic(); |
|
271 CleanupStack::PushL(self); |
|
272 self->ConstructL(aPrimaryEnv); |
|
273 return self; |
|
274 } |
|
275 |
|
276 |
|
277 CHuiStatic* CHuiStatic::NewL(CHuiEnv* aPrimaryEnv) |
|
278 { |
|
279 CHuiStatic* self = NewLC(aPrimaryEnv); |
|
280 CleanupStack::Pop(self); |
|
281 return self; |
|
282 } |
|
283 |
|
284 |
|
285 CHuiStatic::CHuiStatic() |
|
286 { |
|
287 } |
|
288 |
|
289 |
|
290 void CHuiStatic::ConstructL(CHuiEnv* aPrimaryEnv) |
|
291 { |
|
292 iData = new (ELeave) TTlsData(); |
|
293 |
|
294 iData->iPrimaryEnv = aPrimaryEnv; |
|
295 iData->iIdCounter = -1; |
|
296 iData->iTimeFactor = 1.0; |
|
297 iData->iIsFirstUpdateTime = ETrue; |
|
298 iData->iFirstUpdateTime.UniversalTime(); |
|
299 iData->iUniversalTime.UniversalTime(); |
|
300 iData->iRealUniversalTime.UniversalTime(); |
|
301 iData->iLastFpsTime.UniversalTime(); |
|
302 iData->DoInitL(); // make sure that we have infra even CCoeEnv was not there |
|
303 |
|
304 // Re-construct the virtual table for iFakeProbe |
|
305 iData->iFakeProbe = new (ELeave) TFakeProbe; |
|
306 |
|
307 iData->iAppFwProxy = new (ELeave) CAppFwProxy; |
|
308 |
|
309 //Register for environment change ( here system time change ) event notification |
|
310 iChangeNotifier = CEnvironmentChangeNotifier::NewL(0, TCallBack(CHuiStatic::SettingChangedCallBack, this)); |
|
311 iChangeNotifier->Start(); |
|
312 #ifndef __WINSCW__ |
|
313 globalWriteableData = *iData; |
|
314 #else |
|
315 Dll::SetTls(iData); |
|
316 #endif |
|
317 |
|
318 #ifndef WIN32 |
|
319 #ifdef HUI_DEBUG_WITH_PRINTF |
|
320 EnableLogging(); |
|
321 #endif |
|
322 #endif |
|
323 } |
|
324 |
|
325 |
|
326 CHuiStatic::~CHuiStatic() |
|
327 { |
|
328 if(iData) |
|
329 { |
|
330 if(iData->iFakeProbe) |
|
331 { |
|
332 delete iData->iFakeProbe; |
|
333 iData->iFakeProbe = NULL; |
|
334 } |
|
335 iData->iLogFile.Close(); |
|
336 delete iData->iAppFwProxy; |
|
337 iData->Disconnect(); |
|
338 } |
|
339 iChangeNotifier->Cancel(); |
|
340 delete iChangeNotifier; |
|
341 #ifdef __WINSCW__ |
|
342 Dll::FreeTls(); |
|
343 #endif |
|
344 delete iData; |
|
345 } |
|
346 |
|
347 |
|
348 EXPORT_C TTlsData* CHuiStatic::Data() |
|
349 { |
|
350 #ifndef __WINSCW__ |
|
351 return &globalWriteableData; |
|
352 #else |
|
353 return static_cast<TTlsData*>(Dll::Tls()); |
|
354 #endif |
|
355 } |
|
356 |
|
357 |
|
358 void CHuiStatic::UpdateTime(TTlsData* aData) |
|
359 { |
|
360 ASSERT( aData ); |
|
361 // Updates the toolkit's time counters. This includes the toolkit's |
|
362 // realtime clock, the internal absolute clock (which is affected by the |
|
363 // time factor), the amount of elapsed time since last UpdateTime() |
|
364 // invocation, and the amount of elapsed time since the first UpdateTime() |
|
365 // invocation (which was done in the beginning of the first refresh). |
|
366 |
|
367 if(aData->iIsFirstUpdateTime) |
|
368 { |
|
369 aData->iIsFirstUpdateTime = EFalse; |
|
370 aData->iFirstUpdateTime.UniversalTime(); |
|
371 aData->iUniversalTime = aData->iFirstUpdateTime; |
|
372 aData->iRealUniversalTime = aData->iUniversalTime; |
|
373 return; |
|
374 } |
|
375 |
|
376 TTime now; |
|
377 now.UniversalTime(); |
|
378 |
|
379 // Advance the toolkit's internal clock, applying the time factor. |
|
380 if(!aData->iTimePaused) |
|
381 { |
|
382 aData->iInternalElapsed = now.MicroSecondsFrom(aData->iRealUniversalTime).Int64(); |
|
383 aData->iInternalElapsed = (TInt64)((TReal32)aData->iInternalElapsed * aData->iTimeFactor); |
|
384 aData->iUniversalTime += TTimeIntervalMicroSeconds(aData->iInternalElapsed); |
|
385 } |
|
386 else |
|
387 { |
|
388 aData->iInternalElapsed = aData->iInternalElapsedBeforePausing; |
|
389 aData->iInternalElapsedBeforePausing = 0; |
|
390 } |
|
391 |
|
392 aData->iRealUniversalTime = now; |
|
393 } |
|
394 |
|
395 |
|
396 TUint32 CHuiStatic::MilliSecondsSinceUpdateTime() |
|
397 { |
|
398 TTlsData* data = Data(); |
|
399 |
|
400 TTime now; |
|
401 now.UniversalTime(); |
|
402 |
|
403 return now.MicroSecondsFrom(data->iRealUniversalTime).Int64() / 1000; |
|
404 } |
|
405 |
|
406 |
|
407 EXPORT_C CHuiEnv& CHuiStatic::Env() |
|
408 { |
|
409 if(!Data()) |
|
410 { |
|
411 THuiPanic::Panic(THuiPanic::EStaticDataNotCreated); |
|
412 } |
|
413 return *Data()->iPrimaryEnv; |
|
414 } |
|
415 |
|
416 |
|
417 EXPORT_C CHuiRenderPlugin& CHuiStatic::Renderer() |
|
418 { |
|
419 if(!Data() || !Data()->iRenderer) |
|
420 { |
|
421 HUI_DEBUG(_L("CHuiStatic::Renderer() - Static data or renderer not specified.")); |
|
422 THuiPanic::Panic(THuiPanic::EStaticInvalidRenderer); |
|
423 } |
|
424 return *Data()->iRenderer; |
|
425 } |
|
426 |
|
427 |
|
428 void CHuiStatic::SetRenderer(CHuiRenderPlugin& aRenderer) |
|
429 { |
|
430 if(!Data()) |
|
431 { |
|
432 THuiPanic::Panic(THuiPanic::EStaticDataNotCreated); |
|
433 } |
|
434 Data()->iRenderer = &aRenderer; |
|
435 } |
|
436 |
|
437 |
|
438 // @TODO SHOULD THIS BE MODIFIED SOMEHOW, OR IS THIS EXPORT OK??? |
|
439 EXPORT_C CHuiBitgdiRenderPlugin& CHuiStatic::BitgdiRenderer() |
|
440 { |
|
441 CHuiRenderPlugin* renderer = &Renderer(); |
|
442 if(renderer->Id() != EHuiRenderPluginBitgdi) |
|
443 { |
|
444 HUI_DEBUG(_L("CHuiStatic::BitgdiRenderer() - Renderer cannot be used as Bitgdi renderer.")); |
|
445 THuiPanic::Panic(THuiPanic::EStaticInvalidRenderer); |
|
446 } |
|
447 return *reinterpret_cast< CHuiBitgdiRenderPlugin* >(renderer); |
|
448 } |
|
449 |
|
450 |
|
451 EXPORT_C CHuiVg10RenderPlugin& CHuiStatic::Vg10Renderer() |
|
452 { |
|
453 CHuiRenderPlugin* renderer = &Renderer(); |
|
454 if(renderer->Id() != EHuiRenderPluginVg10) |
|
455 { |
|
456 HUI_DEBUG(_L("CHuiStatic::Vg10Renderer() - Renderer cannot be used as Vg10 renderer.")); |
|
457 THuiPanic::Panic(THuiPanic::EStaticInvalidRenderer); |
|
458 } |
|
459 return *reinterpret_cast< CHuiVg10RenderPlugin* >(renderer); |
|
460 } |
|
461 |
|
462 |
|
463 EXPORT_C CHuiGles10RenderPlugin& CHuiStatic::Gles10Renderer() |
|
464 { |
|
465 CHuiRenderPlugin* renderer = &Renderer(); |
|
466 if(renderer->Id() != EHuiRenderPluginGles10 && |
|
467 renderer->Id() != EHuiRenderPluginGles11) // compatible |
|
468 { |
|
469 HUI_DEBUG(_L("CHuiStatic::Gles10Renderer() - Renderer cannot be used as Gles10 renderer.")); |
|
470 THuiPanic::Panic(THuiPanic::EStaticInvalidRenderer); |
|
471 } |
|
472 return *reinterpret_cast< CHuiGles10RenderPlugin* >(renderer); |
|
473 } |
|
474 |
|
475 |
|
476 EXPORT_C CHuiGles11RenderPlugin& CHuiStatic::Gles11Renderer() |
|
477 { |
|
478 CHuiRenderPlugin* renderer = &Renderer(); |
|
479 if(renderer->Id() != EHuiRenderPluginGles11) |
|
480 { |
|
481 HUI_DEBUG(_L("CHuiStatic::Gles11Renderer() - Renderer cannot be used as Gles11 renderer.")); |
|
482 THuiPanic::Panic(THuiPanic::EStaticInvalidRenderer); |
|
483 } |
|
484 return *reinterpret_cast< CHuiGles11RenderPlugin* >(renderer); |
|
485 } |
|
486 |
|
487 |
|
488 EXPORT_C CHuiGles20RenderPlugin& CHuiStatic::Gles20Renderer() |
|
489 { |
|
490 CHuiRenderPlugin* renderer = &Renderer(); |
|
491 if(renderer->Id() != EHuiRenderPluginGles20) |
|
492 { |
|
493 HUI_DEBUG(_L("CHuiStatic::Gles20Renderer() - Renderer cannot be used as Gles20 renderer.")); |
|
494 THuiPanic::Panic(THuiPanic::EStaticInvalidRenderer); |
|
495 } |
|
496 return *reinterpret_cast< CHuiGles20RenderPlugin* >(renderer); |
|
497 } |
|
498 |
|
499 |
|
500 EXPORT_C MHuiRenderSurface* CHuiStatic::CurrentRenderSurface() |
|
501 { |
|
502 if(!Data()) |
|
503 { |
|
504 HUI_DEBUG(_L("CHuiStatic::CurrentRenderSurface() - Static data or current render surface not specified. Panicking.")); |
|
505 THuiPanic::Panic(THuiPanic::EStaticCurrentRenderSurfaceNotSpecified); |
|
506 } |
|
507 return Data()->iCurrentRenderSurface; |
|
508 } |
|
509 |
|
510 |
|
511 EXPORT_C void CHuiStatic::SetCurrentRenderSurface(MHuiRenderSurface* aSurface) |
|
512 { |
|
513 Data()->iCurrentRenderSurface = aSurface; |
|
514 } |
|
515 |
|
516 |
|
517 EXPORT_C void CHuiStatic::EnableLogging(TBool aEnable) |
|
518 { |
|
519 TTlsData* data = Data(); |
|
520 |
|
521 if(aEnable && !data->iLogEnabled) |
|
522 { |
|
523 data->iLogEnabled = ETrue; |
|
524 |
|
525 // debug code only |
|
526 TFileName filename; |
|
527 filename.Append('e'); |
|
528 filename.Append(':'); |
|
529 filename.Append('\\'); |
|
530 filename.Append(_L("HuiMessages.log")); |
|
531 |
|
532 if(data->iLogFile.Replace(*data->iFs, filename, EFileWrite) != KErrNone) |
|
533 { |
|
534 RDebug::Print(_L("CHuiStatic::EnableLogging() - Could not open log file e:HuiMessages.log for writing. Trying c: ..")); |
|
535 _LIT(KFileName2, "c:\\HuiMessages.log"); |
|
536 if(data->iLogFile.Replace(*data->iFs, KFileName2, EFileWrite) != KErrNone) |
|
537 { |
|
538 RDebug::Print(_L("CHuiStatic::EnableLogging() - Could not open log file c:HuiMessages.log for writing. Logging disabled.")); |
|
539 data->iLogEnabled = EFalse; |
|
540 } |
|
541 else |
|
542 { |
|
543 RDebug::Print(_L("CHuiStatic::EnableLogging() - Enabled Logging to c \"HuiMessages.log\".")); |
|
544 Printf(_L("CHuiStatic::EnableLogging() - Enabled Logging to \"HuiMessages.log\".")); |
|
545 } |
|
546 } |
|
547 else |
|
548 { |
|
549 RDebug::Print(_L("CHuiStatic::EnableLogging() - Enabled Logging to mmc \"HuiMessages.log\".")); |
|
550 Printf(_L("CHuiStatic::EnableLogging() - Enabled Logging to mmc \"HuiMessages.log\".")); |
|
551 } |
|
552 } |
|
553 else if(!aEnable && data->iLogEnabled) |
|
554 { |
|
555 data->iLogFile.Close(); |
|
556 data->iLogEnabled = EFalse; |
|
557 } |
|
558 else |
|
559 { |
|
560 // for PC lint |
|
561 } |
|
562 } |
|
563 |
|
564 |
|
565 EXPORT_C TBool CHuiStatic::Logging() |
|
566 { |
|
567 return Data()->iLogEnabled; |
|
568 } |
|
569 |
|
570 |
|
571 EXPORT_C void CHuiStatic::ContinueRefresh() |
|
572 { |
|
573 TTlsData* data = Data(); |
|
574 if(data && data->iPrimaryEnv) |
|
575 { |
|
576 data->iPrimaryEnv->ContinueRefresh(); |
|
577 } |
|
578 } |
|
579 |
|
580 |
|
581 void CHuiStatic::UpdateTime() |
|
582 { |
|
583 // Updates the toolkit's time counters. This includes the toolkit's |
|
584 // realtime clock, the internal absolute clock (which is affected by the |
|
585 // time factor), the amount of elapsed time since last UpdateTime() |
|
586 // invocation, and the amount of elapsed time since the first UpdateTime() |
|
587 // invocation (which was done in the beginning of the first refresh). |
|
588 |
|
589 TTlsData* data = Data(); |
|
590 |
|
591 UpdateTime(data); |
|
592 } |
|
593 |
|
594 |
|
595 EXPORT_C const TTime& CHuiStatic::Time() |
|
596 { |
|
597 return Data()->iUniversalTime; |
|
598 } |
|
599 |
|
600 |
|
601 EXPORT_C void CHuiStatic::SetTimeFactor(TReal32 aTimeFactor) __SOFTFP |
|
602 { |
|
603 TTlsData* data = Data(); |
|
604 |
|
605 if(data) |
|
606 { |
|
607 if(aTimeFactor < 0) |
|
608 { |
|
609 aTimeFactor = 0; |
|
610 } |
|
611 |
|
612 if(data->iTimeFactor == 0 && aTimeFactor != 0) |
|
613 { |
|
614 // Continuing from a paused state |
|
615 UpdateTime(data); |
|
616 } |
|
617 |
|
618 data->iTimeFactor = aTimeFactor; |
|
619 } |
|
620 } |
|
621 |
|
622 |
|
623 EXPORT_C TReal32 CHuiStatic::TimeFactor() __SOFTFP |
|
624 { |
|
625 TTlsData* data = Data(); |
|
626 |
|
627 if(data) |
|
628 { |
|
629 return data->iTimeFactor; |
|
630 } |
|
631 return 1.0; |
|
632 } |
|
633 |
|
634 |
|
635 EXPORT_C void CHuiStatic::PauseTime() |
|
636 { |
|
637 TTlsData* data = Data(); |
|
638 |
|
639 if(data) |
|
640 { |
|
641 // Update internal elapsed |
|
642 UpdateTime(data); |
|
643 // Cache internal elapsed in internal time passed before pausing |
|
644 data->iInternalElapsedBeforePausing = data->iInternalElapsed; |
|
645 // Pause timing |
|
646 data->iTimePaused = ETrue; |
|
647 } |
|
648 } |
|
649 |
|
650 |
|
651 EXPORT_C void CHuiStatic::ContinueTime() |
|
652 { |
|
653 TTlsData* data = Data(); |
|
654 |
|
655 if(data && data->iTimePaused) |
|
656 { |
|
657 UpdateTime(data); |
|
658 data->iTimePaused = EFalse; |
|
659 } |
|
660 } |
|
661 |
|
662 |
|
663 EXPORT_C TBool CHuiStatic::TimePaused() |
|
664 { |
|
665 TTlsData* data = Data(); |
|
666 |
|
667 if(data) |
|
668 { |
|
669 return data->iTimePaused; |
|
670 } |
|
671 return EFalse; |
|
672 } |
|
673 |
|
674 |
|
675 EXPORT_C TReal32 CHuiStatic::ElapsedSeconds() __SOFTFP |
|
676 { |
|
677 TTlsData* data = Data(); |
|
678 |
|
679 if(data) |
|
680 { |
|
681 #ifdef EKA2 |
|
682 return data->iInternalElapsed / 1.0e6; |
|
683 #else |
|
684 return data->iInternalElapsed.GetTReal() / 1.0e6; |
|
685 #endif |
|
686 } |
|
687 return 0; |
|
688 } |
|
689 |
|
690 |
|
691 EXPORT_C TReal32 CHuiStatic::SecondsSinceStart() __SOFTFP |
|
692 { |
|
693 TTlsData* data = Data(); |
|
694 if(!data) |
|
695 { |
|
696 // Time has not begun yet. |
|
697 return 0; |
|
698 } |
|
699 |
|
700 // Calculate difference between internal absolute clock and the first update time. |
|
701 TInt64 delta = data->iUniversalTime.MicroSecondsFrom(data->iFirstUpdateTime).Int64(); |
|
702 #ifdef EKA2 |
|
703 return delta / 1.0e6; |
|
704 #else |
|
705 return delta.GetTReal() / 1.0e6; |
|
706 #endif |
|
707 } |
|
708 |
|
709 |
|
710 EXPORT_C TUint32 CHuiStatic::MilliSecondsSinceStart() |
|
711 { |
|
712 // This will wrap around in approx. 50 days. |
|
713 TTlsData* data = Data(); |
|
714 if(data) |
|
715 { |
|
716 // Calculate difference between internal absolute clock and the first update time. |
|
717 TInt64 delta = data->iUniversalTime.MicroSecondsFrom(data->iFirstUpdateTime).Int64(); |
|
718 return delta / 1000; |
|
719 } |
|
720 return 0; |
|
721 |
|
722 } |
|
723 |
|
724 |
|
725 TInt CHuiStatic::GenerateId() |
|
726 { |
|
727 TTlsData* data = Data(); |
|
728 |
|
729 // The ID counter counts backwards. |
|
730 TInt id = data->iIdCounter; |
|
731 |
|
732 if(data->iIdCounter == KMinTInt) |
|
733 { |
|
734 // Wrap around to stay negative. |
|
735 data->iIdCounter = -1; |
|
736 } |
|
737 else |
|
738 { |
|
739 --data->iIdCounter; |
|
740 } |
|
741 |
|
742 return id; |
|
743 } |
|
744 |
|
745 |
|
746 void CHuiStatic::ReportNewFrame() |
|
747 { |
|
748 TTlsData* data = Data(); |
|
749 data->iFrameCounter++; |
|
750 data->iCurrentFrameCounter++; |
|
751 } |
|
752 |
|
753 |
|
754 EXPORT_C TUint CHuiStatic::FrameCount() |
|
755 { |
|
756 TTlsData* data = Data(); |
|
757 return data->iFrameCounter; |
|
758 } |
|
759 |
|
760 |
|
761 EXPORT_C TReal32 CHuiStatic::AverageFrameRate() __SOFTFP |
|
762 { |
|
763 return 0; |
|
764 } |
|
765 |
|
766 |
|
767 EXPORT_C TReal32 CHuiStatic::FrameRate() __SOFTFP |
|
768 { |
|
769 |
|
770 TTlsData* data = Data(); |
|
771 |
|
772 TTime now; |
|
773 now.UniversalTime(); |
|
774 |
|
775 // If very little time has passed, don't calculate a new value yet. |
|
776 TTimeIntervalMicroSeconds msFromLast = 0; |
|
777 msFromLast = now.MicroSecondsFrom(data->iLastFpsTime); |
|
778 if(msFromLast < TTimeIntervalMicroSeconds(TInt64(1e6))) |
|
779 { |
|
780 // Do not recalculate yet. |
|
781 #ifdef SYMBIAN_BUILD_GCE |
|
782 return 0; // to ignore the value if time is not elapsed |
|
783 #else |
|
784 return data->iLastFps; |
|
785 #endif |
|
786 } |
|
787 |
|
788 if(data->iCurrentFrameCounter == 0) |
|
789 { |
|
790 data->iLastFpsTime = now; |
|
791 return 0; |
|
792 } |
|
793 |
|
794 TInt64 delta = now.MicroSecondsFrom(data->iLastFpsTime).Int64(); |
|
795 |
|
796 TReal32 fps = 0; |
|
797 #ifdef EKA2 |
|
798 TReal32 elapsed = delta / 1.0e6; |
|
799 #else |
|
800 TReal32 elapsed = delta.GetTReal() / 1.0e6; |
|
801 #endif |
|
802 |
|
803 if(elapsed > 0) |
|
804 { |
|
805 fps = (TReal32)data->iCurrentFrameCounter / elapsed; |
|
806 } |
|
807 |
|
808 data->iLastFps = fps; |
|
809 data->iCurrentFrameCounter = 0; |
|
810 data->iLastFpsTime = now; |
|
811 |
|
812 return fps; |
|
813 } |
|
814 |
|
815 |
|
816 EXPORT_C void CHuiStatic::Printf(TRefByValue<const TDesC8> aFormat, ...) |
|
817 { |
|
818 TTlsData* data = Data(); |
|
819 // Bail out early if logging is disabled. |
|
820 if(!data || !data->iLogEnabled) |
|
821 { |
|
822 #ifdef _DEBUG |
|
823 // redirect to RDebug output if we are debugging |
|
824 TUint total = 0; |
|
825 TUint free = HuiUtil::FreeMemory(&total); |
|
826 TBuf8<256> buf; |
|
827 VA_LIST list; |
|
828 VA_START(list, aFormat); |
|
829 buf.FormatList(aFormat, list); |
|
830 VA_END(list); |
|
831 RDebug::Print(_L("(%i/%i KB) %s"), free/1024, total/1024, &buf); |
|
832 #endif |
|
833 // Already gone? |
|
834 return; |
|
835 } |
|
836 TTime now; |
|
837 now.UniversalTime(); |
|
838 TInt32 elapsed = (TInt32)(now.MicroSecondsFrom(data->iFirstUpdateTime).Int64() / 1000); |
|
839 |
|
840 TBuf8<100> memData; |
|
841 TUint total = 0; |
|
842 TUint free = HuiUtil::FreeMemory(&total); |
|
843 memData.Format(_L8("% 2d,%03d (%i/%i KB) "), elapsed / 1000, |
|
844 elapsed % 1000, |
|
845 free/1024, total/1024); |
|
846 |
|
847 TBuf8<512> buf; |
|
848 VA_LIST list; |
|
849 VA_START(list, aFormat); |
|
850 buf.FormatList(aFormat, list); |
|
851 VA_END(list); |
|
852 buf.Insert(0, memData); |
|
853 buf.Append(_L8("\n")); |
|
854 |
|
855 data->iLogFile.Write(buf); |
|
856 data->iLogFile.Flush(); |
|
857 } |
|
858 |
|
859 |
|
860 EXPORT_C void CHuiStatic::Printf(TRefByValue<const TDesC16> aFormat, ...) |
|
861 { |
|
862 TTlsData* data = Data(); |
|
863 // Bail out early if logging is disabled. |
|
864 if(!data || !data->iLogEnabled) |
|
865 { |
|
866 #ifdef _DEBUG |
|
867 // redirect to RDebug output if we are debugging |
|
868 TBuf16<512> buf; |
|
869 TUint total; TUint free = HuiUtil::FreeMemory(&total); |
|
870 VA_LIST list; |
|
871 VA_START(list, aFormat); |
|
872 buf.FormatList(aFormat, list); |
|
873 VA_END(list); |
|
874 RDebug::Print(_L("(%i/%i KB) %S"), free/1024, total/1024, &buf); |
|
875 #endif |
|
876 // Already gone? |
|
877 return; |
|
878 } |
|
879 TTime now; |
|
880 now.UniversalTime(); |
|
881 TInt32 elapsed = (TInt32)(now.MicroSecondsFrom(data->iFirstUpdateTime).Int64() / 1000); |
|
882 |
|
883 TBuf16<100> memData; |
|
884 TUint total = 0; |
|
885 TUint free = HuiUtil::FreeMemory(&total); |
|
886 memData.Format(_L16("% 2d,%03d (%i/%i KB) "), elapsed / 1000, |
|
887 elapsed % 1000, |
|
888 free/1024, total/1024); |
|
889 |
|
890 TBuf16<512> buf; |
|
891 VA_LIST list; |
|
892 VA_START(list, aFormat); |
|
893 buf.FormatList(aFormat, list); |
|
894 VA_END(list); |
|
895 buf.Insert(0, memData); |
|
896 buf.Append(_L16("\n")); |
|
897 |
|
898 TBuf8<512> buf8; |
|
899 buf8.SetLength(buf.Length()); |
|
900 for(TInt i = 0; i < buf.Length(); ++i) |
|
901 { |
|
902 buf8[i] = TUint8(buf[i]); |
|
903 } |
|
904 |
|
905 data->iLogFile.Write(buf8); |
|
906 data->iLogFile.Flush(); |
|
907 } |
|
908 |
|
909 |
|
910 EXPORT_C void CHuiStatic::Tic(TInt aClock) |
|
911 { |
|
912 if(aClock < 0 || aClock >= KMaxClocks) |
|
913 { |
|
914 THuiPanic::Panic(THuiPanic::EStaticInvalidClock); |
|
915 } |
|
916 |
|
917 TTlsData* data = Data(); |
|
918 data->iClocks[aClock].UniversalTime(); |
|
919 } |
|
920 |
|
921 |
|
922 EXPORT_C TReal32 CHuiStatic::Toc(TInt aClock) __SOFTFP |
|
923 { |
|
924 if(aClock < 0 || aClock >= KMaxClocks) |
|
925 { |
|
926 THuiPanic::Panic(THuiPanic::EStaticInvalidClock); |
|
927 } |
|
928 |
|
929 TTlsData* data = Data(); |
|
930 |
|
931 TTime now; |
|
932 now.UniversalTime(); |
|
933 |
|
934 TInt64 delta = now.MicroSecondsFrom(data->iClocks[aClock]).Int64(); |
|
935 #ifdef EKA2 |
|
936 return delta / 1.0e6; |
|
937 #else |
|
938 return delta.GetTReal() / 1.0e6; |
|
939 #endif |
|
940 } |
|
941 |
|
942 |
|
943 EXPORT_C RFs& CHuiStatic::FsSession() |
|
944 { |
|
945 TTlsData* data = Data(); |
|
946 __ASSERT_ALWAYS(data, User::Panic(_L("HUI"),0)); |
|
947 return *data->iFs; |
|
948 } |
|
949 |
|
950 EXPORT_C RWsSession& CHuiStatic::WsSession() |
|
951 { |
|
952 TTlsData* data = Data(); |
|
953 __ASSERT_ALWAYS(data, User::Panic(_L("HUI"),0)); |
|
954 return *data->iWsSession; |
|
955 } |
|
956 |
|
957 EXPORT_C CWsScreenDevice* CHuiStatic::ScreenDevice( TInt aScreenNumber ) |
|
958 { |
|
959 TTlsData* data = Data(); |
|
960 __ASSERT_ALWAYS(data, User::Panic(_L("HUI"),0)); |
|
961 return data->WsScreenDevice(aScreenNumber); |
|
962 } |
|
963 |
|
964 EXPORT_C RWindowGroup* CHuiStatic::RootWin( TInt aScreenNumber ) |
|
965 { |
|
966 TTlsData* data = Data(); |
|
967 __ASSERT_ALWAYS(data, User::Panic(_L("HUI"),0)); |
|
968 return data->RootWin(aScreenNumber); |
|
969 } |
|
970 |
|
971 EXPORT_C void CHuiStatic::SetLayoutTransitionTime( TInt aTime ) |
|
972 { |
|
973 TTlsData* data = Data(); |
|
974 if(data) |
|
975 { |
|
976 data->iLayoutTransitionTime = aTime; |
|
977 } |
|
978 } |
|
979 |
|
980 |
|
981 EXPORT_C TInt CHuiStatic::LayoutTransitionTime() |
|
982 { |
|
983 TTlsData* data = Data(); |
|
984 if(data) |
|
985 { |
|
986 return data->iLayoutTransitionTime; |
|
987 } |
|
988 return 0; |
|
989 } |
|
990 |
|
991 EXPORT_C void CHuiStatic::SetProbe(MHuiProbe* aProbe) |
|
992 { |
|
993 TTlsData* data = Data(); |
|
994 if(data) |
|
995 { |
|
996 data->iProbe = aProbe; |
|
997 } |
|
998 } |
|
999 |
|
1000 MHuiProbe& CHuiStatic::Probe() |
|
1001 { |
|
1002 TTlsData* data = Data(); |
|
1003 |
|
1004 if ( !data ) |
|
1005 { |
|
1006 THuiPanic::Panic(THuiPanic::EStaticDataNotCreated); |
|
1007 } |
|
1008 |
|
1009 if(data->iProbe) |
|
1010 { |
|
1011 return *(data->iProbe); |
|
1012 } |
|
1013 return *(data->iFakeProbe); |
|
1014 } |
|
1015 |
|
1016 EXPORT_C MAknsSkinInstance* CHuiStatic::SkinInstance() |
|
1017 { |
|
1018 if (CCoeEnv::Static()) |
|
1019 { |
|
1020 return AknsUtils::SkinInstance(); |
|
1021 } |
|
1022 return 0; |
|
1023 } |
|
1024 |
|
1025 TBool CHuiStatic::LayoutMirrored() |
|
1026 { |
|
1027 if (CCoeEnv::Static()) |
|
1028 { |
|
1029 return AknLayoutUtils::LayoutMirrored(); |
|
1030 } |
|
1031 else |
|
1032 { |
|
1033 TTlsData* data = Data(); |
|
1034 return data->iAppFwProxy->LayoutMirrored(); |
|
1035 } |
|
1036 } |
|
1037 |
|
1038 TInt CHuiStatic::CbaLocation() |
|
1039 { |
|
1040 if (CCoeEnv::Static()) |
|
1041 { |
|
1042 return AknLayoutUtils::CbaLocation(); |
|
1043 } |
|
1044 else |
|
1045 { |
|
1046 TTlsData* data = Data(); |
|
1047 return data->iAppFwProxy->SoftKeyOrientation(); |
|
1048 } |
|
1049 } |
|
1050 |
|
1051 void CHuiStatic::LayoutMetricsRect(TInt aType, TRect& aRect) |
|
1052 { |
|
1053 if (CCoeEnv::Static()) |
|
1054 { |
|
1055 (void)AknLayoutUtils::LayoutMetricsRect((AknLayoutUtils::TAknLayoutMetrics)aType, aRect); |
|
1056 } |
|
1057 else |
|
1058 { |
|
1059 TTlsData* data = Data(); |
|
1060 aRect = data->iAppFwProxy->LayoutMetricsRect(aType); |
|
1061 } |
|
1062 } |
|
1063 |
|
1064 TInt CHuiStatic::GetCachedColor(TRgb& aRgb, const TAknsItemID& aID, |
|
1065 const TInt aIndex ) |
|
1066 { |
|
1067 MAknsSkinInstance* skin = SkinInstance(); |
|
1068 if (skin) |
|
1069 { |
|
1070 return AknsUtils::GetCachedColor(skin, aRgb, aID, aIndex ); |
|
1071 } |
|
1072 else |
|
1073 { |
|
1074 TTlsData* data = Data(); |
|
1075 return data->iAppFwProxy->GetCachedColor(aRgb, aID, aIndex ); |
|
1076 } |
|
1077 } |
|
1078 |
|
1079 TBool CHuiStatic::ConvertToVisualAndClipL( |
|
1080 TDes& aLogicalText, |
|
1081 const CFont& aFont, |
|
1082 TInt aMaxWidthInPixels, |
|
1083 TInt aMaxClippedWidthInPixels ) |
|
1084 { |
|
1085 if (CCoeEnv::Static()) |
|
1086 { |
|
1087 return AknBidiTextUtils::ConvertToVisualAndClipL( |
|
1088 aLogicalText, |
|
1089 aFont, |
|
1090 aMaxWidthInPixels, |
|
1091 aMaxClippedWidthInPixels ); |
|
1092 } |
|
1093 else |
|
1094 { |
|
1095 if ( !aLogicalText.Length() ) |
|
1096 { |
|
1097 aLogicalText = KNullDesC; // null text |
|
1098 return EFalse; |
|
1099 } |
|
1100 |
|
1101 HBufC* visualBuffer = HBufC::NewLC( |
|
1102 aLogicalText.Length() + KAknBidiExtraSpacePerLine ); |
|
1103 |
|
1104 TPtr ptr = visualBuffer->Des(); |
|
1105 |
|
1106 TInt chars = aLogicalText.Length(); |
|
1107 |
|
1108 TBool clipped = EFalse; |
|
1109 |
|
1110 TChar clipChar = 0xffff; |
|
1111 |
|
1112 // TextCount() converts text to visual form and then checks it |
|
1113 if ( aFont.TextCount( aLogicalText, aMaxWidthInPixels ) < chars ) |
|
1114 { |
|
1115 clipped = ETrue; |
|
1116 |
|
1117 TInt clipCharWidth = 0; |
|
1118 // Not enough space even for clip char alone - return empty descriptor. |
|
1119 if ( aMaxClippedWidthInPixels < clipCharWidth ) |
|
1120 { |
|
1121 aLogicalText = KNullDesC; // null text |
|
1122 CleanupStack::PopAndDestroy(); // visual buf |
|
1123 return ETrue; |
|
1124 } |
|
1125 |
|
1126 // Check how many characters fit in given space with truncation char. |
|
1127 // We need to give this information to TBidiLogicalToVisual. |
|
1128 chars = aFont.TextCount( |
|
1129 aLogicalText, aMaxClippedWidthInPixels - clipCharWidth ); |
|
1130 |
|
1131 // This is "avkon rule": should not insert ellipsis right after a space. |
|
1132 if ( chars > 1 && |
|
1133 aLogicalText[chars - 1] == ' ' && |
|
1134 aLogicalText[chars - 2] != ' ' ) |
|
1135 { |
|
1136 chars--; |
|
1137 } |
|
1138 } |
|
1139 |
|
1140 TBidirectionalState::TRunInfo* array = |
|
1141 new TBidirectionalState::TRunInfo[chars]; |
|
1142 |
|
1143 TBidiLogicalToVisual converter( |
|
1144 aLogicalText, |
|
1145 array, |
|
1146 chars ) ; |
|
1147 |
|
1148 TInt count = converter.Reorder(); |
|
1149 |
|
1150 if (count > chars) |
|
1151 { |
|
1152 delete array; |
|
1153 array = 0; |
|
1154 array = new TBidirectionalState::TRunInfo[chars]; |
|
1155 } |
|
1156 |
|
1157 if (array) |
|
1158 { |
|
1159 TBidiLogicalToVisual converter = TBidiLogicalToVisual( aLogicalText, array, chars ); |
|
1160 converter.Reorder(); |
|
1161 TPtr ptr = visualBuffer->Des(); |
|
1162 converter.GetVisualLine( ptr, 0, chars, clipChar ); |
|
1163 } |
|
1164 |
|
1165 aLogicalText = *visualBuffer; |
|
1166 |
|
1167 CleanupStack::PopAndDestroy(); |
|
1168 return clipped; |
|
1169 } |
|
1170 } |
|
1171 |
|
1172 HBufC* CHuiStatic::ConvertToVisualAndWrapToArrayL( |
|
1173 const TDesC& aLogicalText, |
|
1174 TInt aLineWidth, |
|
1175 const CFont& aFont, |
|
1176 CArrayFix<TPtrC>& aWrappedArray ) |
|
1177 { |
|
1178 if (CCoeEnv::Static()) |
|
1179 { |
|
1180 return AknBidiTextUtils::ConvertToVisualAndWrapToArrayL( |
|
1181 aLogicalText, |
|
1182 aLineWidth, |
|
1183 aFont, |
|
1184 aWrappedArray); |
|
1185 } |
|
1186 else |
|
1187 { |
|
1188 // will not be supported ever |
|
1189 HBufC* ret = aLogicalText.AllocLC(); |
|
1190 aWrappedArray.AppendL(ret->Des()); |
|
1191 CleanupStack::Pop(); |
|
1192 return ret; |
|
1193 } |
|
1194 } |
|
1195 |
|
1196 CFbsBitmap* CHuiStatic::GetBgBitmapLC(const TAknsItemID& aID) |
|
1197 { |
|
1198 CFbsBitmap * bitmap = new (ELeave) CFbsBitmap(); |
|
1199 CleanupStack::PushL(bitmap); |
|
1200 |
|
1201 TTlsData* data = Data(); |
|
1202 data->iAppFwProxy->GetSkinBackgroundBitmapL(bitmap, aID); |
|
1203 |
|
1204 return bitmap; |
|
1205 } |
|
1206 |
|
1207 void CHuiStatic::GetMaskedBitmapL(const TAknsItemID& aID, CFbsBitmap*& aBitmap, CFbsBitmap*& aBitmapMask, |
|
1208 const TDesC& aFileName, TInt aBitmapId, TInt aMaskId, const TSize& aSize, TScaleMode aScaleMode) |
|
1209 { |
|
1210 CFbsBitmap * bitmap = new (ELeave) CFbsBitmap(); |
|
1211 CleanupStack::PushL(bitmap); |
|
1212 |
|
1213 CFbsBitmap * mask = new (ELeave) CFbsBitmap(); |
|
1214 CleanupStack::PushL(mask); |
|
1215 |
|
1216 TTlsData* data = Data(); |
|
1217 data->iAppFwProxy->GetSkinBitmapL(bitmap, mask, aID, aFileName, aBitmapId, aMaskId, aSize, aScaleMode ); |
|
1218 |
|
1219 // Transfer the ownership |
|
1220 if (mask->Handle()) |
|
1221 { |
|
1222 aBitmapMask = mask; |
|
1223 CleanupStack::Pop(); //mask |
|
1224 } |
|
1225 else |
|
1226 { |
|
1227 CleanupStack::PopAndDestroy(); //mask |
|
1228 } |
|
1229 aBitmap = bitmap; |
|
1230 CleanupStack::Pop(); //bitmap |
|
1231 } |
|
1232 |
|
1233 CAknsItemData* CHuiStatic::GetCachedSkinItemDataL(const TAknsItemID& aID, TInt aDataType) |
|
1234 { |
|
1235 CAknsImageTableItemData* skindata = 0; |
|
1236 if (aDataType == EAknsITImageTable) // only image table for framebrush supported |
|
1237 { |
|
1238 TTlsData* data = Data(); |
|
1239 TAlfCachedSkinItemArray array; |
|
1240 data->iAppFwProxy->GetCachedSkinItemDataArrayL(aID, aDataType, array); |
|
1241 if (array.iCount) |
|
1242 { |
|
1243 skindata = CAknsImageTableItemData::NewL(); |
|
1244 CleanupStack::PushL(skindata); |
|
1245 skindata->SetImagesL(array.iCount, array.iImages); |
|
1246 CleanupStack::Pop(); |
|
1247 } |
|
1248 } |
|
1249 return skindata; |
|
1250 } |
|
1251 |
|
1252 TInt CHuiStatic::SettingChangedCallBack(TAny* aInstance) |
|
1253 { |
|
1254 return ((CHuiStatic *)aInstance)->DoChange(); |
|
1255 } |
|
1256 |
|
1257 TInt CHuiStatic::DoChange() |
|
1258 { |
|
1259 TInt change = iChangeNotifier->Change(); |
|
1260 TTlsData* data = Data(); |
|
1261 if(!data) |
|
1262 { |
|
1263 // Time has not begun yet. |
|
1264 return 0; |
|
1265 } |
|
1266 if (change & EChangesLocale) |
|
1267 { |
|
1268 data->iIsFirstUpdateTime = ETrue; |
|
1269 UpdateTime(); |
|
1270 } |
|
1271 |
|
1272 if (change & EChangesSystemTime) |
|
1273 { |
|
1274 data->iIsFirstUpdateTime = ETrue; |
|
1275 UpdateTime(); |
|
1276 } |
|
1277 |
|
1278 return 1; |
|
1279 } |