uifw/AvKon/src/aknmessagequerycontrol.cpp
changeset 14 3320e4e6e8bb
parent 0 2f259fa3e83a
--- a/uifw/AvKon/src/aknmessagequerycontrol.cpp	Tue Feb 02 01:00:49 2010 +0200
+++ b/uifw/AvKon/src/aknmessagequerycontrol.cpp	Fri Apr 16 15:13:44 2010 +0300
@@ -102,6 +102,10 @@
     AKNTASHOOK_REMOVE();
     AknsUtils::DeregisterControlPosition( iEdwin );
     delete iEdwin;
+    if ( !AknLayoutUtils::PenEnabled() )
+        {
+        delete iSBFrame;
+        } 
     iLinkTextLocationArray.Close();
     iLinkTextArray.Close();
     delete iFullMessage;
@@ -110,12 +114,14 @@
 
 EXPORT_C void CAknMessageQueryControl::ConstructFromResourceL( TResourceReader& aReader )
     {
-    CEikDialog* dlg;
-    MopGetObject( dlg );
-
-    if ( dlg )
+    if( CAknEnv::Static()->TransparencyEnabled() )
         {
-        dlg->Extension()->iPublicFlags.Set( CEikDialogExtension::EClipChildControlRect );
+        CEikDialog* dlg;
+        MopGetObject( dlg );
+        if ( dlg )
+            {
+            dlg->Extension()->iPublicFlags.Set( CEikDialogExtension::EClipChildControlRect );
+            }
         }
     
     TPtrC messageLabel = aReader.ReadTPtrC();
@@ -165,7 +171,11 @@
     {
     delete iEdwin;
     iEdwin = NULL;
-    iSBFrame = NULL;
+    if ( !AknLayoutUtils::PenEnabled() )
+        {
+        delete iSBFrame;
+        iSBFrame = NULL;
+        } 
     
     iEdwin = new ( ELeave ) CEikRichTextEditor( TGulBorder::ENone );
     iEdwin->SetContainerWindowL( *this );
@@ -179,7 +189,6 @@
     iEdwin->SetAvkonWrap( ETrue );                                  
     iEdwin->SetFocus( EFalse );
     iEdwin->SetNonFocusing();
-    iEdwin->EnableKineticScrollingL(ETrue);
     }    
     
 void CAknMessageQueryControl::LayoutEditorL()
@@ -419,26 +428,112 @@
     }
 
 void CAknMessageQueryControl::UpdateScrollIndicatorL()
-    {
+    {   
     if ( iNumberOfLines <= iLinesPerPage )
         {
         return;
         }
-    
     if ( !iSBFrame )
         {
-        // edwin will make scrollbar and also observe it
-        iSBFrame = iEdwin->CreateScrollBarFrameL();
+        if ( AknLayoutUtils::PenEnabled())
+            {   
+            // Edwin will make scrollbar and also observe it
+            iSBFrame= iEdwin->CreateScrollBarFrameL();
+            }
+        else
+            {
+            iSBFrame=new( ELeave ) CEikScrollBarFrame( this, NULL, ETrue );
+            }           
 
         // Check which type of scrollbar is to be shown
-        iSBFrame->CreateDoubleSpanScrollBarsL(EFalse, EFalse, ETrue, EFalse );
-        iSBFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EDoubleSpan );
-        iSBFrame->DrawBackground( EFalse, EFalse );
-        iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
-                CEikScrollBarFrame::EAuto );
+        CAknAppUiBase* appUi = iAvkonAppUi;
+        if ( AknLayoutUtils::DefaultScrollBarType( appUi ) == CEikScrollBarFrame::EDoubleSpan )
+            {
+            iSBFrame->CreateDoubleSpanScrollBarsL(EFalse, EFalse, ETrue, EFalse ); // non-window owning scrollbar
+            iSBFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EDoubleSpan );
+            if( CAknEnv::Static()->TransparencyEnabled() )
+                {
+                iSBFrame->DrawBackground( EFalse, EFalse );
+                }
+            }
+        else
+            {
+            // For EArrowHead type scrollbar
+            iSBFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EArrowHead );
+            }
+        iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto );
+        }
+    if ( !iSBFrame )
+        {
+        return;
         }
