29 #include "xnuienginepluginif.h" |
29 #include "xnuienginepluginif.h" |
30 #include "xnnodepluginif.h" |
30 #include "xnnodepluginif.h" |
31 #include "xncontroladapter.h" |
31 #include "xncontroladapter.h" |
32 #include "xnclockcontrol.h" |
32 #include "xnclockcontrol.h" |
33 #include "xnclockadapter.h" |
33 #include "xnclockadapter.h" |
|
34 #include "xndatecontrol.h" |
34 #include "c_xnutils.h" |
35 #include "c_xnutils.h" |
35 |
36 |
36 // Constants |
37 // Constants |
37 _LIT8( KDateInformation, "Clock/DateInformation" ); |
38 _LIT8( KDisplay, "display" ); |
38 _LIT8( KDayInformation, "Clock/DayInformation" ); |
39 _LIT8( KNone, "none" ); |
39 |
40 _LIT8( KBlock, "block" ); |
40 _LIT( KDigitalFont, "EAknLogicalFontSecondaryFont" ); |
|
41 _LIT( KAmPmFont, "EAknLogicalFontSecondaryFont" ); |
|
42 _LIT( KDateFont, "EAknLogicalFontSecondaryFont" ); |
|
43 |
41 |
44 // ============================ LOCAL FUNCTIONS =============================== |
42 // ============================ LOCAL FUNCTIONS =============================== |
45 |
43 |
46 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
47 // ClockFormat |
45 // ClockFormat |
133 |
133 |
134 iForeground = iAvkonAppUi->IsForeground(); |
134 iForeground = iAvkonAppUi->IsForeground(); |
135 |
135 |
136 iLightObserver = CHWRMLight::NewL( this ); |
136 iLightObserver = CHWRMLight::NewL( this ); |
137 |
137 |
|
138 TBool useLocale; |
|
139 CXnProperty* prop( |
|
140 iNode.GetPropertyL( XnPropertyNames::clock::KS60Format ) ); |
|
141 TClockFormat format( ClockFormat( prop, useLocale ) ); |
|
142 |
138 RPointerArray< CXnNodePluginIf > children( iNode.ChildrenL() ); |
143 RPointerArray< CXnNodePluginIf > children( iNode.ChildrenL() ); |
139 CleanupClosePushL( children ); |
144 CleanupClosePushL( children ); |
140 |
145 |
141 for( TInt i = 0; i < children.Count(); i++ ) |
146 for ( TInt i = 0; i < children.Count(); i++ ) |
142 { |
147 { |
143 CXnNodePluginIf* child( children[i] ); |
148 CXnNodePluginIf* child( children[i] ); |
144 |
149 const TDesC8& clocktype = child->Type()->Type(); |
145 CXnProperty* id( child->IdL() ); |
150 |
146 |
151 if ( clocktype == XnPropertyNames::clock::format::KDigital ) |
147 if( id ) |
152 { |
148 { |
153 iDigital = child; |
149 if( id->StringValue() == KDateInformation ) |
154 } |
150 { |
155 else if ( clocktype == XnPropertyNames::clock::format::KAnalog ) |
151 iDate = child; |
156 { |
152 } |
157 iAnalog = child; |
153 else if( id->StringValue() == KDayInformation ) |
158 } |
154 { |
159 else if ( clocktype == XnPropertyNames::clock::KDate ) |
155 iDay = child; |
160 { |
156 } |
161 if ( !iDateControl ) |
157 } |
162 { |
|
163 iDateControl = CXnDateControl::NewL( *this, EDate ); |
|
164 } |
|
165 iDate = child; |
|
166 } |
|
167 |
|
168 RPointerArray< CXnNodePluginIf > clockChildren( child->ChildrenL() ); |
|
169 CleanupClosePushL( clockChildren ); |
|
170 for ( TInt j = 0; j < clockChildren.Count(); j++ ) |
|
171 { |
|
172 CXnNodePluginIf* clockChild( clockChildren[j] ); |
|
173 const TDesC8& childType = clockChild->Type()->Type(); |
|
174 |
|
175 if ( childType == XnPropertyNames::clock::KFace12 ) |
|
176 { |
|
177 if ( !iClockControl ) |
|
178 { |
|
179 iClockControl = CXnClockControl::NewL( *this, useLocale, format ); |
|
180 } |
|
181 iDigitalFace12 = clockChild; |
|
182 } |
|
183 else if ( childType == XnPropertyNames::clock::KFace24 ) |
|
184 { |
|
185 if ( !iClockControl ) |
|
186 { |
|
187 iClockControl = CXnClockControl::NewL( *this, useLocale, format ); |
|
188 } |
|
189 iDigitalFace24 = clockChild; |
|
190 } |
|
191 else if ( childType == XnPropertyNames::clock::KFace ) |
|
192 { |
|
193 if ( !iClockControl ) |
|
194 { |
|
195 iClockControl = CXnClockControl::NewL( *this, useLocale, format ); |
|
196 } |
|
197 iAnalogFace = clockChild; |
|
198 } |
|
199 else if ( childType == XnPropertyNames::clock::KDate && |
|
200 clocktype == XnPropertyNames::clock::format::KDigital ) |
|
201 { |
|
202 if ( !iDateControl ) |
|
203 { |
|
204 iDateControl = CXnDateControl::NewL( *this, EDate ); |
|
205 } |
|
206 iDigitalDate = clockChild; |
|
207 } |
|
208 else if ( childType == XnPropertyNames::clock::KDate && |
|
209 clocktype == XnPropertyNames::clock::format::KAnalog ) |
|
210 { |
|
211 if ( !iDateControl ) |
|
212 { |
|
213 iDateControl = CXnDateControl::NewL( *this, EDate ); |
|
214 } |
|
215 iAnalogDate = clockChild; |
|
216 } |
|
217 else if ( childType == XnPropertyNames::clock::KDay ) |
|
218 { |
|
219 if ( !iDayControl ) |
|
220 { |
|
221 iDayControl = CXnDateControl::NewL( *this, EDay ); |
|
222 } |
|
223 iDay = clockChild; |
|
224 } |
|
225 else if ( childType == XnPropertyNames::clock::KAmpm ) |
|
226 { |
|
227 iAmpm = clockChild; |
|
228 } |
|
229 } |
|
230 CleanupStack::PopAndDestroy( &clockChildren ); |
158 } |
231 } |
159 |
232 |
160 CleanupStack::PopAndDestroy( &children ); |
233 CleanupStack::PopAndDestroy( &children ); |
161 |
234 |
162 TBool useLocale; |
235 SetClockFormatL( format ); |
163 |
|
164 CXnProperty* prop( |
|
165 iNode.GetPropertyL( XnPropertyNames::clock::KS60Format ) ); |
|
166 |
|
167 TClockFormat format( ClockFormat( prop, useLocale ) ); |
|
168 |
|
169 iClockControl = CXnClockControl::NewL( this, useLocale, format ); |
|
170 |
236 |
171 iCoeEnv->AddMessageMonitorObserverL( *this ); |
237 iCoeEnv->AddMessageMonitorObserverL( *this ); |
172 } |
238 } |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // CXnClockAdapter::SetDisplayToBlockL |
|
242 // ----------------------------------------------------------------------------- |
|
243 // |
|
244 void CXnClockAdapter::SetDisplayToBlockL( CXnNodePluginIf& aNode, TBool aBlock ) |
|
245 { |
|
246 CXnDomStringPool& sp = aNode.UiEngineL()->StringPool(); |
|
247 CXnProperty* prop; |
|
248 if ( aBlock ) |
|
249 { |
|
250 prop = CXnProperty::NewL( |
|
251 KDisplay, KBlock, CXnDomPropertyValue::EString, sp ); |
|
252 } |
|
253 else |
|
254 { |
|
255 prop = CXnProperty::NewL( |
|
256 KDisplay, KNone, CXnDomPropertyValue::EString, sp ); |
|
257 } |
|
258 CleanupStack::PushL( prop ); |
|
259 aNode.SetPropertyL( prop ); |
|
260 CleanupStack::Pop( prop ); |
|
261 } |
|
262 |
|
263 // ----------------------------------------------------------------------------- |
|
264 // CXnClockAdapter::SetClockFormatL |
|
265 // ----------------------------------------------------------------------------- |
|
266 // |
|
267 void CXnClockAdapter::SetClockFormatL( TClockFormat aFormat ) |
|
268 { |
|
269 if ( iAnalog && iDigital ) |
|
270 { |
|
271 if ( aFormat == EClockAnalog ) |
|
272 { |
|
273 SetDisplayToBlockL( *iAnalog, ETrue ); |
|
274 SetDisplayToBlockL( *iDigital, EFalse ); |
|
275 } |
|
276 else |
|
277 { |
|
278 SetDisplayToBlockL( *iDigital, ETrue ); |
|
279 SetDisplayToBlockL( *iAnalog, EFalse ); |
|
280 // check whether time format is 12 or 24 |
|
281 if ( iDigitalFace12 && iDigitalFace24 ) |
|
282 { |
|
283 if ( TLocale().TimeFormat() == ETime12 ) |
|
284 { |
|
285 SetDisplayToBlockL( *iDigitalFace12, ETrue ); |
|
286 if ( iAmpm ) |
|
287 { |
|
288 SetDisplayToBlockL( *iAmpm, ETrue ); |
|
289 } |
|
290 SetDisplayToBlockL( *iDigitalFace24, EFalse ); |
|
291 } |
|
292 else |
|
293 { |
|
294 SetDisplayToBlockL( *iDigitalFace24, ETrue ); |
|
295 SetDisplayToBlockL( *iDigitalFace12, EFalse ); |
|
296 if ( iAmpm ) |
|
297 { |
|
298 SetDisplayToBlockL( *iAmpm, EFalse ); |
|
299 } |
|
300 } |
|
301 } |
|
302 } |
|
303 iNode.UiEngineL()->LayoutUIL( &iNode ); |
|
304 } |
|
305 } |
173 |
306 |
174 // ----------------------------------------------------------------------------- |
307 // ----------------------------------------------------------------------------- |
175 // CXnClockAdapter::DoHandlePropertyChangeL |
308 // CXnClockAdapter::DoHandlePropertyChangeL |
176 // |
|
177 // ----------------------------------------------------------------------------- |
309 // ----------------------------------------------------------------------------- |
178 // |
310 // |
179 void CXnClockAdapter::DoHandlePropertyChangeL( CXnProperty* aProperty ) |
311 void CXnClockAdapter::DoHandlePropertyChangeL( CXnProperty* aProperty ) |
180 { |
312 { |
181 if( aProperty ) |
313 if( aProperty ) |
182 { |
314 { |
183 const TDesC8& name( aProperty->Property()->Name() ); |
315 const TDesC8& name( aProperty->Property()->Name() ); |
184 |
316 |
185 if( name == XnPropertyNames::clock::KS60Format ) |
317 if( iClockControl && name == XnPropertyNames::clock::KS60Format ) |
186 { |
318 { |
187 TBool useLocale; |
319 TBool useLocale; |
188 |
320 |
189 TClockFormat format( ClockFormat( aProperty, useLocale ) ); |
321 TClockFormat format( ClockFormat( aProperty, useLocale ) ); |
190 |
322 |
191 iClockControl->SetFormatL( useLocale, format ); |
323 iClockControl->SetFormatL( useLocale, format ); |
192 } |
324 } |
193 else if( name == XnPropertyNames::clock::KS60DigitalFontSize ) |
|
194 { |
|
195 iDigitalFont = NULL; |
|
196 } |
|
197 else if( name == XnPropertyNames::clock::KS60AmPmFontSize ) |
|
198 { |
|
199 iAmPmFont = NULL; |
|
200 } |
|
201 else if( name == XnPropertyNames::clock::KS60DateFontSize ) |
|
202 { |
|
203 iDateFont = NULL; |
|
204 } |
|
205 else if( name == XnPropertyNames::appearance::common::KColor ) |
|
206 { |
|
207 iColorSet = EFalse; |
|
208 } |
|
209 } |
325 } |
210 } |
326 } |
211 |
327 |
212 // ----------------------------------------------------------------------------- |
328 // ----------------------------------------------------------------------------- |
213 // CXnClockAdapter::UpdateDisplay |
329 // CXnClockAdapter::UpdateDisplay |
214 // Draws the clock component |
|
215 // ----------------------------------------------------------------------------- |
330 // ----------------------------------------------------------------------------- |
216 // |
331 // |
217 void CXnClockAdapter::UpdateDisplay() const |
332 void CXnClockAdapter::UpdateDisplay() const |
218 { |
333 { |
219 if ( !iNode.Rect().IsEmpty() ) |
334 if ( !iNode.Rect().IsEmpty() ) |
222 } |
337 } |
223 } |
338 } |
224 |
339 |
225 // ----------------------------------------------------------------------------- |
340 // ----------------------------------------------------------------------------- |
226 // CXnClockAdapter::Draw |
341 // CXnClockAdapter::Draw |
227 // Draws the clock component |
|
228 // ----------------------------------------------------------------------------- |
342 // ----------------------------------------------------------------------------- |
229 // |
343 // |
230 void CXnClockAdapter::Draw( const TRect& aRect ) const |
344 void CXnClockAdapter::Draw( const TRect& aRect ) const |
231 { |
345 { |
232 CXnControlAdapter::Draw( aRect ); |
346 CXnControlAdapter::Draw( aRect ); |
233 |
347 |
234 CWindowGc& gc( SystemGc() ); |
348 CWindowGc& gc( SystemGc() ); |
235 |
349 |
236 iClockControl->Draw( gc, iNode.Rect() ); |
350 if ( iClockControl ) |
|
351 { |
|
352 TClockFormat format = iClockControl->Format(); |
|
353 if ( format == EClockAnalog ) |
|
354 { |
|
355 iClockControl->Draw( gc, iAnalogFace, NULL ); |
|
356 } |
|
357 else |
|
358 { |
|
359 if ( TLocale().TimeFormat() == ETime12 ) |
|
360 { |
|
361 iClockControl->Draw( gc, iDigitalFace12, iAmpm ); |
|
362 } |
|
363 else |
|
364 { |
|
365 iClockControl->Draw( gc, iDigitalFace24, NULL ); |
|
366 } |
|
367 } |
|
368 } |
|
369 |
|
370 if ( iDateControl ) |
|
371 { |
|
372 if ( iClockControl && iClockControl->Format() == EClockAnalog && iAnalogDate ) |
|
373 { |
|
374 TRAP_IGNORE( iDateControl->DrawL( gc, iAnalogDate ) ); |
|
375 } |
|
376 else if ( iClockControl && iClockControl->Format() == EClockDigital && iDigitalDate ) |
|
377 { |
|
378 TRAP_IGNORE( iDateControl->DrawL( gc, iDigitalDate ) ); |
|
379 } |
|
380 else |
|
381 { |
|
382 TRAP_IGNORE( iDateControl->DrawL( gc, iDate ) ); |
|
383 } |
|
384 } |
|
385 |
|
386 if ( iDayControl ) |
|
387 { |
|
388 TRAP_IGNORE( iDayControl->DrawL( gc, iDay ) ); |
|
389 } |
237 } |
390 } |
238 |
391 |
239 // ----------------------------------------------------------------------------- |
392 // ----------------------------------------------------------------------------- |
240 // CXnClockAdapter::MakeVisible |
393 // CXnClockAdapter::MakeVisible |
241 // |
|
242 // ----------------------------------------------------------------------------- |
394 // ----------------------------------------------------------------------------- |
243 // |
395 // |
244 void CXnClockAdapter::MakeVisible( TBool aVisible ) |
396 void CXnClockAdapter::MakeVisible( TBool aVisible ) |
245 { |
397 { |
246 TBool visible( IsVisible() ); |
398 TBool visible( IsVisible() ); |
326 StopClock(); |
480 StopClock(); |
327 } |
481 } |
328 } |
482 } |
329 } |
483 } |
330 |
484 |
331 |
485 // ----------------------------------------------------------------------------- |
332 // ----------------------------------------------------------------------------- |
486 // CXnClockAdapter::GetTextAlignL |
333 // CXnClockAdapter::FontL |
487 // ----------------------------------------------------------------------------- |
334 // |
488 // |
|
489 CGraphicsContext::TTextAlign CXnClockAdapter::GetTextAlignL( CXnNodePluginIf& aNode ) |
|
490 { |
|
491 CGraphicsContext::TTextAlign ret = CGraphicsContext::ECenter; |
|
492 CXnProperty* prop( aNode.GetPropertyL( |
|
493 XnPropertyNames::appearance::common::KTextAlign ) ); |
|
494 |
|
495 if( prop ) |
|
496 { |
|
497 if ( prop->StringValue() == |
|
498 XnPropertyNames::appearance::common::textalign::KAlignLeft ) |
|
499 { |
|
500 ret = CGraphicsContext::ELeft; |
|
501 } |
|
502 else if ( prop->StringValue() == |
|
503 XnPropertyNames::appearance::common::textalign::KAlignRight ) |
|
504 { |
|
505 ret = CGraphicsContext::ERight; |
|
506 } |
|
507 else if ( prop->StringValue() == |
|
508 XnPropertyNames::appearance::common::textalign::KAlignCenter ) |
|
509 { |
|
510 ret = CGraphicsContext::ECenter; |
|
511 } |
|
512 } |
|
513 return ret; |
|
514 } |
|
515 |
|
516 // ----------------------------------------------------------------------------- |
|
517 // CXnClockAdapter::CreateFontL |
335 // ----------------------------------------------------------------------------- |
518 // ----------------------------------------------------------------------------- |
336 // |
519 // |
337 const CAknLayoutFont* CXnClockAdapter::FontL( const TInt aType ) |
520 void CXnClockAdapter::CreateFontL( CXnNodePluginIf& aNode, |
338 { |
521 const TDesC& aFontName, |
339 CFont* font( NULL ); |
522 CFont*& aFont ) |
340 |
|
341 if( aType == EDigitalFont ) |
|
342 { |
|
343 if( !iDigitalFont ) |
|
344 { |
|
345 CreateFontL( aType ); |
|
346 } |
|
347 |
|
348 font = iDigitalFont; |
|
349 } |
|
350 else if( aType == EAmPmFont ) |
|
351 { |
|
352 if( !iAmPmFont ) |
|
353 { |
|
354 CreateFontL( aType ); |
|
355 } |
|
356 |
|
357 font = iAmPmFont; |
|
358 } |
|
359 else if( aType == EDateFont ) |
|
360 { |
|
361 if( !iDateFont ) |
|
362 { |
|
363 CreateFontL( aType ); |
|
364 } |
|
365 |
|
366 font = iDateFont; |
|
367 } |
|
368 |
|
369 if( font ) |
|
370 { |
|
371 return CAknLayoutFont::AsCAknLayoutFontOrNull( font ); |
|
372 } |
|
373 |
|
374 return NULL; |
|
375 } |
|
376 |
|
377 // ----------------------------------------------------------------------------- |
|
378 // CXnClockAdapter::TextColorL |
|
379 // |
|
380 // ----------------------------------------------------------------------------- |
|
381 // |
|
382 const TRgb& CXnClockAdapter::TextColorL() |
|
383 { |
|
384 if( !iColorSet ) |
|
385 { |
|
386 CreateColorL(); |
|
387 } |
|
388 |
|
389 return iColor; |
|
390 } |
|
391 |
|
392 // ----------------------------------------------------------------------------- |
|
393 // CXnClockAdapter::Date |
|
394 // |
|
395 // ----------------------------------------------------------------------------- |
|
396 // |
|
397 CXnNodePluginIf* CXnClockAdapter::Date() const |
|
398 { |
|
399 return iDate; |
|
400 } |
|
401 |
|
402 // ----------------------------------------------------------------------------- |
|
403 // CXnClockAdapter::Day |
|
404 // |
|
405 // ----------------------------------------------------------------------------- |
|
406 // |
|
407 CXnNodePluginIf* CXnClockAdapter::Day() const |
|
408 { |
|
409 return iDay; |
|
410 } |
|
411 |
|
412 // ----------------------------------------------------------------------------- |
|
413 // CXnClockAdapter::CreateFontL |
|
414 // |
|
415 // ----------------------------------------------------------------------------- |
|
416 // |
|
417 void CXnClockAdapter::CreateFontL( const TInt aType ) |
|
418 { |
523 { |
419 TFontSpec spec; |
524 TFontSpec spec; |
420 TInt dummy; |
525 TInt dummy; |
421 |
526 |
422 if( aType == EDigitalFont ) |
527 CXnProperty* prop( aNode.GetPropertyL( |
423 { |
528 XnPropertyNames::clock::KS60FontSize ) ); |
424 iDigitalFont = NULL; |
529 |
425 |
530 // default |
426 CXnProperty* prop( iNode.GetPropertyL( |
531 TInt height( ( aNode.Rect().Height() / 5 ) ); |
427 XnPropertyNames::clock::KS60DigitalFontSize ) ); |
532 |
428 |
533 if ( prop ) |
429 // default |
534 { |
430 TInt height( ( iNode.Rect().Height() / 3 ) * 2 ); |
535 height = aNode.UiEngineL()->VerticalPixelValueL( |
431 |
536 prop, aNode.Rect().Height() ); |
|
537 } |
|
538 else |
|
539 { |
|
540 // check if fontsize is defined in clock element |
|
541 prop = iNode.GetPropertyL( |
|
542 XnPropertyNames::clock::KS60FontSize ); |
432 if ( prop ) |
543 if ( prop ) |
433 { |
544 { |
434 height = iNode.UiEngineL()->VerticalPixelValueL( |
545 height = iNode.UiEngineL()->VerticalPixelValueL( |
435 prop, iNode.Rect().Height() ); |
546 prop, iNode.Rect().Height() ); |
436 } |
547 } |
437 |
548 } |
438 // No need to relase avkon font |
549 |
439 CXnUtils::CreateFontL( KDigitalFont, |
550 // No need to relase avkon font |
440 height, |
551 CXnUtils::CreateFontL( aFontName, |
441 spec.iFontStyle, |
552 height, |
442 iDigitalFont, |
553 spec.iFontStyle, |
443 dummy ); |
554 aFont, |
444 } |
555 dummy ); |
445 else if( aType == EAmPmFont ) |
|
446 { |
|
447 iAmPmFont = NULL; |
|
448 |
|
449 CXnProperty* prop( iNode.GetPropertyL( |
|
450 XnPropertyNames::clock::KS60AmPmFontSize ) ); |
|
451 |
|
452 // default |
|
453 TInt height( ( iNode.Rect().Height() / 5 ) ); |
|
454 |
|
455 if ( prop ) |
|
456 { |
|
457 height = iNode.UiEngineL()->VerticalPixelValueL( |
|
458 prop, iNode.Rect().Height() ); |
|
459 } |
|
460 |
|
461 // No need to relase avkon font |
|
462 CXnUtils::CreateFontL( KAmPmFont, |
|
463 height, |
|
464 spec.iFontStyle, |
|
465 iAmPmFont, |
|
466 dummy ); |
|
467 } |
|
468 else if( aType == EDateFont ) |
|
469 { |
|
470 iDateFont = NULL; |
|
471 |
|
472 CXnProperty* prop( iNode.GetPropertyL( |
|
473 XnPropertyNames::clock::KS60DateFontSize ) ); |
|
474 |
|
475 // default |
|
476 TInt height( ( iNode.Rect().Height() / 5 ) ); |
|
477 |
|
478 if ( prop ) |
|
479 { |
|
480 height = iNode.UiEngineL()->VerticalPixelValueL( |
|
481 prop, iNode.Rect().Height() ); |
|
482 } |
|
483 |
|
484 // No need to relase avkon font |
|
485 CXnUtils::CreateFontL( KDateFont, |
|
486 height, |
|
487 spec.iFontStyle, |
|
488 iDateFont, |
|
489 dummy ); |
|
490 } |
|
491 } |
556 } |
492 |
557 |
493 // ----------------------------------------------------------------------------- |
558 // ----------------------------------------------------------------------------- |
494 // CXnClockAdapter::CreateColorL |
559 // CXnClockAdapter::CreateColorL |
495 // |
|
496 // ----------------------------------------------------------------------------- |
560 // ----------------------------------------------------------------------------- |
497 // |
561 // |
498 void CXnClockAdapter::CreateColorL() |
562 void CXnClockAdapter::CreateColorL( CXnNodePluginIf& aNode, TRgb& aColor ) |
499 { |
563 { |
500 TRgb color; |
564 TRgb color; |
501 |
565 |
502 TInt result( KErrNone ); |
566 TInt result( KErrNone ); |
503 |
567 |
504 CXnProperty* prop( iNode.GetPropertyL( |
568 CXnProperty* prop( aNode.GetPropertyL( |
505 XnPropertyNames::appearance::common::KColor ) ); |
569 XnPropertyNames::appearance::common::KColor ) ); |
506 |
570 |
507 if( !prop ) |
571 if( !prop ) |
508 { |
572 { |
509 return; |
573 // check if color is defined in clock element |
|
574 prop = iNode.GetPropertyL( |
|
575 XnPropertyNames::appearance::common::KColor ); |
|
576 if ( !prop ) |
|
577 { |
|
578 return; |
|
579 } |
510 } |
580 } |
511 |
581 |
512 CXnDomProperty* domProp( prop->Property() ); |
582 CXnDomProperty* domProp( prop->Property() ); |
513 |
583 |
514 MAknsSkinInstance* skin( AknsUtils::SkinInstance() ); |
584 MAknsSkinInstance* skin( AknsUtils::SkinInstance() ); |
552 } |
622 } |
553 } |
623 } |
554 |
624 |
555 if( result == KErrNone ) |
625 if( result == KErrNone ) |
556 { |
626 { |
557 iColorSet = ETrue; |
627 aColor = color; |
558 iColor = color; |
|
559 } |
628 } |
560 } |
629 } |
561 |
630 |
562 // ----------------------------------------------------------------------------- |
631 // ----------------------------------------------------------------------------- |
563 // CXnClockAdapter::SkinChanged |
632 // CXnClockAdapter::SkinChanged |
564 // Skin change notification |
|
565 // ----------------------------------------------------------------------------- |
633 // ----------------------------------------------------------------------------- |
566 // |
634 // |
567 void CXnClockAdapter::SkinChanged() |
635 void CXnClockAdapter::SkinChanged() |
568 { |
636 { |
569 iAmPmFont = iDigitalFont = iDateFont = NULL; |
637 if ( iClockControl ) |
570 iColorSet = EFalse; |
638 { |
|
639 iClockControl->ResetFont(); |
|
640 } |
|
641 if ( iDateControl ) |
|
642 { |
|
643 iDateControl->ResetFont(); |
|
644 } |
|
645 if ( iDayControl ) |
|
646 { |
|
647 iDayControl->ResetFont(); |
|
648 } |
571 |
649 |
572 CXnControlAdapter::SkinChanged(); |
650 CXnControlAdapter::SkinChanged(); |
573 } |
651 } |
574 |
652 |
575 // ----------------------------------------------------------------------------- |
653 // ----------------------------------------------------------------------------- |
576 // CXnClockAdapter::HandleScreenDeviceChangedL |
654 // CXnClockAdapter::HandleScreenDeviceChangedL |
577 // Screen device change notification |
|
578 // ----------------------------------------------------------------------------- |
655 // ----------------------------------------------------------------------------- |
579 // |
656 // |
580 void CXnClockAdapter::HandleScreenDeviceChangedL() |
657 void CXnClockAdapter::HandleScreenDeviceChangedL() |
581 { |
658 { |
582 iAmPmFont = iDigitalFont = iDateFont = NULL; |
659 if ( iClockControl ) |
583 iColorSet = EFalse; |
660 { |
|
661 iClockControl->ResetFont(); |
|
662 } |
|
663 if ( iDateControl ) |
|
664 { |
|
665 iDateControl->ResetFont(); |
|
666 } |
|
667 if ( iDayControl ) |
|
668 { |
|
669 iDayControl->ResetFont(); |
|
670 } |
584 |
671 |
585 CXnControlAdapter::HandleScreenDeviceChangedL(); |
672 CXnControlAdapter::HandleScreenDeviceChangedL(); |
586 } |
673 } |
587 |
674 |
588 // ----------------------------------------------------------------------------- |
675 // ----------------------------------------------------------------------------- |
589 // CXnClockAdapter::SizeChanged |
676 // CXnClockAdapter::SizeChanged |
590 // Size changed notification |
|
591 // ----------------------------------------------------------------------------- |
677 // ----------------------------------------------------------------------------- |
592 // |
678 // |
593 void CXnClockAdapter::SizeChanged() |
679 void CXnClockAdapter::SizeChanged() |
594 { |
680 { |
595 iAmPmFont = iDigitalFont = iDateFont = NULL; |
681 if ( iClockControl ) |
596 iColorSet = EFalse; |
682 { |
|
683 iClockControl->ResetFont(); |
|
684 } |
|
685 if ( iDateControl ) |
|
686 { |
|
687 iDateControl->ResetFont(); |
|
688 } |
|
689 if ( iDayControl ) |
|
690 { |
|
691 iDayControl->ResetFont(); |
|
692 } |
597 |
693 |
598 CXnControlAdapter::SizeChanged(); |
694 CXnControlAdapter::SizeChanged(); |
599 } |
695 } |
600 |
696 |
601 // ----------------------------------------------------------------------------- |
697 // ----------------------------------------------------------------------------- |
602 // CXnClockAdapter::StartClock |
698 // CXnClockAdapter::StartClock |
603 // |
|
604 // ----------------------------------------------------------------------------- |
699 // ----------------------------------------------------------------------------- |
605 // |
700 // |
606 void CXnClockAdapter::StartClock() |
701 void CXnClockAdapter::StartClock() |
607 { |
702 { |
608 if ( iClockControl ) |
703 if ( iClockControl ) |