328 |
324 |
329 AknLayoutUtils::LayoutControl( |
325 AknLayoutUtils::LayoutControl( |
330 iBatteryStrengthControl, parent, batteryStrenghtLayout ); |
326 iBatteryStrengthControl, parent, batteryStrenghtLayout ); |
331 |
327 |
332 AknsUtils::RegisterControlPosition( this ); |
328 AknsUtils::RegisterControlPosition( this ); |
333 |
|
334 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
335 if ( feedback ) |
|
336 { |
|
337 if ( AknStatuspaneUtils::ExtendedFlatLayoutActive() ) |
|
338 { |
|
339 // Disable tactile feedback in extended flat layout because |
|
340 // the battery pane isn't adjacent to the universal indicator |
|
341 // and small digital clock pane. |
|
342 feedback->EnableFeedbackForControl( this, EFalse ); |
|
343 } |
|
344 else |
|
345 { |
|
346 feedback->EnableFeedbackForControl( this, ETrue ); |
|
347 } |
|
348 } |
|
349 } |
329 } |
350 |
330 |
351 |
331 |
352 // --------------------------------------------------------------------------- |
332 // --------------------------------------------------------------------------- |
353 // CAknBatteryPane::SizeChanged |
333 // CAknBatteryPane::SizeChanged |
363 // --------------------------------------------------------------------------- |
343 // --------------------------------------------------------------------------- |
364 // CAknBatteryPane::Draw |
344 // CAknBatteryPane::Draw |
365 // Draws the battery pane. |
345 // Draws the battery pane. |
366 // --------------------------------------------------------------------------- |
346 // --------------------------------------------------------------------------- |
367 // |
347 // |
368 EXPORT_C void CAknBatteryPane::Draw( const TRect& aRect ) const |
348 EXPORT_C void CAknBatteryPane::Draw( const TRect& /*aRect*/ ) const |
369 { |
349 { |
370 if ( iStatusPane && |
350 if ( iIsActiveIdle ) |
371 iStatusPane->IsTransparent() ) |
351 { |
372 { |
|
373 CWindowGc& gc = SystemGc(); |
|
374 TRgb rgb(TRgb::Color16MA(0)); |
|
375 gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); |
|
376 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
377 gc.SetBrushColor(rgb); |
|
378 gc.Clear(aRect); |
|
379 return; |
352 return; |
380 } |
353 } |
381 |
354 |
382 |
355 if ( AknStatuspaneUtils::StaconPaneActive() ) |
383 // Don't allow normal background drawing if |
356 { |
384 // background is already drawn with a background drawer. |
357 DrawInStaconPane( Rect() ); |
385 const MCoeControlBackground* backgroundDrawer = FindBackground(); |
358 } |
386 if ( !backgroundDrawer ) |
359 else if ( AknStatuspaneUtils::FlatLayoutActive() ) |
387 { |
360 { |
388 if ( AknStatuspaneUtils::StaconPaneActive() ) |
361 DrawInFlatStatusPane( Rect() ); |
389 { |
362 } |
390 DrawInStaconPane( Rect() ); |
363 else |
391 } |
364 { |
392 else if ( AknStatuspaneUtils::FlatLayoutActive() ) |
365 DrawInNormalStatusPane( Rect() ); |
393 { |
|
394 DrawInFlatStatusPane( Rect() ); |
|
395 } |
|
396 else |
|
397 { |
|
398 DrawInNormalStatusPane( Rect() ); |
|
399 } |
|
400 } |
366 } |
401 } |
367 } |
402 |
368 |
403 |
369 |
404 // --------------------------------------------------------------------------- |
370 // --------------------------------------------------------------------------- |
539 } |
505 } |
540 |
506 |
541 |
507 |
542 // --------------------------------------------------------------------------- |
508 // --------------------------------------------------------------------------- |
543 // CAknBatteryPane::HandlePointerEventL |
509 // CAknBatteryPane::HandlePointerEventL |
544 // Processes battery pane's pointer events. |
510 // Processes battery pane's pointer events. Actually this does nothing yet. |
545 // --------------------------------------------------------------------------- |
511 // --------------------------------------------------------------------------- |
546 // |
512 // |
547 void CAknBatteryPane::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
513 void CAknBatteryPane::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
548 { |
514 { |
549 if ( IsDimmed() ) |
515 if ( AknLayoutUtils::PenEnabled() ) |
550 { |
516 { |
551 iPrivateFlags &= (~EAknBatteryPaneButton1DownInBatteryRect); |
517 if ( IsDimmed() ) |
552 return; |
|
553 } |
|
554 |
|
555 CEikStatusPaneBase* sp = CEikStatusPaneBase::Current(); |
|
556 if ( sp ) |
|
557 { |
|
558 TInt statusPaneCurrentLayoutResourceId = sp->CurrentLayoutResId(); |
|
559 if ( statusPaneCurrentLayoutResourceId == |
|
560 R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE || |
|
561 statusPaneCurrentLayoutResourceId == |
|
562 R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE_MIRRORED ) |
|
563 { |
518 { |
564 AknsUtils::DeregisterControlPosition( this ); |
519 iPrivateFlags &= (~EAknBatteryPaneButton1DownInBatteryRect); |
565 return; |
520 return; |
566 } |
521 } |
567 } |
522 |
568 // Get the rect of battery pane. |
523 // Get the rect of battery pane. |
569 TRect rect( Rect() ); |
524 TRect rect( Rect() ); |
570 |
525 |
571 // Switch by type |
526 // Switch by type |
572 switch ( aPointerEvent.iType ) |
527 switch ( aPointerEvent.iType ) |
573 { |
|
574 case TPointerEvent::EButton1Down: |
|
575 { |
528 { |
576 // if battery pane's rect contains pointer down position |
529 case TPointerEvent::EButton1Down: |
577 if ( rect.Contains( aPointerEvent.iPosition ) ) |
|
578 { |
530 { |
579 // set flag that pointerdown was inside battery pane |
531 // if battery pane's rect contains pointer down position |
580 iPrivateFlags |= EAknBatteryPaneButton1DownInBatteryRect; |
532 if ( rect.Contains( aPointerEvent.iPosition ) ) |
581 if ( !AknStatuspaneUtils::ExtendedFlatLayoutActive() ) |
|
582 { |
533 { |
583 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
534 // set flag that pointerdown was inside battery pane |
584 if ( feedback ) |
535 iPrivateFlags |= EAknBatteryPaneButton1DownInBatteryRect; |
585 { |
|
586 feedback->InstantFeedback( ETouchFeedbackSensitiveButton ); |
|
587 } |
|
588 } |
536 } |
589 } |
537 } |
|
538 break; |
|
539 |
|
540 case TPointerEvent::EButton1Up: |
|
541 { |
|
542 // if battery pane's rect contains pointer down position and |
|
543 // Button1Down was clicked inside battery rect |
|
544 if ( iPrivateFlags&EAknBatteryPaneButton1DownInBatteryRect && |
|
545 rect.Contains( aPointerEvent.iPosition ) ) |
|
546 { |
|
547 // Up happened inside battery pane's rect |
|
548 // activate something |
|
549 } |
|
550 |
|
551 // Up happened, reset button down flag |
|
552 iPrivateFlags &= (~EAknBatteryPaneButton1DownInBatteryRect); |
|
553 } |
|
554 break; |
|
555 |
|
556 default: |
|
557 break; |
590 } |
558 } |
591 break; |
|
592 |
|
593 case TPointerEvent::EButton1Up: |
|
594 { |
|
595 if ( !AknStatuspaneUtils::ExtendedFlatLayoutActive() ) |
|
596 { |
|
597 // Currently the small digital clock pane, universal |
|
598 // indicator pane and battery pane (in status pane layouts |
|
599 // where it's adjacent to universal indicator or digital |
|
600 // clock pane) are regarded as one touch responsive |
|
601 // area from which the universal indicator popup should |
|
602 // open on tap, so upon pointer up event it must be checked |
|
603 // here if the down event happened inside this control, |
|
604 // but the up event inside digital clock or indicator |
|
605 // pane area. |
|
606 |
|
607 TBool pointerUpInIndicatorArea( EFalse ); |
|
608 TBool pointerUpInClockArea( EFalse ); |
|
609 |
|
610 if ( sp ) |
|
611 { |
|
612 CCoeControl* clockPane = sp->ContainerControlL( |
|
613 TUid::Uid( EEikStatusPaneUidDigitalClock ) ); |
|
614 if ( clockPane ) |
|
615 { |
|
616 TRect clockRect( |
|
617 clockPane->PositionRelativeToScreen(), |
|
618 clockPane->Size() ); |
|
619 pointerUpInClockArea = |
|
620 clockRect.Contains( aPointerEvent.iParentPosition ); |
|
621 } |
|
622 |
|
623 CCoeControl* indicatorPane = sp->ContainerControlL( |
|
624 TUid::Uid( EEikStatusPaneUidIndic ) ); |
|
625 if ( indicatorPane ) |
|
626 { |
|
627 TRect indicatorRect( |
|
628 indicatorPane->PositionRelativeToScreen(), |
|
629 indicatorPane->Size() ); |
|
630 pointerUpInIndicatorArea = |
|
631 indicatorRect.Contains( aPointerEvent.iParentPosition ); |
|
632 } |
|
633 } |
|
634 |
|
635 if ( ( iPrivateFlags & EAknBatteryPaneButton1DownInBatteryRect && |
|
636 rect.Contains( aPointerEvent.iPosition ) ) || |
|
637 pointerUpInClockArea || |
|
638 pointerUpInIndicatorArea ) |
|
639 { |
|
640 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
641 if ( feedback ) |
|
642 { |
|
643 feedback->InstantFeedback( |
|
644 this, |
|
645 ETouchFeedbackSensitiveButton, |
|
646 ETouchFeedbackVibra, |
|
647 aPointerEvent ); |
|
648 } |
|
649 |
|
650 CAknSmallIndicator* indicatorNotifier = |
|
651 CAknSmallIndicator::NewLC( TUid::Uid( 0 ) ); |
|
652 indicatorNotifier->HandleIndicatorTapL(); |
|
653 //for indicator popup event |
|
654 if ( feedback ) |
|
655 { |
|
656 feedback->InstantFeedback( |
|
657 this, |
|
658 ETouchFeedbackPopUp, |
|
659 ETouchFeedbackVibra, |
|
660 aPointerEvent ); |
|
661 } |
|
662 CleanupStack::PopAndDestroy( indicatorNotifier ); |
|
663 } |
|
664 } |
|
665 |
|
666 // Up happened, reset button down flag |
|
667 iPrivateFlags &= (~EAknBatteryPaneButton1DownInBatteryRect); |
|
668 } |
|
669 break; |
|
670 |
|
671 default: |
|
672 break; |
|
673 } |
559 } |
674 } |
560 } |
675 |
561 |
676 |
562 |
677 // --------------------------------------------------------------------------- |
563 // --------------------------------------------------------------------------- |