100 CAknMessageQueryControl::~CAknMessageQueryControl() |
100 CAknMessageQueryControl::~CAknMessageQueryControl() |
101 { |
101 { |
102 AKNTASHOOK_REMOVE(); |
102 AKNTASHOOK_REMOVE(); |
103 AknsUtils::DeregisterControlPosition( iEdwin ); |
103 AknsUtils::DeregisterControlPosition( iEdwin ); |
104 delete iEdwin; |
104 delete iEdwin; |
|
105 if ( !AknLayoutUtils::PenEnabled() ) |
|
106 { |
|
107 delete iSBFrame; |
|
108 } |
105 iLinkTextLocationArray.Close(); |
109 iLinkTextLocationArray.Close(); |
106 iLinkTextArray.Close(); |
110 iLinkTextArray.Close(); |
107 delete iFullMessage; |
111 delete iFullMessage; |
108 delete iExtension; |
112 delete iExtension; |
109 } |
113 } |
110 |
114 |
111 EXPORT_C void CAknMessageQueryControl::ConstructFromResourceL( TResourceReader& aReader ) |
115 EXPORT_C void CAknMessageQueryControl::ConstructFromResourceL( TResourceReader& aReader ) |
112 { |
116 { |
113 CEikDialog* dlg; |
117 if( CAknEnv::Static()->TransparencyEnabled() ) |
114 MopGetObject( dlg ); |
118 { |
115 |
119 CEikDialog* dlg; |
116 if ( dlg ) |
120 MopGetObject( dlg ); |
117 { |
121 if ( dlg ) |
118 dlg->Extension()->iPublicFlags.Set( CEikDialogExtension::EClipChildControlRect ); |
122 { |
|
123 dlg->Extension()->iPublicFlags.Set( CEikDialogExtension::EClipChildControlRect ); |
|
124 } |
119 } |
125 } |
120 |
126 |
121 TPtrC messageLabel = aReader.ReadTPtrC(); |
127 TPtrC messageLabel = aReader.ReadTPtrC(); |
122 SetMessageTextL( &messageLabel ); |
128 SetMessageTextL( &messageLabel ); |
123 } |
129 } |
417 CCoeControl::ActivateL(); |
426 CCoeControl::ActivateL(); |
418 UpdateScrollIndicatorL(); |
427 UpdateScrollIndicatorL(); |
419 } |
428 } |
420 |
429 |
421 void CAknMessageQueryControl::UpdateScrollIndicatorL() |
430 void CAknMessageQueryControl::UpdateScrollIndicatorL() |
422 { |
431 { |
423 if ( iNumberOfLines <= iLinesPerPage ) |
432 if ( iNumberOfLines <= iLinesPerPage ) |
424 { |
433 { |
425 return; |
434 return; |
426 } |
435 } |
427 |
|
428 if ( !iSBFrame ) |
436 if ( !iSBFrame ) |
429 { |
437 { |
430 // edwin will make scrollbar and also observe it |
438 if ( AknLayoutUtils::PenEnabled()) |
431 iSBFrame = iEdwin->CreateScrollBarFrameL(); |
439 { |
|
440 // Edwin will make scrollbar and also observe it |
|
441 iSBFrame= iEdwin->CreateScrollBarFrameL(); |
|
442 } |
|
443 else |
|
444 { |
|
445 iSBFrame=new( ELeave ) CEikScrollBarFrame( this, NULL, ETrue ); |
|
446 } |
432 |
447 |
433 // Check which type of scrollbar is to be shown |
448 // Check which type of scrollbar is to be shown |
434 iSBFrame->CreateDoubleSpanScrollBarsL(EFalse, EFalse, ETrue, EFalse ); |
449 CAknAppUiBase* appUi = iAvkonAppUi; |
435 iSBFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EDoubleSpan ); |
450 if ( AknLayoutUtils::DefaultScrollBarType( appUi ) == CEikScrollBarFrame::EDoubleSpan ) |
436 iSBFrame->DrawBackground( EFalse, EFalse ); |
451 { |
437 iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
452 iSBFrame->CreateDoubleSpanScrollBarsL(EFalse, EFalse, ETrue, EFalse ); // non-window owning scrollbar |
438 CEikScrollBarFrame::EAuto ); |
453 iSBFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EDoubleSpan ); |
439 } |
454 if( CAknEnv::Static()->TransparencyEnabled() ) |
440 |
455 { |
441 iEdwin->UpdateScrollBarsL(); |
456 iSBFrame->DrawBackground( EFalse, EFalse ); |
|
457 } |
|
458 } |
|
459 else |
|
460 { |
|
461 // For EArrowHead type scrollbar |
|
462 iSBFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EArrowHead ); |
|
463 } |
|
464 iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto ); |
|
465 } |
|
466 if ( !iSBFrame ) |
|
467 { |
|
468 return; |
|
469 } |
|
470 |
|
471 if ( !AknLayoutUtils::PenEnabled() ) |
|
472 { |
|
473 TEikScrollBarModel hSbarModel; |
|
474 TEikScrollBarModel vSbarModel; |
|
475 vSbarModel.iThumbPosition = iTopLine; |
|
476 vSbarModel.iScrollSpan = iNumberOfLines; |
|
477 vSbarModel.iThumbSpan = iLinesPerPage; |
|
478 |
|
479 TEikScrollBarFrameLayout layout; |
|
480 TRect rect( Rect() ); |
|
481 |
|
482 if ( iSBFrame->TypeOfVScrollBar() == CEikScrollBarFrame::EDoubleSpan ) |
|
483 { |
|
484 // For EDoubleSpan type scrollbar |
|
485 TAknDoubleSpanScrollBarModel hDsSbarModel( hSbarModel ); |
|
486 TAknDoubleSpanScrollBarModel vDsSbarModel( vSbarModel ); |
|
487 layout.iTilingMode = TEikScrollBarFrameLayout::EInclusiveRectConstant; |
|
488 |
|
489 TAknLayoutRect listScrollPopupInfoPane; |
|
490 listScrollPopupInfoPane.LayoutRect( LayoutRect(), AknLayoutScalable_Avkon::listscroll_popup_info_pane() ); |
|
491 TRect listScrollPopupInfoPaneRect( listScrollPopupInfoPane.Rect() ); |
|
492 CAknPopupHeadingPane* heading = NULL; |
|
493 if( iListQLayout ) |
|
494 { |
|
495 CAknListQueryDialog* dlg; |
|
496 MopGetObject( dlg ); |
|
497 if( dlg ) |
|
498 { |
|
499 heading = dlg->QueryHeading(); |
|
500 } |
|
501 } |
|
502 else |
|
503 { |
|
504 CEikDialog* dlg; |
|
505 MopGetObject( dlg ); |
|
506 if( dlg ) |
|
507 { |
|
508 heading = (CAknPopupHeadingPane*)dlg->ControlOrNull(EAknMessageQueryHeaderId); |
|
509 } |
|
510 } |
|
511 |
|
512 if( heading && heading->PromptText() == KNullDesC ) |
|
513 { |
|
514 TAknLayoutRect headingPaneLayout; |
|
515 headingPaneLayout.LayoutRect( LayoutRect(), AknLayoutScalable_Avkon::heading_pane_cp5() ); |
|
516 listScrollPopupInfoPaneRect.Move( 0, -1 * headingPaneLayout.Rect().Height() ); |
|
517 } |
|
518 AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, listScrollPopupInfoPaneRect, AknLayoutScalable_Avkon::scroll_pane_cp7().LayoutLine() ); |
|
519 |
|
520 TRect inclusiveRect( Rect() ); |
|
521 TRect clientRect( Rect() ); |
|
522 |
|
523 iSBFrame->TileL( &hDsSbarModel,&vDsSbarModel,clientRect,inclusiveRect,layout ); |
|
524 iSBFrame->SetVFocusPosToThumbPos( vDsSbarModel.FocusPosition() ); |
|
525 } |
|
526 else |
|
527 { |
|
528 // For EArrowHead type scrollbar |
|
529 iSBFrame->TileL( &hSbarModel,&vSbarModel,rect,rect,layout ); |
|
530 iSBFrame->SetVFocusPosToThumbPos( vSbarModel.iThumbPosition ); |
|
531 } |
|
532 } |
|
533 else |
|
534 { |
|
535 iEdwin->UpdateScrollBarsL(); |
|
536 } |
442 } |
537 } |
443 |
538 |
444 EXPORT_C void CAknMessageQueryControl::Draw( const TRect& /*aRect*/ ) const |
539 EXPORT_C void CAknMessageQueryControl::Draw( const TRect& /*aRect*/ ) const |
445 { |
540 { |
446 if ( iListQLayout ) |
541 if ( iListQLayout ) |
448 return; |
543 return; |
449 } |
544 } |
450 |
545 |
451 CWindowGc& gc=SystemGc(); |
546 CWindowGc& gc=SystemGc(); |
452 TRect messageQueryControlRect( Rect() ); |
547 TRect messageQueryControlRect( Rect() ); |
453 TRect popupRect(LayoutRect()); |
548 TRect popupRect = TRect(LayoutRect()); |
454 |
549 |
455 TRect backgroundRect(messageQueryControlRect.iTl, popupRect.iBr); |
550 TRect backgroundRect = TRect(messageQueryControlRect.iTl, popupRect.iBr); |
456 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
551 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
457 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
552 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
458 |
553 |
459 TRegionFix<4> clipReg; |
554 if( CAknEnv::Static()->TransparencyEnabled() ) |
460 clipReg.AddRect( backgroundRect ); |
555 { |
461 |
556 TRegionFix<4> clipReg; |
462 if ( iEdwin ) |
557 clipReg.AddRect(backgroundRect); |
463 { |
558 if (iEdwin) |
464 clipReg.SubRect( iEdwin->Rect() ); |
559 { |
465 } |
560 clipReg.SubRect(iEdwin->Rect()); |
466 |
561 } |
467 gc.SetClippingRegion( clipReg ); |
562 gc.SetClippingRegion(clipReg); |
468 AknsDrawUtils::Background( skin, cc, this, gc, backgroundRect, |
563 AknsDrawUtils::Background( skin, cc, this, gc, backgroundRect, KAknsDrawParamNoClearUnderImage ); |
469 KAknsDrawParamNoClearUnderImage ); |
564 gc.CancelClippingRegion(); |
470 gc.CancelClippingRegion(); |
565 } |
|
566 else |
|
567 { |
|
568 AknsDrawUtils::Background( skin, cc, this, gc, backgroundRect ); |
|
569 } |
471 } |
570 } |
472 |
571 |
473 TInt CAknMessageQueryControl::CurrentLink() const |
572 TInt CAknMessageQueryControl::CurrentLink() const |
474 { |
573 { |
475 if( 0 < iCurPos && iCurPos < iPositionsCount - 1 ) // The current position is on a link |
574 if( 0 < iCurPos && iCurPos < iPositionsCount - 1 ) // The current position is on a link |
680 |
779 |
681 |
780 |
682 /** |
781 /** |
683 * CAknMessageQueryControl::HandlePointerEventL() |
782 * CAknMessageQueryControl::HandlePointerEventL() |
684 * |
783 * |
685 * Transfers pointerevent to editor control. |
784 * Transfers pointerevent to editor control and updates it's scroll bar. |
686 * Checks for the object destruction after the pointer event handling. |
785 * Checks for the object destruction after the pointer event handling. |
687 */ |
786 */ |
688 void CAknMessageQueryControl::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
787 void CAknMessageQueryControl::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
689 { |
788 { |
690 TBool highlightBefore = LinkHighLighted(); |
789 TBool highlightBefore = LinkHighLighted(); |
691 /** |
790 /** |
692 * The local @c destroyed variable keeps track of the object destroyed state. |
791 * The local @c destroyed variable keeps track of the object destroyed state. |
693 */ |
792 */ |
694 TBool destroyed = EFalse; |
793 TBool destroyed = EFalse; |
695 |
794 if (AknLayoutUtils::PenEnabled() ) |
696 iExtension->iDestroyedPtr = &destroyed; |
795 { |
697 |
796 iExtension->iDestroyedPtr = &destroyed; |
698 // Call default implementation of HandlePointerEventL to transfer event to correct control. |
797 // Call default implementation of HandlePointerEventL to transfer event to correct control. |
699 CAknControl::HandlePointerEventL( aPointerEvent ); |
798 CAknControl::HandlePointerEventL( aPointerEvent ); |
700 |
799 if ( !destroyed ) |
701 if ( !destroyed ) |
800 { |
702 { |
801 iExtension->iDestroyedPtr = NULL; |
703 iExtension->iDestroyedPtr = NULL; |
802 iEdwin->UpdateScrollBarsL(); |
704 } |
803 } |
705 else |
804 else |
706 { |
805 { |
707 return; |
806 return; |
708 } |
807 } |
709 |
808 } |
710 TBool highlightAfter = LinkHighLighted(); |
809 TBool highlightAfter = LinkHighLighted(); |
711 if( aPointerEvent.iType == TPointerEvent::EButton1Down && |
810 if( aPointerEvent.iType == TPointerEvent::EButton1Down && |
712 highlightBefore == highlightAfter && highlightAfter ) |
811 highlightBefore == highlightAfter && highlightAfter ) |
713 { |
812 { |
714 DehighlightLink(); |
813 DehighlightLink(); |