-    
-    iEdwin->UpdateScrollBarsL();    
+        
+    if ( !AknLayoutUtils::PenEnabled() )
+        {
+        TEikScrollBarModel hSbarModel;
+        TEikScrollBarModel vSbarModel;
+        vSbarModel.iThumbPosition = iTopLine;
+        vSbarModel.iScrollSpan = iNumberOfLines;
+        vSbarModel.iThumbSpan = iLinesPerPage;
+        
+        TEikScrollBarFrameLayout layout;
+        TRect rect( Rect() );
+        
+        if ( iSBFrame->TypeOfVScrollBar() == CEikScrollBarFrame::EDoubleSpan )
+            {
+            // For EDoubleSpan type scrollbar
+            TAknDoubleSpanScrollBarModel hDsSbarModel( hSbarModel );
+            TAknDoubleSpanScrollBarModel vDsSbarModel( vSbarModel );
+            layout.iTilingMode = TEikScrollBarFrameLayout::EInclusiveRectConstant;
+                 
+            TAknLayoutRect listScrollPopupInfoPane;
+            listScrollPopupInfoPane.LayoutRect( LayoutRect(), AknLayoutScalable_Avkon::listscroll_popup_info_pane() );
+            TRect listScrollPopupInfoPaneRect( listScrollPopupInfoPane.Rect() );
+            CAknPopupHeadingPane* heading = NULL;
+            if( iListQLayout )
+            	{
+            	CAknListQueryDialog* dlg;
+            	MopGetObject( dlg );
+            	if( dlg )
+            		{
+            		heading = dlg->QueryHeading();
+            		}            	
+            	}
+            else
+            	{
+            	CEikDialog* dlg;
+                MopGetObject( dlg );
+                if( dlg )
+                	{
+                	heading = (CAknPopupHeadingPane*)dlg->ControlOrNull(EAknMessageQueryHeaderId); 
+                	}                
+            	}
+            
+            if( heading && heading->PromptText() == KNullDesC )
+                {
+                TAknLayoutRect headingPaneLayout;
+                headingPaneLayout.LayoutRect( LayoutRect(), AknLayoutScalable_Avkon::heading_pane_cp5() );
+                listScrollPopupInfoPaneRect.Move( 0, -1 * headingPaneLayout.Rect().Height() );
+                }
+            AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, listScrollPopupInfoPaneRect, AknLayoutScalable_Avkon::scroll_pane_cp7().LayoutLine() );
+        
+            TRect inclusiveRect( Rect() );
+            TRect clientRect( Rect() );
+            
+            iSBFrame->TileL( &hDsSbarModel,&vDsSbarModel,clientRect,inclusiveRect,layout );        
+            iSBFrame->SetVFocusPosToThumbPos( vDsSbarModel.FocusPosition() );
+            }
+        else
+            {
+            // For EArrowHead type scrollbar
+            iSBFrame->TileL( &hSbarModel,&vSbarModel,rect,rect,layout );        
+            iSBFrame->SetVFocusPosToThumbPos( vSbarModel.iThumbPosition );
+            }
+        }
+    else
+        {
+        iEdwin->UpdateScrollBarsL();    
+        }
     }
 
 EXPORT_C void CAknMessageQueryControl::Draw( const TRect& /*aRect*/ ) const
@@ -450,24 +545,28 @@
 
     CWindowGc& gc=SystemGc(); 
     TRect messageQueryControlRect( Rect() );
-    TRect popupRect(LayoutRect());
+    TRect popupRect = TRect(LayoutRect());
 
-    TRect backgroundRect(messageQueryControlRect.iTl, popupRect.iBr);    
+    TRect backgroundRect = TRect(messageQueryControlRect.iTl, popupRect.iBr);    
     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
 
-    TRegionFix<4> clipReg;
-    clipReg.AddRect( backgroundRect );
-    
-    if ( iEdwin )
+    if( CAknEnv::Static()->TransparencyEnabled() )
         {
-        clipReg.SubRect( iEdwin->Rect() );
+        TRegionFix<4> clipReg;
+        clipReg.AddRect(backgroundRect);
+        if (iEdwin)
+            {
+            clipReg.SubRect(iEdwin->Rect());
+            }
+        gc.SetClippingRegion(clipReg);
+        AknsDrawUtils::Background( skin, cc, this, gc, backgroundRect, KAknsDrawParamNoClearUnderImage );
+        gc.CancelClippingRegion();
         }
-    
-    gc.SetClippingRegion( clipReg );
-    AknsDrawUtils::Background( skin, cc, this, gc, backgroundRect, 
-            KAknsDrawParamNoClearUnderImage );
-    gc.CancelClippingRegion();
+    else
+        {
+        AknsDrawUtils::Background( skin, cc, this, gc, backgroundRect );
+        }
     }
 
 TInt CAknMessageQueryControl::CurrentLink() const
@@ -682,7 +781,7 @@
 /**
  * CAknMessageQueryControl::HandlePointerEventL()
  *
- * Transfers pointerevent to editor control.
+ * Transfers pointerevent to editor control and updates it's scroll bar. 
  * Checks for the object destruction after the pointer event handling.
  */
 void CAknMessageQueryControl::HandlePointerEventL( const TPointerEvent& aPointerEvent )
@@ -692,21 +791,21 @@
     * The local @c destroyed variable keeps track of the object destroyed state.
     */
     TBool destroyed = EFalse;
-    
-    iExtension->iDestroyedPtr = &destroyed;
-
-    // Call default implementation of HandlePointerEventL to transfer event to correct control.
-    CAknControl::HandlePointerEventL( aPointerEvent );
-
-    if ( !destroyed )
+    if (AknLayoutUtils::PenEnabled() )
         {
-        iExtension->iDestroyedPtr = NULL;
+        iExtension->iDestroyedPtr = &destroyed;
+        // Call default implementation of HandlePointerEventL to transfer event to correct control.
+        CAknControl::HandlePointerEventL( aPointerEvent );
+        if ( !destroyed )
+            {
+            iExtension->iDestroyedPtr = NULL;
+            iEdwin->UpdateScrollBarsL();
+            }
+        else
+            {
+            return;
+            }
         }
-    else
-        {
-        return;
-        }
-    
     TBool highlightAfter = LinkHighLighted();
     if( aPointerEvent.iType == TPointerEvent::EButton1Down && 
         highlightBefore == highlightAfter && highlightAfter )