uifw/EikStd/dlgsrc/EIKCAPC.CPP
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
     1 /*
     1 /*
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    78 #include <avkon.mbg>
    78 #include <avkon.mbg>
    79 // For MAknMfneCommandObserver
    79 // For MAknMfneCommandObserver
    80 #include <aknmfnecommandobserver.h>
    80 #include <aknmfnecommandobserver.h>
    81 #endif //if defined( RD_SCALABLE_UI_V2)
    81 #endif //if defined( RD_SCALABLE_UI_V2)
    82 
    82 
    83 
    83 #include "akntrace.h"
    84 
    84 
    85 GLREF_C void Panic(TEikDialogPanic aPanic);
    85 GLREF_C void Panic(TEikDialogPanic aPanic);
    86 
    86 
    87 const TInt KViewHighlightColor = 244 ;
    87 const TInt KViewHighlightColor = 244 ;
    88 // const TInt KViewHighlightShadowColor = 222 ; 
       
    89 // const TInt KNormalBackgroundColor = 0 ;
       
    90 
       
    91 
       
    92 // Do not reference these directly... Use MaximumNumberOfControlLinesOnVisiblePage() 
       
    93 // const TInt KMaxControlLinesOnPageSingleLineFormat =6;
       
    94 // const TInt KMaxControlLinesOnPageDoubleLineFormat =5;
       
    95 
    88 
    96 enum
    89 enum
    97     {// must carry on from TSpaceSharingFlags
    90     {// must carry on from TSpaceSharingFlags
    98     EUsesEars       =0x10,
    91     EUsesEars       =0x10,
    99     ELeftEarDown    =0x20,
    92     ELeftEarDown    =0x20,
   109     EOfferAllHotKeys=0x8000,
   102     EOfferAllHotKeys=0x8000,
   110     ETrailerAfterEar=0x10000,
   103     ETrailerAfterEar=0x10000,
   111     ENoBorder       = 0x20000
   104     ENoBorder       = 0x20000
   112     };
   105     };
   113 
   106 
   114 const TInt KDynamicEarMask=(ELeftEarDown|ERightEarDown|ELeftEarGrab|ERightEarGrab);
       
   115 
       
   116 const TInt KCapCDefaultHorzEdgeSpacing=0;
       
   117 const TInt KCapCDefaultVertEdgeSpacing=0; 
       
   118 const TInt KCapCCenterSpacing=0;
   107 const TInt KCapCCenterSpacing=0;
   119 const TInt KControlTrailerSpacing=0;
   108 const TInt KControlTrailerSpacing=0;
   120 // const TInt KCapCEarHeightTopHalf=0;
       
   121 // const TInt KCapCEarHeightBottomHalf=0;
       
   122 // const TInt KCapCEarHeight=KCapCEarHeightTopHalf+KCapCEarHeightBottomHalf;
       
   123 const TInt KCapCEarWidth=0;
   109 const TInt KCapCEarWidth=0;
   124 const TInt KCapCEarSpacing=0;
   110 const TInt KCapCEarSpacing=0;
   125 const TInt KCapCVertCaptionOffset=0;
   111 const TInt KCapCVertCaptionOffset=0;
   126 const TInt KCapCExtraAscent=KCapCVertCaptionOffset+0;
   112 const TInt KCapCExtraAscent=KCapCVertCaptionOffset+0;
   127 const TInt KTrailCVertCaptionOffset=0;
   113 const TInt KTrailCVertCaptionOffset=0;
   128 const TInt KCapCSeparatorAfterSpace=0;
   114 const TInt KCapCSeparatorAfterSpace=0;
   129 
       
   130 const TInt KCapCInitialEarRepeat=600000;    // 6 tenths of a second
       
   131 const TInt KCapCEarRepeat=100000; // one tenth of a second
       
   132 
   115 
   133 /*
   116 /*
   134  *  The following set of static functions return value which have been hard coded from the Series 60 Skins LAF v2.0
   117  *  The following set of static functions return value which have been hard coded from the Series 60 Skins LAF v2.0
   135  *  If a layout DLL becomes available the hard-coded values may be replaced with equivalent Macros.
   118  *  If a layout DLL becomes available the hard-coded values may be replaced with equivalent Macros.
   136  *  NOTE THAT THERE ARE COPIES OF SOME OF THESE FUNCTIONS IN EIKDPAGE.CPP
   119  *  NOTE THAT THERE ARE COPIES OF SOME OF THESE FUNCTIONS IN EIKDPAGE.CPP
   281 /**
   264 /**
   282 * 
   265 * 
   283 * Extension class for additional data members.
   266 * Extension class for additional data members.
   284 *
   267 *
   285 */
   268 */
   286 NONSHARABLE_CLASS( CEikCapCExtension ): public MEikFormAnimObserver
   269 NONSHARABLE_CLASS( CEikCapCExtension ) : public CBase,
       
   270                                          public MEikFormAnimObserver
   287     {
   271     {
   288     friend class CEikCaptionedControl ;
   272     friend class CEikCaptionedControl ;
   289 
   273 
   290 private:
   274 private:
   291     CEikCapCExtension();
   275     CEikCapCExtension();
   347     MTouchFeedback* iFeedback;
   331     MTouchFeedback* iFeedback;
   348 
   332 
   349 public: // needs to be public because idle callback uses these members.
   333 public: // needs to be public because idle callback uses these members.
   350 	CIdle *iIdle;
   334 	CIdle *iIdle;
   351 	CIdleCallbackData *iIdleData;
   335 	CIdleCallbackData *iIdleData;
   352     /** iPartiallyVisible is used as a protection from changing subcontrol positions of 
   336 
   353       * partially-visible controls in PositionFormComponents(). This is needed only for
       
   354       * dynamic screen size change.
       
   355       */
       
   356     TBool iPartiallyVisible;
       
   357     
       
   358     /**
   337     /**
   359      * Boolean used to check if application is single touch compatible.
   338      * Boolean used to check if application is single touch compatible.
   360      */
   339      */
   361     TBool iUsesSingleClick;
   340     TBool iUsesSingleClick;
   362 
   341 
   377     iSelf( NULL ), 
   356     iSelf( NULL ), 
   378     iEditModeHighlightControlContext ( NULL ) ,
   357     iEditModeHighlightControlContext ( NULL ) ,
   379     iViewModeHighlightControlContext ( NULL ) ,
   358     iViewModeHighlightControlContext ( NULL ) ,
   380     iEditModeHighlightControlContextPressed( NULL ),
   359     iEditModeHighlightControlContextPressed( NULL ),
   381     iViewModeHighlightControlContextPressed( NULL ),
   360     iViewModeHighlightControlContextPressed( NULL ),
   382     iPreviousRect( TPoint(0, 0), TSize(0, 0) ) ,
   361     iPreviousRect( 0, 0, 0, 0 ),
   383     iPreviousState( EFalse ) ,
   362     iPreviousState( EFalse ) ,
   384     iPressDownEffect( EFalse ),
   363     iPressDownEffect( EFalse ),
   385     iXOffsetForDataPaneInEditMode( ELayoutEmpty ) ,
   364     iXOffsetForDataPaneInEditMode( ELayoutEmpty ) ,
   386     iYOffsetForDataPaneInEditMode( ELayoutEmpty ) ,
   365     iYOffsetForDataPaneInEditMode( ELayoutEmpty ) ,
   387     iDrawNoWhiteBackground( EFalse ),
   366     iDrawNoWhiteBackground( EFalse ),
   388     iAnimation( NULL )
   367     iAnimation( NULL )
   389 	, iIndicator(NULL),
   368 	, iIndicator(NULL),
   390 	iIndicator2(NULL),
   369 	iIndicator2(NULL),
   391 	iObserver(NULL),
   370 	iObserver(NULL),
       
   371 	iSimulatedDownEvent( EFalse ),
   392     iFeedback( MTouchFeedback::Instance() ),
   372     iFeedback( MTouchFeedback::Instance() ),
   393 	iIdle(NULL),
   373 	iIdle(NULL),
   394 	iIdleData(NULL),
   374 	iIdleData(NULL)
   395     iPartiallyVisible( EFalse )
   375     {
   396     {
   376     _AKNTRACE_FUNC_ENTER;
   397     if ( iAvkonAppUi )
   377     if ( iAvkonAppUi )
   398         {
   378         {
   399         iUsesSingleClick = iAvkonAppUi->IsSingleClickCompatible();
   379         iUsesSingleClick = iAvkonAppUi->IsSingleClickCompatible();
   400         }
   380         }
   401     };
   381     _AKNTRACE_FUNC_EXIT;
       
   382     }
   402 
   383 
   403 CEikCapCExtension::~CEikCapCExtension()
   384 CEikCapCExtension::~CEikCapCExtension()
   404     {
   385     {
       
   386     _AKNTRACE_FUNC_ENTER;
   405     // Remember to unacquire animation
   387     // Remember to unacquire animation
   406     if( iAnimation && iSelf )
   388     if( iAnimation && iSelf )
   407         {
   389         {
   408         if( iSelf->iDialogPage )
   390         if( iSelf->iDialogPage )
   409             iSelf->iDialogPage->AcquireAnim( EFalse, this );
   391             iSelf->iDialogPage->AcquireAnim( EFalse, this );
   410         }
   392         }
       
   393     _AKNTRACE_FUNC_EXIT;
   411     }
   394     }
   412 
   395 
   413 TBool CEikCapCExtension::IsHighlightAnimated() const
   396 TBool CEikCapCExtension::IsHighlightAnimated() const
   414     {
   397     {
   415     if( iAnimation )
   398     if( iAnimation )
   422     return EFalse;
   405     return EFalse;
   423     }
   406     }
   424 
   407 
   425 void CEikCapCExtension::SkinChanged()
   408 void CEikCapCExtension::SkinChanged()
   426     {
   409     {
       
   410     _AKNTRACE_FUNC_ENTER;
   427     iAnimation = NULL;
   411     iAnimation = NULL;
   428     if( iSelf->iDialogPage )
   412     if( iSelf->iDialogPage )
   429         iAnimation = iSelf->iDialogPage->AcquireAnim( ETrue, this );
   413         iAnimation = iSelf->iDialogPage->AcquireAnim( ETrue, this );
   430 
   414 
   431     if( iAnimation )
   415     if( iAnimation )
   432         {
   416         {
   433         iAnimation->SetHighlightSize( iSelf->Rect().Size() );
   417         iAnimation->SetHighlightSize( iSelf->Rect().Size() );
   434         }
   418         }
       
   419     _AKNTRACE_FUNC_EXIT;
   435     }
   420     }
   436 
   421 
   437 void CEikCapCExtension::HandleLayoutSwitch( const TSize& aSize )
   422 void CEikCapCExtension::HandleLayoutSwitch( const TSize& aSize )
   438     {
   423     {
       
   424     _AKNTRACE_FUNC_ENTER;
   439     if( iAnimation )
   425     if( iAnimation )
   440         {
   426         {
   441         if( iAnimation->Size() == aSize )
   427         if( iAnimation->Size() == aSize )
   442             {
   428             {
   443             // No need to resize, just change the background used
   429             // No need to resize, just change the background used
   447         else
   433         else
   448             {
   434             {
   449             iAnimation->SetHighlightSize( aSize );
   435             iAnimation->SetHighlightSize( aSize );
   450             }
   436             }
   451         }
   437         }
       
   438     _AKNTRACE_FUNC_EXIT;
   452     }
   439     }
   453 
   440 
   454 void CEikCapCExtension::AnimFrameReady()
   441 void CEikCapCExtension::AnimFrameReady()
   455     {
   442     {
   456     if( iSelf )
   443     if( iSelf )
   466     // drawing, we only grab a piece from the list background bitmap.
   453     // drawing, we only grab a piece from the list background bitmap.
   467     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   454     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   468     MAknsControlContext* cc = AknsDrawUtils::ControlContext( iSelf->iDialogPage );
   455     MAknsControlContext* cc = AknsDrawUtils::ControlContext( iSelf->iDialogPage );
   469 
   456 
   470     return AknsDrawUtils::DrawBackground( skin, cc, iSelf->iDialogPage, aGc, TPoint(0,0),
   457     return AknsDrawUtils::DrawBackground( skin, cc, iSelf->iDialogPage, aGc, TPoint(0,0),
   471                                           iSelf->ViewRect(), KAknsDrawParamRGBOnly );
   458                                           iSelf->Rect(), KAknsDrawParamRGBOnly );
   472     }
   459     }
   473 
   460 
   474 
   461 
   475 void CEikCapCExtension::SimulatePointerEventToControlL(
   462 void CEikCapCExtension::SimulatePointerEventToControlL(
   476         const TPointerEvent& aPointerEvent )
   463         const TPointerEvent& aPointerEvent )
   478     // Extend form item touch area to whole item area
   465     // Extend form item touch area to whole item area
   479     if ( iSelf->iIsEditable
   466     if ( iSelf->iIsEditable
   480          && ( aPointerEvent.iType == TPointerEvent::EButton1Down 
   467          && ( aPointerEvent.iType == TPointerEvent::EButton1Down 
   481             || aPointerEvent.iType == TPointerEvent::EButton1Up ) )
   468             || aPointerEvent.iType == TPointerEvent::EButton1Up ) )
   482         {
   469         {
   483 
       
   484         // Check control type
   470         // Check control type
   485         TBool edwinControl( LaunchInputType() );
   471         TBool edwinControl( LaunchInputType() );
   486         TBool simulate = EFalse;
   472         TBool simulate = EFalse;
   487         if ( aPointerEvent.iType == TPointerEvent::EButton1Down
   473 
   488                 && iSelf->Rect().Contains( aPointerEvent.iPosition )
   474         if ( iSelf->Rect().Contains( aPointerEvent.iPosition ) )
   489                 && !iSelf->iControl->Rect().Contains(
   475             {
   490                         aPointerEvent.iPosition ) )
   476             if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
   491             {
   477                  !iSelf->iControl->Rect().Contains( aPointerEvent.iPosition ) )
   492             iSimulatedDownEvent = ETrue;
   478                 {
   493             if ( !edwinControl )
   479                 iSimulatedDownEvent = ETrue;
   494                 {
       
   495                 simulate = ETrue;
   480                 simulate = ETrue;
   496                 }
   481                 }
   497             }
   482             else if ( aPointerEvent.iType == TPointerEvent::EButton1Up &&
   498         else if ( aPointerEvent.iType == TPointerEvent::EButton1Up
   483                       iSimulatedDownEvent )
   499                 && iSimulatedDownEvent )
   484                 {
   500             {
   485                 simulate = ETrue;
   501             simulate = ETrue;
   486                 }
   502             }
   487             }
   503 
   488 
   504         // Simulate pointer event to control
   489         // Simulate pointer event to control
   505         if ( simulate && !edwinControl )
   490         if ( simulate && !edwinControl )
   506             {
   491             {
   509                 iSelf->iControl->Rect().iTl + TPoint( 1, 1 );
   494                 iSelf->iControl->Rect().iTl + TPoint( 1, 1 );
   510             iSelf->iControl->HandlePointerEventL( controlEvent );
   495             iSelf->iControl->HandlePointerEventL( controlEvent );
   511             }
   496             }
   512 
   497 
   513         // With edwin do action directly (due to cursor problems)
   498         // With edwin do action directly (due to cursor problems)
   514         else if ( edwinControl && simulate
   499         else if ( edwinControl &&
   515                 && aPointerEvent.iType == TPointerEvent::EButton1Up )
   500                   simulate &&
   516             {
   501                   ( aPointerEvent.iType == TPointerEvent::EButton1Up ||
   517             CAknExtendedInputCapabilities* input( NULL );
   502                     aPointerEvent.iType == TPointerEvent::EButton1Down ) )
   518             iSelf->iControl->InputCapabilities().ObjectProvider(
   503             {
   519                     )->MopGetObjectNoChaining( input );
   504             // Basic list feedback is given instead of sensitive edit
   520             if ( input )
   505             // feedback when tapping editor fields in forms.
   521                 {
   506             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
   522                 iFeedback->InstantFeedback(
   507                 {
   523                         iSelf->iControl, ETouchFeedbackEditor,
   508                 iFeedback->InstantFeedback( iSelf->iControl,
   524                         ETouchFeedbackVibra, aPointerEvent );
   509                                             ETouchFeedbackList );
   525                 input->ReportEventL(
   510                 }
       
   511             else
       
   512                 {
       
   513                 iFeedback->InstantFeedback( iSelf->iControl,
       
   514                                             ETouchFeedbackList,
       
   515                                             ETouchFeedbackVibra,
       
   516                                             aPointerEvent );
       
   517                 
       
   518                 CAknExtendedInputCapabilities* input( NULL );
       
   519                 iSelf->iControl->InputCapabilities().ObjectProvider(
       
   520                         )->MopGetObjectNoChaining( input );
       
   521                 
       
   522                 if ( input )
       
   523                     {
       
   524                     input->ReportEventL(
   526                         CAknExtendedInputCapabilities::\
   525                         CAknExtendedInputCapabilities::\
   527                         MAknEventObserver::EActivatePenInputRequest,
   526                             MAknEventObserver::EActivatePenInputRequest,
   528                         NULL );
   527                         NULL );
   529                 }
   528                     }
   530             }
   529                 }
       
   530             }
       
   531 
   531         if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   532         if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   532             {
   533             {
   533             iSimulatedDownEvent = EFalse;
   534             iSimulatedDownEvent = EFalse;
   534             }
   535             }
   535         }
   536         }
   587 * This draws the form highlight line
   588 * This draws the form highlight line
   588 *
   589 *
   589 */
   590 */
   590 void CEikCaptionedControlFormHighlightLine::Draw(const TRect& /*aRect*/) const
   591 void CEikCaptionedControlFormHighlightLine::Draw(const TRect& /*aRect*/) const
   591     {
   592     {
       
   593     _AKNTRACE_FUNC_ENTER;
   592     CWindowGc& gc=SystemGc();
   594     CWindowGc& gc=SystemGc();
   593     TBool drawn = EFalse;
   595     TBool drawn = EFalse;
   594 
   596 
   595     if ( IsVisible() && DrawingSkins() )
   597     if ( IsVisible() && DrawingSkins() )
   596         {
   598         {
   656                 gc.SetPenColor( line3Rect.Color() ) ; // black line;
   658                 gc.SetPenColor( line3Rect.Color() ) ; // black line;
   657                 gc.DrawRect(rectToDraw);
   659                 gc.DrawRect(rectToDraw);
   658                 }
   660                 }
   659             }
   661             }
   660         }
   662         }
       
   663     _AKNTRACE_FUNC_EXIT;
   661     };
   664     };
   662 
   665 
   663 
   666 
   664 TInt CEikCaptionedControlFormHighlightLine::HeightOfHighlight(TTopOrBottom aTopOrBottom) const
   667 TInt CEikCaptionedControlFormHighlightLine::HeightOfHighlight(TTopOrBottom aTopOrBottom) const
   665     {
   668     {
   696       }
   699       }
   697 
   700 
   698 
   701 
   699 TBool CEikCaptionedControlFormHighlightLine::DrawingSkins() const
   702 TBool CEikCaptionedControlFormHighlightLine::DrawingSkins() const
   700     {
   703     {
       
   704     _AKNTRACE_FUNC_ENTER;
   701     TBool drawingSkins = EFalse;
   705     TBool drawingSkins = EFalse;
   702     if ( AknsUtils::AvkonSkinEnabled() )
   706     if ( AknsUtils::AvkonSkinEnabled() )
   703         {
   707         {
   704         MAknsSkinInstance* skin = AknsUtils::SkinInstance() ;
   708         MAknsSkinInstance* skin = AknsUtils::SkinInstance() ;
   705         MAknsControlContext* cc = AknsDrawUtils::ControlContext( &iCapCtl ) ;
   709         MAknsControlContext* cc = AknsDrawUtils::ControlContext( &iCapCtl ) ;
   706         CWindowGc& gc = SystemGc();
   710         CWindowGc& gc = SystemGc();
   707         drawingSkins = AknsDrawUtils::Background( skin, cc, this, gc, Rect(), KAknsDrawParamPrepareOnly ); 
   711         drawingSkins = AknsDrawUtils::Background( skin, cc, this, gc, Rect(), KAknsDrawParamPrepareOnly ); 
   708         }
   712         }
       
   713     _AKNTRACE_FUNC_EXIT;
   709     return drawingSkins;
   714     return drawingSkins;
   710     }
   715     }
   711 
   716 
   712 EXPORT_C CEikCaptionedControl::CEikCaptionedControl() : iHasAppendedEditIndicator(EFalse)
   717 EXPORT_C CEikCaptionedControl::CEikCaptionedControl()
   713     {
   718     {
       
   719     _AKNTRACE_FUNC_ENTER;
   714     iNumberOfLines = 1 ;  // default starting value
   720     iNumberOfLines = 1 ;  // default starting value
   715     AKNTASHOOK_ADD( this, "CEikCaptionedControl" );
   721     AKNTASHOOK_ADD( this, "CEikCaptionedControl" );
       
   722     _AKNTRACE_FUNC_EXIT;
   716     }
   723     }
   717 
   724 
   718 EXPORT_C CEikCaptionedControl::~CEikCaptionedControl()
   725 EXPORT_C CEikCaptionedControl::~CEikCaptionedControl()
   719     {
   726     {
       
   727     _AKNTRACE_FUNC_ENTER;
   720     AKNTASHOOK_REMOVE();
   728     AKNTASHOOK_REMOVE();
   721     AknsUtils::DeregisterControlPosition(this);
   729     AknsUtils::DeregisterControlPosition(this);
   722     AknsUtils::DeregisterControlPosition(iBitmap);
   730     AknsUtils::DeregisterControlPosition(iBitmap);
   723     AknsUtils::DeregisterControlPosition(iCaption);
   731     AknsUtils::DeregisterControlPosition(iCaption);
   724     AknsUtils::DeregisterControlPosition(iControl);
   732     AknsUtils::DeregisterControlPosition(iControl);
   732         iControl->SetFocus( EFalse);
   740         iControl->SetFocus( EFalse);
   733     delete iControl;
   741     delete iControl;
   734     delete iCaptionText;
   742     delete iCaptionText;
   735     delete iCaption;
   743     delete iCaption;
   736     delete iTrailer;
   744     delete iTrailer;
   737     delete iToolTipText ;
       
   738     delete iBitmap ;
   745     delete iBitmap ;
   739     delete iHighlightControl ;
   746     delete iHighlightControl ;
   740     if ( iExtension )
   747     if ( iExtension )
   741         {
   748         {
   742 		delete iExtension->iIdle;
   749 		delete iExtension->iIdle;
   747         delete iExtension->iViewModeHighlightControlContextPressed;
   754         delete iExtension->iViewModeHighlightControlContextPressed;
   748 	    delete iExtension->iIndicator;
   755 	    delete iExtension->iIndicator;
   749   		delete iExtension->iIndicator2;
   756   		delete iExtension->iIndicator2;
   750         }
   757         }
   751     delete iExtension ; 
   758     delete iExtension ; 
       
   759     _AKNTRACE_FUNC_EXIT;
   752     }
   760     }
   753 
   761 
   754 EXPORT_C void CEikCaptionedControl::SetPointerEventObserver(MPointerEventObserver *aObserver)
   762 EXPORT_C void CEikCaptionedControl::SetPointerEventObserver(MPointerEventObserver *aObserver)
   755 	{
   763 	{
   756 	if (iExtension)	
   764 	if (iExtension)	
   790     return KErrNone;
   798     return KErrNone;
   791     }
   799     }
   792 
   800 
   793 EXPORT_C TSize CEikCaptionedControl::MinimumSize()
   801 EXPORT_C TSize CEikCaptionedControl::MinimumSize()
   794     {
   802     {
       
   803     _AKNTRACE_FUNC_ENTER;
   795 // NTBD Add an extra line for those with the label on a separate 
   804 // NTBD Add an extra line for those with the label on a separate 
   796     if ( iIsFormControl )
   805     if ( iIsFormControl )
   797         {
   806         {
   798         if (iControl->IsDimmed())
   807         if (iControl->IsDimmed())
   799             {
   808             {
   800             iSize = TSize( 0, 0) ; 
   809             iSize = TSize( 0, 0) ; 
       
   810             _AKNTRACE_FUNC_EXIT;
   801             return iSize;
   811             return iSize;
   802             }
   812             }
   803         // We can get the minimum size from the resource - and the size of the editor (EditorControlSize() in lines)
   813         // We can get the minimum size from the resource - and the size of the editor (EditorControlSize() in lines)
   804         CalculateNumberOfLinesForControl( ENotSupplied );
   814         CalculateNumberOfLinesForControl( ENotSupplied );
   805 
   815 
   870             iNumberOfLines = 0;
   880             iNumberOfLines = 0;
   871             }
   881             }
   872         // ------------------------
   882         // ------------------------
   873 
   883 
   874         iSize = layout.Size();
   884         iSize = layout.Size();
       
   885         _AKNTRACE_FUNC_EXIT;
   875         return ( iSize ) ;
   886         return ( iSize ) ;
   876         }
   887         }
   877     else
   888     else
   878         {   
   889         {   
   879         TSize size=iControl->MinimumSize();
   890         TSize size=iControl->MinimumSize();
   937         if (iCapCFlags&EUsesEars)
   948         if (iCapCFlags&EUsesEars)
   938             {
   949             {
   939             size.iWidth+=KCapCEarWidth+KCapCEarSpacing;
   950             size.iWidth+=KCapCEarWidth+KCapCEarSpacing;
   940             iCaptionWidth+=KCapCEarWidth+KCapCEarSpacing;
   951             iCaptionWidth+=KCapCEarWidth+KCapCEarSpacing;
   941             }
   952             }
   942         size.iHeight+=2*iVertEdgeSpacing;
   953         size.iWidth+=iCaptionWidth;
   943         size.iWidth+=iCaptionWidth+2*iHorzEdgeSpacing;
       
   944         if (iCapCFlags&ESeparatorAfter)
   954         if (iCapCFlags&ESeparatorAfter)
   945             size.iHeight+=KCapCSeparatorAfterSpace;
   955             size.iHeight+=KCapCSeparatorAfterSpace;
   946         iMinSize=size;
   956 
   947 
   957         _AKNTRACE_FUNC_EXIT;
   948         if ( iDoNotDisplay )
       
   949             // This flag is set if the control is not to be shown - so set it's height to zero
       
   950             iMinSize.iHeight = 0 ;
       
   951        return(size);
   958        return(size);
   952         }
   959         }
   953     }
   960     }
   954 /**
   961 /**
   955 * This routine should always called when any state affecting layout changed, including
   962 * This routine should always called when any state affecting layout changed, including
   957 * 
   964 * 
   958 * This is also called from Cone as a matter of course when SetRect is called on the object.
   965 * This is also called from Cone as a matter of course when SetRect is called on the object.
   959 */
   966 */
   960 EXPORT_C void CEikCaptionedControl::SizeChanged()
   967 EXPORT_C void CEikCaptionedControl::SizeChanged()
   961     {
   968     {
       
   969     _AKNTRACE_FUNC_ENTER;
   962     // Resize the animation
   970     // Resize the animation
   963     if( iIsFormControl && iExtension->iAnimation )
   971     if( iIsFormControl && iExtension->iAnimation )
   964         {
   972         {
   965         iExtension->iAnimation->SetHighlightSize( Rect().Size() );
   973         iExtension->iAnimation->SetHighlightSize( Rect().Size() );
   966         }
   974         }
  1123         else if ( mfne )
  1131         else if ( mfne )
  1124             {
  1132             {
  1125             mfne->SetSuppressBackgroundDrawing( EFalse );
  1133             mfne->SetSuppressBackgroundDrawing( EFalse );
  1126             }
  1134             }
  1127         }
  1135         }
       
  1136     _AKNTRACE_FUNC_EXIT;
  1128     }
  1137     }
  1129 
  1138 
  1130 
  1139 
  1131 void CEikCaptionedControl::StretchComponents()
  1140 void CEikCaptionedControl::StretchComponents()
  1132     {
  1141     {
  1133     if (iCapCFlags&EIfTooSmallDontStrech)
  1142     if (iCapCFlags&EIfTooSmallDontStrech)
  1134     	return;
  1143     	return;
  1135     
  1144     
  1136     TRect rect=Rect();
  1145     TRect rect(Rect());
  1137     rect.Shrink(iHorzEdgeSpacing,iVertEdgeSpacing);
       
  1138     if (iCapCFlags&ESeparatorAfter)
  1146     if (iCapCFlags&ESeparatorAfter)
  1139         rect.iBr.iY-=KCapCSeparatorAfterSpace;
  1147         rect.iBr.iY-=KCapCSeparatorAfterSpace;
  1140 
  1148 
  1141     const CFont* editorFont = AknLayoutUtils::FontFromId( iEditorFontId ) ;
  1149     const CFont* editorFont = AknLayoutUtils::FontFromId( iEditorFontId ) ;
  1142 
  1150 
  1143     TInt normalEditorHeight = editorFont->HeightInPixels() + editorFont->DescentInPixels() + ( 2 * iVertEdgeSpacing ) ;
  1151     TInt normalEditorHeight = editorFont->HeightInPixels() + editorFont->DescentInPixels();
  1144     if ( normalEditorHeight > rect.Height() )
  1152     if ( normalEditorHeight > rect.Height() )
  1145         normalEditorHeight = rect.Height() ;
  1153         normalEditorHeight = rect.Height() ;
  1146 
  1154 
  1147     // Insert Bitmap before caption 
  1155     // Insert Bitmap before caption 
  1148     // Note, if position of caption & bitmap is to be configurable this routine will have to be re structured
  1156     // Note, if position of caption & bitmap is to be configurable this routine will have to be re structured
  1149     if ( iBitmap )
  1157     if ( iBitmap )
  1150         {       
  1158         {       
  1151         TPoint bitmapTl = rect.iTl ;
  1159         TPoint bitmapTl( rect.iTl );
  1152         TSize bitmapSize = iBitmap->MinimumSize() ;
  1160         TSize bitmapSize( iBitmap->MinimumSize() );
  1153         if ( bitmapSize.iHeight > normalEditorHeight )
  1161         if ( bitmapSize.iHeight > normalEditorHeight )
  1154             {
  1162             {
  1155             // reduce the size of the bitmap whilst retaining proportion. (will clip the bitmap methinks)
  1163             // reduce the size of the bitmap whilst retaining proportion. (will clip the bitmap methinks)
  1156             TReal ratio = normalEditorHeight/bitmapSize.iHeight ;
  1164             TReal ratio = normalEditorHeight/bitmapSize.iHeight ;
  1157             bitmapSize = TSize( TInt(bitmapSize.iWidth * ratio) , TInt(bitmapSize.iHeight * ratio) ) ;
  1165             bitmapSize = TSize( TInt(bitmapSize.iWidth * ratio) , TInt(bitmapSize.iHeight * ratio) ) ;
  1175         iCaption->SetExtent(capPos,capSize);
  1183         iCaption->SetExtent(capPos,capSize);
  1176         if (iCapCFlags&EExtraAscent)
  1184         if (iCapCFlags&EExtraAscent)
  1177             rect.iTl.iY+=KCapCExtraAscent;
  1185             rect.iTl.iY+=KCapCExtraAscent;
  1178         }
  1186         }
  1179     rect.iTl.iX+=iCaptionWidth;
  1187     rect.iTl.iX+=iCaptionWidth;
  1180 
       
  1181     if ((iCapCFlags&EUsesEars) && !(iCapCFlags&ETrailerAfterEar))
       
  1182         rect.iBr.iX-=(KCapCEarWidth+KCapCEarSpacing);
       
  1183 
  1188 
  1184     if (iTrailer)
  1189     if (iTrailer)
  1185         {
  1190         {
  1186         TSize trailSize=iTrailer->MinimumSize();
  1191         TSize trailSize=iTrailer->MinimumSize();
  1187         TInt trailPosX=rect.iBr.iX-trailSize.iWidth;
  1192         TInt trailPosX=rect.iBr.iX-trailSize.iWidth;
  1189         if(trailSize.iHeight+trailPosY>Rect().iBr.iY)
  1194         if(trailSize.iHeight+trailPosY>Rect().iBr.iY)
  1190             trailSize.iHeight=Rect().iBr.iY-trailPosY;
  1195             trailSize.iHeight=Rect().iBr.iY-trailPosY;
  1191         iTrailer->SetExtent(TPoint(trailPosX,trailPosY),trailSize);
  1196         iTrailer->SetExtent(TPoint(trailPosX,trailPosY),trailSize);
  1192         rect.iBr.iX=trailPosX-KControlTrailerSpacing;
  1197         rect.iBr.iX=trailPosX-KControlTrailerSpacing;
  1193         }
  1198         }
  1194     if ((iCapCFlags&EUsesEars) && (iCapCFlags&ETrailerAfterEar))
       
  1195         rect.iBr.iX-=(KCapCEarWidth+KCapCEarSpacing);
       
  1196 
  1199 
  1197     if(iCapCFlags&EIfTooBigCtlStaysMinHeight && rect.Height()>iControl->MinimumSize().iHeight)
  1200     if(iCapCFlags&EIfTooBigCtlStaysMinHeight && rect.Height()>iControl->MinimumSize().iHeight)
  1198         rect.iBr.iY=rect.iTl.iY+iControl->MinimumSize().iHeight;
  1201         rect.iBr.iY=rect.iTl.iY+iControl->MinimumSize().iHeight;
  1199     if(iCapCFlags&EIfTooBigCtlStaysMinWidth && rect.Width()>iControl->MinimumSize().iWidth)
  1202     if(iCapCFlags&EIfTooBigCtlStaysMinWidth && rect.Width()>iControl->MinimumSize().iWidth)
  1200         rect.iBr.iX=rect.iTl.iX+iControl->MinimumSize().iWidth;
  1203         rect.iBr.iX=rect.iTl.iX+iControl->MinimumSize().iWidth;
  1201     iControl->SetRect(rect);
  1204     iControl->SetRect(rect);
  1202     
  1205     
  1203     }
  1206     }
  1204 
  1207 
  1205 
  1208 
  1206 TInt CEikCaptionedControl::WidthForEars(TInt aWidthRemaining) const
       
  1207     {
       
  1208     TInt earWidth=0;
       
  1209     if(iCapCFlags&EUsesEars)
       
  1210         {
       
  1211         const TInt earAndMarginWidth=KCapCEarWidth+KCapCEarSpacing;
       
  1212         if(iTrailer || iCaption)
       
  1213             {
       
  1214             if(aWidthRemaining>(2+(iTrailer?1:0)+(iCaption?1:0))*earAndMarginWidth)
       
  1215                 earWidth=earAndMarginWidth;
       
  1216             else if(aWidthRemaining>(2+(iTrailer?1:0)+(iCaption?1:0))*KCapCEarWidth)
       
  1217                 earWidth=KCapCEarWidth;
       
  1218             }
       
  1219         else
       
  1220             earWidth=Min(aWidthRemaining/2,earAndMarginWidth);
       
  1221         }
       
  1222     return earWidth;
       
  1223     }
       
  1224 
       
  1225 
       
  1226 void CEikCaptionedControl::SquashComponents()
  1209 void CEikCaptionedControl::SquashComponents()
  1227     {
  1210     {
  1228     TRect rect=Rect();
  1211     TRect rect=Rect();
  1229     // Shrink for Separator
  1212     // Shrink for Separator
  1230     if (iCapCFlags&ESeparatorAfter)
  1213     if (iCapCFlags&ESeparatorAfter)
  1231         rect.iBr.iY-=KCapCSeparatorAfterSpace;
  1214         rect.iBr.iY-=KCapCSeparatorAfterSpace;
  1232 
  1215 
  1233     // Space required before the left of the control rect
  1216     // Space required before the left of the control rect
  1234     TInt desiredLeft=iHorzEdgeSpacing;
  1217     TInt desiredLeft=0;
  1235     if(iCaption)
  1218     if(iCaption)
  1236         desiredLeft+=iCaption->MinimumSize().iWidth+KCapCCenterSpacing;
  1219         desiredLeft+=iCaption->MinimumSize().iWidth+KCapCCenterSpacing;
  1237     if ( iBitmap )
  1220     if ( iBitmap )
  1238         desiredLeft += iBitmap->MinimumSize().iWidth ; // + additional separation?
  1221         desiredLeft += iBitmap->MinimumSize().iWidth ; // + additional separation?
  1239 
  1222 
  1240     // Space required after the right of the control rect
  1223     // Space required after the right of the control rect
  1241     TInt desiredRight=iHorzEdgeSpacing;
  1224     TInt desiredRight=0;
  1242     if(iTrailer)
  1225     if(iTrailer)
  1243         desiredRight+=iTrailer->MinimumSize().iWidth+KControlTrailerSpacing;
  1226         desiredRight+=iTrailer->MinimumSize().iWidth+KControlTrailerSpacing;
  1244     
  1227     
  1245     // Decide on space for the control rect.
  1228     // Decide on space for the control rect.
  1246     TInt controlWidth=0;
  1229     TInt controlWidth=0;
  1256         else
  1239         else
  1257             controlWidth=Max(0,widthRemaining-(desiredLeft+desiredRight+2*(KCapCEarWidth+KCapCEarSpacing)));
  1240             controlWidth=Max(0,widthRemaining-(desiredLeft+desiredRight+2*(KCapCEarWidth+KCapCEarSpacing)));
  1258         widthRemaining-=controlWidth;
  1241         widthRemaining-=controlWidth;
  1259         }
  1242         }
  1260     
  1243     
  1261     // Decide if there is space for ears with margins, ears only, or no ears.
       
  1262     TInt earWidth=WidthForEars(widthRemaining);
       
  1263     widthRemaining-=2*earWidth;
       
  1264     
       
  1265     // Space assigned for before the left of the control rect
  1244     // Space assigned for before the left of the control rect
  1266     TInt actualLeft=0;
  1245     TInt actualLeft=0;
  1267     actualLeft=ScaledSubLength(widthRemaining,desiredLeft,desiredLeft+desiredRight);
  1246     actualLeft=ScaledSubLength(widthRemaining,desiredLeft,desiredLeft+desiredRight);
  1268     // Space assigned for after the right of the control rect
  1247     // Space assigned for after the right of the control rect
  1269     TInt actualRight=widthRemaining-actualLeft;
  1248     TInt actualRight=widthRemaining-actualLeft;
  1294         captionRect.iTl.iX+=actualLeft-actualCaption;
  1273         captionRect.iTl.iX+=actualLeft-actualCaption;
  1295         captionRect.iBr.iX=captionRect.iTl.iX+actualCaption;
  1274         captionRect.iBr.iX=captionRect.iTl.iX+actualCaption;
  1296         if (iCapCFlags&EExtraAscent)
  1275         if (iCapCFlags&EExtraAscent)
  1297             rect.iTl.iY+=KCapCExtraAscent;
  1276             rect.iTl.iY+=KCapCExtraAscent;
  1298         
  1277         
  1299         if(actualLeft>2*(KCapCCenterSpacing+iHorzEdgeSpacing))
  1278         if(actualLeft>2*(KCapCCenterSpacing))
  1300                 {
  1279                 {
  1301                 captionRect.iTl.iX+=iHorzEdgeSpacing;
       
  1302                 captionRect.iBr.iX-=KCapCCenterSpacing;
  1280                 captionRect.iBr.iX-=KCapCCenterSpacing;
  1303                 }
  1281                 }
  1304         const TSize capMin=iCaption->MinimumSize();
  1282         const TSize capMin=iCaption->MinimumSize();
  1305         iCaption->SetExtent(captionRect.iTl,TSize(Min(captionRect.Width(),capMin.iWidth)
  1283         iCaption->SetExtent(captionRect.iTl,TSize(Min(captionRect.Width(),capMin.iWidth)
  1306             ,Min(captionRect.Height(),iCaption->MinimumSize().iHeight)));
  1284             ,Min(captionRect.Height(),iCaption->MinimumSize().iHeight)));
  1309     // Decide if there is room in actualRight for trailer only, or trailer with margins.
  1287     // Decide if there is room in actualRight for trailer only, or trailer with margins.
  1310     if(iTrailer)
  1288     if(iTrailer)
  1311         {
  1289         {
  1312         TInt leftAdjust=0;
  1290         TInt leftAdjust=0;
  1313         TInt rightAdjust=0;
  1291         TInt rightAdjust=0;
  1314         TRect trailerRect=rect;
  1292         TRect trailerRect(rect);
  1315         trailerRect.iTl.iX+=actualLeft+controlWidth+(iCapCFlags&EUsesEars ? earWidth : 0);
  1293         trailerRect.iTl.iX+=actualLeft+controlWidth;
  1316         trailerRect.iTl.iY+=KTrailCVertCaptionOffset;
  1294         trailerRect.iTl.iY+=KTrailCVertCaptionOffset;
  1317 
  1295 
  1318         if(actualRight>2*(iHorzEdgeSpacing+KControlTrailerSpacing))
  1296         if(actualRight>2*(KControlTrailerSpacing))
  1319             {
  1297             {
  1320             if(iCapCFlags&ETrailerAfterEar)
  1298             leftAdjust=KControlTrailerSpacing;
  1321                 {
  1299             }
  1322                 leftAdjust=KControlTrailerSpacing+earWidth;
  1300 
  1323                 rightAdjust=iHorzEdgeSpacing;
       
  1324                 }
       
  1325             else
       
  1326                 {
       
  1327                 rightAdjust=earWidth+iHorzEdgeSpacing;
       
  1328                 leftAdjust=KControlTrailerSpacing;
       
  1329                 }
       
  1330             }
       
  1331         else
       
  1332             {
       
  1333             if(iCapCFlags&ETrailerAfterEar)
       
  1334                 leftAdjust=earWidth;
       
  1335             else
       
  1336                 rightAdjust=earWidth;
       
  1337             }
       
  1338         trailerRect.iTl.iX+=leftAdjust;
  1301         trailerRect.iTl.iX+=leftAdjust;
  1339         trailerRect.iBr.iX-=rightAdjust;
  1302         trailerRect.iBr.iX-=rightAdjust;
  1340         iTrailer->SetExtent(trailerRect.iTl,TSize(trailerRect.Width(),
  1303         iTrailer->SetExtent(trailerRect.iTl,TSize(trailerRect.Width(),
  1341             Min(trailerRect.Height(),iTrailer->MinimumSize().iHeight)));
  1304             Min(trailerRect.Height(),iTrailer->MinimumSize().iHeight)));
  1342         }
  1305         }
  1343     // Position and set the controls space
  1306     // Position and set the controls space
  1344     TRect controlRect=rect;
  1307     TRect controlRect=rect;
  1345     controlRect.iTl.iX+=actualLeft+earWidth;
  1308     controlRect.iTl.iX+=actualLeft;
  1346     controlRect.iBr.iX-=(actualRight+earWidth);
  1309     controlRect.iBr.iX-=actualRight;
  1347     if(iCapCFlags&EIfTooBigCtlStaysMinHeight && controlRect.Height()>iControl->MinimumSize().iHeight)
  1310     if(iCapCFlags&EIfTooBigCtlStaysMinHeight && controlRect.Height()>iControl->MinimumSize().iHeight)
  1348         controlRect.iBr.iY=controlRect.iTl.iY+iControl->MinimumSize().iHeight;
  1311         controlRect.iBr.iY=controlRect.iTl.iY+iControl->MinimumSize().iHeight;
  1349     iControl->SetRect(controlRect);
  1312     iControl->SetRect(controlRect);
  1350     
  1313     }
  1351     }
       
  1352 
       
  1353 
  1314 
  1354 
  1315 
  1355 /**
  1316 /**
  1356  * Sets the flags, aFlags, (see TSpaceSharingFlags), which determine
  1317  * Sets the flags, aFlags, (see TSpaceSharingFlags), which determine
  1357  * the way space is distributed if the captioned control is given too
  1318  * the way space is distributed if the captioned control is given too
  1364     }
  1325     }
  1365 
  1326 
  1366 
  1327 
  1367 static TInt IdleCallback(TAny *aAny)
  1328 static TInt IdleCallback(TAny *aAny)
  1368 {
  1329 {
       
  1330 	_AKNTRACE_FUNC_ENTER;
  1369 	CIdleCallbackData *data = (CIdleCallbackData*)aAny;
  1331 	CIdleCallbackData *data = (CIdleCallbackData*)aAny;
  1370 	CEikCapCExtension *ext = data->iExt;
  1332 	CEikCapCExtension *ext = data->iExt;
  1371 	CEikCaptionedControl *ctrl = data->iCtrl;
  1333 	CEikCaptionedControl *ctrl = data->iCtrl;
  1372 
  1334 
  1373 	CEikEdwin *edwin = (CEikEdwin*)ctrl->iControl;
  1335 	CEikEdwin *edwin = (CEikEdwin*)ctrl->iControl;
  1376 	TRAP_IGNORE ( edwin->SetCursorPosL( (textLength>=0 ? textLength : 0), EFalse) );
  1338 	TRAP_IGNORE ( edwin->SetCursorPosL( (textLength>=0 ? textLength : 0), EFalse) );
  1377 	delete ext->iIdle;
  1339 	delete ext->iIdle;
  1378 	ext->iIdle = NULL;
  1340 	ext->iIdle = NULL;
  1379 	delete data;
  1341 	delete data;
  1380 	ext->iIdleData = NULL;
  1342 	ext->iIdleData = NULL;
       
  1343 	_AKNTRACE_FUNC_EXIT;
  1381 	return EFalse;	
  1344 	return EFalse;	
  1382 }
  1345 }
  1383 
  1346 
  1384 void CEikCaptionedControl::ScrollBackEditor()
  1347 void CEikCaptionedControl::ScrollBackEditorL()
  1385 {
  1348     {
  1386         //
  1349     _AKNTRACE_FUNC_ENTER;
  1387 		// For long single-line edwin, scroll horizontally to show beginning of the edwin
  1350     //
  1388 		// when focus changes away from the edwin.
  1351     // For long single-line edwin, scroll horizontally to show beginning
  1389 		// 
  1352     // of the edwin when focus changes away from the edwin.
  1390       	if ( iIsEditable && ControlIsAnEdwin(iControlType) )
  1353     // 
  1391 			{
  1354     if ( iIsEditable && ControlIsAnEdwin( iControlType ) )
  1392 			delete iExtension->iIdle;
  1355         {
  1393 			delete iExtension->iIdleData;
  1356         delete iExtension->iIdle;
  1394 			iExtension->iIdleData = new (ELeave) CIdleCallbackData;
  1357         iExtension->iIdle = NULL;
  1395 			iExtension->iIdleData->iCtrl = this;
  1358         delete iExtension->iIdleData;
  1396 			iExtension->iIdleData->iExt = iExtension;
  1359         iExtension->iIdleData = NULL;
  1397 			iExtension->iIdle = CIdle::NewL(0);
  1360         iExtension->iIdleData = new (ELeave) CIdleCallbackData;
  1398 			iExtension->iIdle->Start(TCallBack(&IdleCallback, iExtension->iIdleData));
  1361         iExtension->iIdleData->iCtrl = this;
  1399 			}	
  1362         iExtension->iIdleData->iExt = iExtension;
  1400 }
  1363         iExtension->iIdle = CIdle::NewL( 0 );
       
  1364         iExtension->iIdle->Start(
       
  1365             TCallBack( &IdleCallback, iExtension->iIdleData ) );
       
  1366         }
       
  1367     _AKNTRACE_FUNC_EXIT;
       
  1368     }
  1401 
  1369 
  1402 EXPORT_C void CEikCaptionedControl::FocusChanged(TDrawNow aDrawNow)
  1370 EXPORT_C void CEikCaptionedControl::FocusChanged(TDrawNow aDrawNow)
  1403     {    
  1371     {    
       
  1372     _AKNTRACE_FUNC_ENTER;
  1404     // Only form controls need to adapt animation to focus changes.
  1373     // Only form controls need to adapt animation to focus changes.
  1405     if( iExtension->iAnimation && iIsFormControl )
  1374     if( iExtension->iAnimation && iIsFormControl )
  1406         {
  1375         {
  1407         // Pause animation when losing focus (other states ignored)
  1376         // Pause animation when losing focus (other states ignored)
  1408         if( !IsFocused() )
  1377         if( !IsFocused() )
  1409             {
  1378             {
  1410             iExtension->iAnimation->Pause();
  1379             iExtension->iAnimation->Pause();
  1411             }
  1380             }
  1412         else if( iIsCurrentLine && !iIsEditable ) // Current and in view mode
  1381         else if( iIsCurrentLine && !iIsEditable ) // Current and in view mode
  1413             {
  1382             {
  1414             CAknAppUi* aui = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
  1383             CAknAppUi* aui = static_cast<CAknAppUi*>(iEikonEnv->AppUi());
  1415             if( aui->IsForeground() )
  1384             if( aui->IsForeground() )
  1416                 {
  1385                 {
  1417                 iExtension->iAnimation->Play();
  1386                 iExtension->iAnimation->Play();
  1418                 }
  1387                 }
  1419             }
  1388             }
  1475             if (!focused)
  1444             if (!focused)
  1476                 emphasis=(iCapCFlags&ECurrent? CEikLabel::EPartialEmphasis: CEikLabel::ENoEmphasis);
  1445                 emphasis=(iCapCFlags&ECurrent? CEikLabel::EPartialEmphasis: CEikLabel::ENoEmphasis);
  1477             iCaption->SetEmphasis(emphasis);
  1446             iCaption->SetEmphasis(emphasis);
  1478             }
  1447             }
  1479         }
  1448         }
  1480     
  1449 
  1481 
  1450     _AKNTRACE_FUNC_EXIT;
  1482     if (aDrawNow && iCapCFlags&EUsesEars && IsReadyToDraw())
  1451     }
  1483         DrawEarsNow(EBothEars);
  1452 
  1484     }
       
  1485 
       
  1486 
       
  1487 
       
  1488 void CEikCaptionedControl::DrawEarsNow(TWhichEars aEar) const
       
  1489     {
       
  1490     ActivateGc();
       
  1491     DrawEars(aEar);
       
  1492     DeactivateGc();
       
  1493     }
       
  1494 
       
  1495 void CEikCaptionedControl::DrawEars(TWhichEars aEar) const
       
  1496     {
       
  1497     if (aEar&ELeftEar)
       
  1498         DrawSingleEar(ELeftEar,iCapCFlags&ELeftEarDown);
       
  1499     if (aEar&ERightEar)
       
  1500         DrawSingleEar(ERightEar,iCapCFlags&ERightEarDown);
       
  1501     }
       
  1502 
       
  1503 void CEikCaptionedControl::DrawSingleEar(TWhichEars /*aEar*/,TBool /*aPressed*/) const
       
  1504     {
       
  1505     // not needed in S60
       
  1506     }
       
  1507 
       
  1508 TRect CEikCaptionedControl::EarRect(TWhichEars /*aEar*/) const
       
  1509     {
       
  1510     return(TRect(0,0,0,0)); // not needed in S60
       
  1511     }
       
  1512 
  1453 
  1513 EXPORT_C TInt CEikCaptionedControl::CountComponentControls() const
  1454 EXPORT_C TInt CEikCaptionedControl::CountComponentControls() const
  1514     {
  1455     {
  1515     CCoeControl* controls[] = 
  1456     CCoeControl* controls[] = 
  1516     {
  1457     {
  1555     }
  1496     }
  1556 
  1497 
  1557 
  1498 
  1558 EXPORT_C void CEikCaptionedControl::Draw(const TRect& aRect) const
  1499 EXPORT_C void CEikCaptionedControl::Draw(const TRect& aRect) const
  1559     {   
  1500     {   
       
  1501     _AKNTRACE_FUNC_ENTER;
  1560     if (iIsFormControl )
  1502     if (iIsFormControl )
  1561         DrawAsForm( aRect );
  1503         DrawAsForm( aRect );
  1562     else
  1504     else
  1563         DrawAsEikonDialog( aRect );
  1505         DrawAsEikonDialog( aRect );
       
  1506     _AKNTRACE_FUNC_EXIT;
  1564     }
  1507     }
  1565 
  1508 
  1566 void CEikCaptionedControl::DrawAsForm( const TRect& aRect ) const
  1509 void CEikCaptionedControl::DrawAsForm( const TRect& aRect ) const
  1567     {
  1510     {
  1568 
  1511     _AKNTRACE_FUNC_ENTER;
  1569     CWindowGc& gc=SystemGc();
  1512     CWindowGc& gc=SystemGc();
  1570 
  1513 
  1571     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1514     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1572     if ( iRefresh )
       
  1573         {
       
  1574         gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
       
  1575         gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
       
  1576         }
       
  1577 
  1515 
  1578     if ( iCaption )
  1516     if ( iCaption )
  1579         {
  1517         {
  1580 // Draw ':' for edit indicator.  ( Skin independant )
  1518 // Draw ':' for edit indicator.  ( Skin independant )
  1581         if ( iIsEditable && iIsCurrentLine )
  1519         if ( iIsEditable && iIsCurrentLine )
  1607         DrawAsFormInEditMode( aRect );
  1545         DrawAsFormInEditMode( aRect );
  1608     else if (!iIsEditable && iIsCurrentLine )
  1546     else if (!iIsEditable && iIsCurrentLine )
  1609         DrawAsFormInViewMode( aRect );
  1547         DrawAsFormInViewMode( aRect );
  1610     else
  1548     else
  1611         DrawAsFormUnFocusedLine( aRect );
  1549         DrawAsFormUnFocusedLine( aRect );
       
  1550     _AKNTRACE_FUNC_EXIT;
  1612     }
  1551     }
  1613 
  1552 
  1614 void CEikCaptionedControl::DrawAsFormInEditMode( const TRect& /*aRect*/ ) const
  1553 void CEikCaptionedControl::DrawAsFormInEditMode( const TRect& /*aRect*/ ) const
  1615     {
  1554     {
       
  1555     _AKNTRACE_FUNC_ENTER;
  1616     CWindowGc& gc=SystemGc();
  1556     CWindowGc& gc=SystemGc();
  1617 
  1557 
  1618     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1558     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1619 
       
  1620     if ( iRefresh )
       
  1621         {
       
  1622         gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
       
  1623         gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
       
  1624         }
       
  1625 
  1559 
  1626     if (iDialogPage&& iHighlightControl)
  1560     if (iDialogPage&& iHighlightControl)
  1627         {
  1561         {
  1628         TInt height(Rect().Height());
  1562         TInt height(Rect().Height());
  1629         TBool top = iDialogPage->VisibleSizeOnPage(height,iControl);
  1563         TBool top = iDialogPage->VisibleSizeOnPage(height,iControl);
  1682         );
  1616         );
  1683     gc.SetPenStyle(CGraphicsContext::ESolidPen);
  1617     gc.SetPenStyle(CGraphicsContext::ESolidPen);
  1684     gc.SetBrushStyle( CGraphicsContext::ENullBrush ) ;
  1618     gc.SetBrushStyle( CGraphicsContext::ENullBrush ) ;
  1685     gc.SetPenColor( line2Rect.Color() ) ;   
  1619     gc.SetPenColor( line2Rect.Color() ) ;   
  1686     gc.DrawRect(line2Rect.Rect());
  1620     gc.DrawRect(line2Rect.Rect());
       
  1621     _AKNTRACE_FUNC_EXIT;
  1687     }
  1622     }
  1688 
  1623 
  1689 
  1624 
  1690 void CEikCaptionedControl::DrawAsFormInViewMode( const TRect& /*aRect*/ ) const
  1625 void CEikCaptionedControl::DrawAsFormInViewMode( const TRect& /*aRect*/ ) const
  1691     {
  1626     {
       
  1627     _AKNTRACE_FUNC_ENTER;
  1692     CWindowGc& gc=SystemGc();
  1628     CWindowGc& gc=SystemGc();
  1693 
  1629 
  1694     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1630     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1695 
  1631 
  1696     if ( iRefresh )
       
  1697         {
       
  1698         gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
       
  1699         gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
       
  1700         }
       
  1701 
       
  1702     // This gives the correct Rect for using the Layout functions
  1632     // This gives the correct Rect for using the Layout functions
  1703     TRect viewRect=ViewRect(); 
  1633     TRect viewRect( Rect() ); 
  1704 
  1634 
  1705     TAknLayoutRect line1Rect;
  1635     TAknLayoutRect line1Rect;
  1706     line1Rect.LayoutRect( viewRect, AKN_LAYOUT_WINDOW_List_pane_highlight_graphics__various__Line_1 (viewRect) );
  1636     line1Rect.LayoutRect( viewRect, AKN_LAYOUT_WINDOW_List_pane_highlight_graphics__various__Line_1 (viewRect) );
  1707 
  1637 
  1708     /* This is in view mode, and is the current line
  1638     /* This is in view mode, and is the current line
  1747             TPoint(iVerticalLineXPosition,Rect().iTl.iY+2));
  1677             TPoint(iVerticalLineXPosition,Rect().iTl.iY+2));
  1748         }
  1678         }
  1749 
  1679 
  1750     gc.DrawLine(TPoint(iVerticalLineXPosition,Rect().iBr.iY-1),
  1680     gc.DrawLine(TPoint(iVerticalLineXPosition,Rect().iBr.iY-1),
  1751         TPoint(iVerticalLineXPosition,Rect().iBr.iY+1));
  1681         TPoint(iVerticalLineXPosition,Rect().iBr.iY+1));
       
  1682     _AKNTRACE_FUNC_EXIT;
  1752     }
  1683     }
  1753     
  1684     
  1754 void CEikCaptionedControl::DrawAsFormUnFocusedLine( const TRect& /*aRect*/ ) const
  1685 void CEikCaptionedControl::DrawAsFormUnFocusedLine( const TRect& /*aRect*/ ) const
  1755     {
  1686     {
       
  1687     _AKNTRACE_FUNC_ENTER;
  1756     CWindowGc& gc=SystemGc();
  1688     CWindowGc& gc=SystemGc();
  1757 
       
  1758     gc.SetPenStyle(CGraphicsContext::ENullPen);
       
  1759 
       
  1760     if ( iRefresh )
       
  1761         {
       
  1762         gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
       
  1763         gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
       
  1764         }
       
  1765 
  1689 
  1766     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1690     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1767     gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
  1691     gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
  1768     gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;  
  1692     gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;  
  1769 
  1693 
  1778     gc.SetPenStyle(CGraphicsContext::ESolidPen);
  1702     gc.SetPenStyle(CGraphicsContext::ESolidPen);
  1779     gc.SetPenColor(iEikonEnv->ControlColor(EColorDialogText,*this));
  1703     gc.SetPenColor(iEikonEnv->ControlColor(EColorDialogText,*this));
  1780     gc.SetBrushStyle( CGraphicsContext::ENullBrush ) ;
  1704     gc.SetBrushStyle( CGraphicsContext::ENullBrush ) ;
  1781     gc.DrawLine(TPoint(iVerticalLineXPosition,Rect().iTl.iY),
  1705     gc.DrawLine(TPoint(iVerticalLineXPosition,Rect().iTl.iY),
  1782         TPoint(iVerticalLineXPosition,Rect().iBr.iY+1));
  1706         TPoint(iVerticalLineXPosition,Rect().iBr.iY+1));
  1783     // CEikCaptionedControl* visibleBelow=0; (NOT USED)
       
  1784 
  1707 
  1785     if (iDialogPage) 
  1708     if (iDialogPage) 
  1786         {
  1709         {
  1787         // visibleBelow=iDialogPage->FindNextControlOnPageWithHeight(EFalse,this); 
  1710         // visibleBelow=iDialogPage->FindNextControlOnPageWithHeight(EFalse,this); 
  1788 
  1711 
  1789         //draw separator line unless This control is at or off the top of the page.
  1712         //draw separator line unless This control is at or off the top of the page.
  1790         TBool atTopOfPage = (iDialogPage && iDialogPage->IsAtOrOffTopOfPage(iControl) );
  1713         TBool atTopOfPage = (iDialogPage && iDialogPage->IsAtOrOffTopOfPage(iControl) );
  1791         if (HasSeparator() && !atTopOfPage)
  1714         if (HasSeparator() && !atTopOfPage)
  1792             DrawFormSeparator( gc );
  1715             DrawFormSeparator( gc );
  1793         }
  1716         }
       
  1717     _AKNTRACE_FUNC_EXIT;
  1794     } 
  1718     } 
  1795 
  1719 
  1796 
  1720 
  1797 // ---------------------------------------------------------------------------
  1721 // ---------------------------------------------------------------------------
  1798 // CEikCaptionedControl::TextColorIndex
  1722 // CEikCaptionedControl::TextColorIndex
  1799 // ---------------------------------------------------------------------------
  1723 // ---------------------------------------------------------------------------
  1800 //
  1724 //
  1801 TAknsQsnTextColorsIndex CEikCaptionedControl::TextColorIndex() const
  1725 TAknsQsnTextColorsIndex CEikCaptionedControl::TextColorIndex() const
  1802     {
  1726     {
  1803     TAknsQsnTextColorsIndex colorIndex = EAknsCIQsnTextColorsCG8;
  1727     TAknsQsnTextColorsIndex colorIndex = EAknsCIQsnTextColorsCG6;
  1804 
  1728 
  1805     // Note control doesn't use highlight text color
  1729     // Note control doesn't use highlight text color
  1806     if ( iControlType != EAknCtNote )
  1730     if ( iControlType != EAknCtNote )
  1807         {
  1731         {
  1808         if ( iIsCurrentLine && iDialogPage->HighlightVisible() )
  1732         if ( iIsCurrentLine && iDialogPage->HighlightVisible() )
  1809             {
  1733             {
  1810             colorIndex = EAknsCIQsnTextColorsCG10;
  1734             colorIndex = EAknsCIQsnTextColorsCG8;
  1811             }
  1735             }
  1812         }
  1736         }
  1813     
  1737     
  1814     return colorIndex;
  1738     return colorIndex;
  1815     }
  1739     }
  1816 
  1740 
  1817 
  1741 
  1818 void CEikCaptionedControl::DrawAsEikonDialog( const TRect& aRect ) const
  1742 void CEikCaptionedControl::DrawAsEikonDialog( const TRect& /*aRect*/ ) const
  1819     {
  1743     {
       
  1744     _AKNTRACE_FUNC_ENTER;
  1820     CWindowGc& gc=SystemGc();
  1745     CWindowGc& gc=SystemGc();
  1821     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1746     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1822 
  1747 
  1823     if (iHighlightControl)
  1748     if (iHighlightControl)
  1824         STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->SetTopOrBottom(CEikCaptionedControlFormHighlightLine::EUnset);
  1749         STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->SetTopOrBottom(CEikCaptionedControlFormHighlightLine::EUnset);
  1825 
       
  1826     if ( iRefresh )
       
  1827         {
       
  1828         gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
       
  1829         gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
       
  1830         }
       
  1831 
       
  1832 
       
  1833     TRect redrawRect=Rect();
       
  1834     redrawRect.Intersection(aRect);
       
  1835 
  1750 
  1836     /*
  1751     /*
  1837     *
  1752     *
  1838     * FIX TSW JTON-6HGAND - see also eikdpage.cpp
  1753     * FIX TSW JTON-6HGAND - see also eikdpage.cpp
  1839     *
  1754     *
  1841     *    gc.DrawRect(redrawRect);
  1756     *    gc.DrawRect(redrawRect);
  1842     *
  1757     *
  1843     * Most likely other places using gc.Clear() ( or gc.DrawRect() as 'clear'
  1758     * Most likely other places using gc.Clear() ( or gc.DrawRect() as 'clear'
  1844     * should be fixed also.
  1759     * should be fixed also.
  1845     */
  1760     */
  1846     
       
  1847     if (iCapCFlags&ESeparatorAfter)
  1761     if (iCapCFlags&ESeparatorAfter)
  1848         {
  1762         {
  1849         TRect rect(Rect());
  1763         TRect rect(Rect());
  1850         TPoint separatorStartPt(rect.iTl.iX+iHorzEdgeSpacing/2,rect.iBr.iY-1);
  1764         TPoint separatorStartPt(rect.iTl.iX,rect.iBr.iY-1);
  1851         TPoint separatorEndPt(separatorStartPt.iX+(iFullWidth-iHorzEdgeSpacing), separatorStartPt.iY);
  1765         TPoint separatorEndPt(separatorStartPt.iX, separatorStartPt.iY);
  1852         gc.SetPenStyle(CGraphicsContext::ESolidPen);
  1766         gc.SetPenStyle(CGraphicsContext::ESolidPen);
  1853         gc.SetPenColor(iEikonEnv->ControlColor(EColorWindowText, *this));
  1767         gc.SetPenColor(iEikonEnv->ControlColor(EColorWindowText, *this));
  1854         gc.DrawLine(separatorStartPt, separatorEndPt);
  1768         gc.DrawLine(separatorStartPt, separatorEndPt);
  1855         };
  1769         }
  1856 
  1770 
  1857     if (iCapCFlags&EUsesEars)
  1771     _AKNTRACE_FUNC_EXIT;
  1858         DrawEars(EBothEars); 
       
  1859     }
  1772     }
  1860 
  1773 
  1861 /*
  1774 /*
  1862 * Method to return T/F whether this CEikCaptionedControl has a separator.
  1775 * Method to return T/F whether this CEikCaptionedControl has a separator.
  1863 */
  1776 */
  1867     }
  1780     }
  1868 
  1781 
  1869 
  1782 
  1870 EXPORT_C TKeyResponse CEikCaptionedControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
  1783 EXPORT_C TKeyResponse CEikCaptionedControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
  1871     {
  1784     {
       
  1785     _AKNTRACE_FUNC_ENTER;
  1872     if ( !iIsFormControl) 
  1786     if ( !iIsFormControl) 
  1873         return iControl->OfferKeyEventL(aKeyEvent,aType);
  1787         return iControl->OfferKeyEventL(aKeyEvent,aType);
  1874     else if ( iIsFormControl && iIsEditable )
  1788     else if ( iIsFormControl && iIsEditable )
  1875         {
  1789         {
  1876         TKeyResponse retVal ;
  1790         TKeyResponse retVal ;
  1877         retVal = iControl->OfferKeyEventL( aKeyEvent, aType ) ;
  1791         retVal = iControl->OfferKeyEventL( aKeyEvent, aType ) ;
       
  1792         _AKNTRACE_FUNC_EXIT;
  1878         return retVal ;
  1793         return retVal ;
  1879         }
  1794         }
  1880     else
  1795     else
       
  1796         _AKNTRACE_FUNC_EXIT;
  1881         return EKeyWasNotConsumed ;
  1797         return EKeyWasNotConsumed ;
  1882     }
  1798     }
  1883 
  1799 
  1884 EXPORT_C TCoeInputCapabilities CEikCaptionedControl::InputCapabilities() const
  1800 EXPORT_C TCoeInputCapabilities CEikCaptionedControl::InputCapabilities() const
  1885     {
  1801     {
  1886     return TCoeInputCapabilities(TCoeInputCapabilities::ENone, NULL, CONST_CAST(CEikCaptionedControl*, this));
  1802     return TCoeInputCapabilities(TCoeInputCapabilities::ENone, NULL, CONST_CAST(CEikCaptionedControl*, this));
  1887     }
  1803     }
  1888 
  1804 
  1889 EXPORT_C void CEikCaptionedControl::SetDimmed(TBool aDimmed)
  1805 EXPORT_C void CEikCaptionedControl::SetDimmed(TBool aDimmed)
  1890     {
  1806     {
       
  1807     _AKNTRACE_FUNC_ENTER;
  1891     CCoeControl::SetDimmed(aDimmed);
  1808     CCoeControl::SetDimmed(aDimmed);
  1892     if (iControl && iControl->IsVisible())
  1809     if (iControl && iControl->IsVisible())
  1893         {
  1810         {
  1894         iControl->SetDimmed(aDimmed);
  1811         iControl->SetDimmed(aDimmed);
  1895         }
  1812         }
  1899         }
  1816         }
  1900     if (iTrailer)
  1817     if (iTrailer)
  1901         {
  1818         {
  1902         iTrailer->SetDimmed(aDimmed);
  1819         iTrailer->SetDimmed(aDimmed);
  1903         }
  1820         }
       
  1821     _AKNTRACE_FUNC_EXIT;
  1904     }
  1822     }
  1905 
  1823 
  1906 EXPORT_C void* CEikCaptionedControl::ExtensionInterface( TUid /*aInterface*/ )
  1824 EXPORT_C void* CEikCaptionedControl::ExtensionInterface( TUid /*aInterface*/ )
  1907     {
  1825     {
  1908     return NULL;
  1826     return NULL;
  1909     }   
  1827     }   
  1910 
  1828 
  1911 EXPORT_C void CEikCaptionedControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
  1829 EXPORT_C void CEikCaptionedControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
  1912     {
  1830     {
  1913     if (!IsNonFocusing())
  1831     _AKNTRACE_FUNC_ENTER;
  1914         {
  1832     TBool edwinControl( ControlIsAnEdwin( iControlType ) );
  1915         TWhichEars ear=ENoEar;
  1833     
  1916         if (aPointerEvent.iType!=TPointerEvent::EButton1Down)
  1834      if ( iIsFormControl )
  1917             {
  1835         {
  1918             if (iCapCFlags&ELeftEarGrab)
  1836         if ( !PressedDownState() &&
  1919                 ear=ELeftEar;
  1837              aPointerEvent.iType == TPointerEvent::EButton1Down )
  1920             else if (iCapCFlags&ERightEarGrab)
  1838             {
  1921                 ear=ERightEar;
  1839             SetPressedDownState( ETrue );
  1922             if (ear)
  1840             DrawDeferred();
  1923                 {
  1841             }
  1924                 TInt oldDrawFlags=iCapCFlags&(ELeftEarDown|ERightEarDown);
  1842         else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
  1925                 if (aPointerEvent.iType==TPointerEvent::EButton1Up)
  1843             {
  1926                     iCapCFlags&=(~KDynamicEarMask);
  1844             _AKNTRACE( "TPointerEvent::EButton1Up" );
       
  1845             SetPressedDownState( EFalse );
       
  1846             DrawDeferred();
       
  1847             }
       
  1848         
       
  1849         if ( ( aPointerEvent.iType == TPointerEvent::EButton1Down || 
       
  1850                aPointerEvent.iType == TPointerEvent::EButton1Up ) &&
       
  1851              iIsEditable &&
       
  1852              edwinControl &&
       
  1853              iExtension &&
       
  1854              iExtension->iFeedback &&
       
  1855              iControl->Rect().Contains( aPointerEvent.iPosition ) )
       
  1856             {
       
  1857             CEikEdwin* edwin = static_cast<CEikEdwin*>( iControl );
       
  1858             if ( edwin &&
       
  1859                  ( edwin->UserFlags() & CEikEdwin::EDisplayOnly ||
       
  1860                    edwin->IsReadOnly() ) )
       
  1861                 {
       
  1862                 // For edwins in view only mode we must produce the feedback
       
  1863                 // here, as the edwin itself doesn't.
       
  1864                 if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
  1865                     {
       
  1866                     iExtension->iFeedback->InstantFeedback( iControl,
       
  1867                                                             ETouchFeedbackList );
       
  1868                     }
  1927                 else
  1869                 else
  1928                     {
  1870                     {
  1929                     iCapCFlags&=(~(ELeftEarDown|ERightEarDown));
  1871                     iExtension->iFeedback->InstantFeedback( iControl,
  1930                     if (EarRect(ear).Contains(aPointerEvent.iPosition))
  1872                                                             ETouchFeedbackList,
  1931                         {
  1873                                                             ETouchFeedbackVibra,
  1932                         FireEarL(ear, KCapCEarRepeat);
  1874                                                             aPointerEvent );
  1933                         return;
       
  1934                         }
       
  1935                     }
  1875                     }
  1936                 if (oldDrawFlags!=(iCapCFlags&(ELeftEarDown|ERightEarDown)))
  1876                 }
  1937                     DrawEarsNow(ear);
  1877             }
  1938                 return;
       
  1939                 }
       
  1940             }
       
  1941         else if (iCapCFlags&EUsesEars)
       
  1942             {
       
  1943             iCapCFlags&=(~KDynamicEarMask);
       
  1944             if (EarRect(ELeftEar).Contains(aPointerEvent.iPosition))
       
  1945                 ear=ELeftEar;
       
  1946             else if (EarRect(ERightEar).Contains(aPointerEvent.iPosition))
       
  1947                 ear=ERightEar;
       
  1948             if (ear)
       
  1949                 {
       
  1950                 FireEarL(ear, KCapCInitialEarRepeat);
       
  1951                 return;
       
  1952                 }
       
  1953             }
       
  1954         }
       
  1955      if (iIsFormControl)
       
  1956         {
       
  1957         if ( PressedDownState()&&
       
  1958             aPointerEvent.iType == TPointerEvent::EButton1Down )
       
  1959             {
       
  1960             SetPressedDownState( ETrue );
       
  1961             DrawDeferred();    
       
  1962             }
       
  1963         else if(aPointerEvent.iType == TPointerEvent::EButton1Up)
       
  1964             {
       
  1965             SetPressedDownState( EFalse );
       
  1966             DrawDeferred();
       
  1967             }       
       
  1968         }
  1878         }
  1969     
  1879     
  1970     if ( !iIsEditable && (ControlIsAnEdwin(iControlType) || ControlIsAMfne(iControlType))
  1880     if ( !iIsEditable && ( edwinControl || ControlIsAMfne( iControlType ) )
  1971        &&( iDialogPage && CEikDialogPage::EDouble == iDialogPage->FormLayout() ))
  1881        &&( iDialogPage && CEikDialogPage::EDouble == iDialogPage->FormLayout() ))
  1972         {
  1882         {
       
  1883         _AKNTRACE_FUNC_EXIT;
  1973 		return;
  1884 		return;
  1974         }
  1885         }
  1975 
  1886 
  1976     CCoeControl::HandlePointerEventL(aPointerEvent);    
  1887     CCoeControl::HandlePointerEventL(aPointerEvent);    
  1977      
  1888      
  1978     if ( iExtension )
  1889     if ( iExtension && iIsFormControl )
  1979         {
  1890         {
  1980         iExtension->SimulatePointerEventToControlL( aPointerEvent );
  1891         iExtension->SimulatePointerEventToControlL( aPointerEvent );
  1981         }
  1892         }
  1982     }
  1893     }
  1983 
  1894 
  1984 void CEikCaptionedControl::FireEarL(TWhichEars aEar, TInt aEarRepeat)
       
  1985     {
       
  1986     Window().RequestPointerRepeatEvent(aEarRepeat, EarRect(aEar));
       
  1987     TKeyEvent key;
       
  1988     key.iModifiers=0;
       
  1989     if (aEar==ELeftEar)
       
  1990         {
       
  1991         key.iCode=EKeyLeftArrow;
       
  1992         iCapCFlags|=ELeftEarDown|ELeftEarGrab;
       
  1993         }
       
  1994     else
       
  1995         {
       
  1996         key.iCode=EKeyRightArrow;
       
  1997         iCapCFlags|=ERightEarDown|ERightEarGrab;
       
  1998         }
       
  1999     DrawEarsNow(aEar);
       
  2000     iControl->OfferKeyEventL(key,EEventKey);
       
  2001     }
       
  2002 
  1895 
  2003 EXPORT_C void CEikCaptionedControl::SetCaptionL(const TDesC& aText)
  1896 EXPORT_C void CEikCaptionedControl::SetCaptionL(const TDesC& aText)
  2004     {
  1897     {
       
  1898     _AKNTRACE_FUNC_ENTER;
       
  1899     _AKNTRACE("aText = %s", &aText);    
  2005     ConstructExtensionL() ; // One of several places where this is made
  1900     ConstructExtensionL() ; // One of several places where this is made
  2006     if (!iCaption)
  1901     if (!iCaption)
  2007         {
  1902         {
  2008 //      Retain a zero sized caption for formatting forms
  1903 //      Retain a zero sized caption for formatting forms
  2009         iCaption=new(ELeave) CEikCapCLabel;
  1904         iCaption=new(ELeave) CEikCapCLabel;
  2012         delete iCaptionText; // get rid of old iCaptionText
  1907         delete iCaptionText; // get rid of old iCaptionText
  2013         iCaptionText=0;
  1908         iCaptionText=0;
  2014         iCaptionText = aText.AllocL();
  1909         iCaptionText = aText.AllocL();
  2015         }
  1910         }
  2016         
  1911         
  2017     if (iCaption->DrawableWindow() == NULL)    
  1912     if (!iCaption->DrawableWindow())    
  2018         {
  1913         {
  2019         iCaption->SetContainerWindowL(*this);
  1914         iCaption->SetContainerWindowL(*this);
  2020         iCaption->CopyControlContextFrom(this);
  1915         iCaption->CopyControlContextFrom(this);
  2021         }
  1916         }
  2022 /*
  1917 /*
  2026 */
  1921 */
  2027     if (iIsFormControl)
  1922     if (iIsFormControl)
  2028         DoFormCaptionSettingsL(aText);
  1923         DoFormCaptionSettingsL(aText);
  2029     else
  1924     else
  2030         iCaption->SetTextL(aText);
  1925         iCaption->SetTextL(aText);
       
  1926     _AKNTRACE_FUNC_EXIT;
  2031     }
  1927     }
  2032 
  1928 
  2033 EXPORT_C void CEikCaptionedControl::SetDrawNoWhiteBackground(TBool aEnabled)
  1929 EXPORT_C void CEikCaptionedControl::SetDrawNoWhiteBackground(TBool aEnabled)
  2034     {
  1930     {
  2035     iExtension->iDrawNoWhiteBackground = aEnabled;
  1931     iExtension->iDrawNoWhiteBackground = aEnabled;
  2036     }
  1932     }
  2037 
  1933 
  2038 EXPORT_C void CEikCaptionedControl::SetTrailerL(const TDesC& aText)
  1934 EXPORT_C void CEikCaptionedControl::SetTrailerL(const TDesC& aText)
  2039     {
  1935     {
       
  1936     _AKNTRACE_FUNC_ENTER;
  2040     if (!aText.Length())
  1937     if (!aText.Length())
  2041         return;
  1938         return;
  2042     if (!iTrailer)
  1939     if (!iTrailer)
  2043         {
  1940         {
  2044         iTrailer=new(ELeave) CEikLabel;
  1941         iTrailer=new(ELeave) CEikLabel;
  2047         iTrailer->CopyControlContextFrom(this);
  1944         iTrailer->CopyControlContextFrom(this);
  2048         iTrailer->SetAllMarginsTo(1);
  1945         iTrailer->SetAllMarginsTo(1);
  2049         iTrailer->SetNonFocusing();
  1946         iTrailer->SetNonFocusing();
  2050         }
  1947         }
  2051     iTrailer->SetTextL(aText);
  1948     iTrailer->SetTextL(aText);
       
  1949     _AKNTRACE( "SetTextL = %s" , &aText); 
       
  1950     _AKNTRACE_FUNC_EXIT;
  2052     }
  1951     }
  2053 
  1952 
  2054 EXPORT_C void CEikCaptionedControl::SetCurrent(TBool aSelected)
  1953 EXPORT_C void CEikCaptionedControl::SetCurrent(TBool aSelected)
  2055     {
  1954     {
  2056     SetCurrent( aSelected, ETrue );
  1955     SetCurrent( aSelected, ETrue );
  2057     }
  1956     }
  2058 
  1957 
  2059 EXPORT_C void CEikCaptionedControl::ConstructFromResourceL(TResourceReader& aReader)
  1958 EXPORT_C void CEikCaptionedControl::ConstructFromResourceL(TResourceReader& aReader)
  2060     {
  1959     {
       
  1960     _AKNTRACE_FUNC_ENTER;
  2061     TPtrC capTextTPtrC = aReader.ReadTPtrC();
  1961     TPtrC capTextTPtrC = aReader.ReadTPtrC();
  2062     iCaptionText = capTextTPtrC.AllocL();
  1962     iCaptionText = capTextTPtrC.AllocL();
  2063     SetCaptionL(capTextTPtrC);
  1963     SetCaptionL(capTextTPtrC);
  2064     iId=aReader.ReadInt16();
  1964     iId=aReader.ReadInt16();
  2065     TInt itemFlags=aReader.ReadInt32();
  1965     TInt itemFlags=aReader.ReadInt32();
  2122 
  2022 
  2123     // Process ToolTip
  2023     // Process ToolTip
  2124     TPtrC16 toolTip = aReader.ReadTPtrC() ;
  2024     TPtrC16 toolTip = aReader.ReadTPtrC() ;
  2125     SetToolTipTextL( toolTip ) ; 
  2025     SetToolTipTextL( toolTip ) ; 
  2126     
  2026     
  2127     // Set the border spacing to the default value
       
  2128     SetVertEdgeSpacing( KCapCDefaultVertEdgeSpacing ) ;
       
  2129     SetHorzEdgeSpacing( KCapCDefaultHorzEdgeSpacing ) ;
       
  2130 
       
  2131     //Added to create new form box closer for edwins in forms.
  2027     //Added to create new form box closer for edwins in forms.
  2132     if (!iHighlightControl)
  2028     if (!iHighlightControl)
  2133         {
  2029         {
  2134         iHighlightControl = new(ELeave) CEikCaptionedControlFormHighlightLine( *this ) ;
  2030         iHighlightControl = new(ELeave) CEikCaptionedControlFormHighlightLine( *this ) ;
  2135         STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->ConstructL() ;
  2031         STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->ConstructL() ;
  2136         }
  2032         }
  2137     ConstructExtensionL() ;
  2033     ConstructExtensionL() ;
       
  2034     _AKNTRACE_FUNC_EXIT;
  2138     }
  2035     }
  2139 
  2036 
  2140 
  2037 
  2141 EXPORT_C void CEikCaptionedControl::SetBitmapFromFileL( const TDesC& aFilename,TInt aMainId,TInt aMaskId /*=-1*/ ) 
  2038 EXPORT_C void CEikCaptionedControl::SetBitmapFromFileL( const TDesC& aFilename,TInt aMainId,TInt aMaskId /*=-1*/ ) 
  2142     {
  2039     {
  2175         }
  2072         }
  2176     }
  2073     }
  2177 
  2074 
  2178 EXPORT_C void CEikCaptionedControl::ResetMinimumSizes()
  2075 EXPORT_C void CEikCaptionedControl::ResetMinimumSizes()
  2179     {
  2076     {
  2180     iMinSize.iWidth=0;
  2077 	_AKNTRACE_FUNC_ENTER;
  2181     iCaptionWidth=0;
  2078     iCaptionWidth=0;
  2182     iFullWidth=0;
  2079     _AKNTRACE_FUNC_EXIT;
  2183     }
  2080     }
  2184 
  2081 
  2185 EXPORT_C TBool CEikCaptionedControl::IsLatent() const
  2082 EXPORT_C TBool CEikCaptionedControl::IsLatent() const
  2186     {
  2083     {
  2187     return(iCapCFlags&ELatent);
  2084     return(iCapCFlags&ELatent);
  2262  *
  2159  *
  2263  * @since ER5U 
  2160  * @since ER5U 
  2264  */
  2161  */
  2265 EXPORT_C void CEikCaptionedControl::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const
  2162 EXPORT_C void CEikCaptionedControl::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const
  2266     {
  2163     {
       
  2164     _AKNTRACE_FUNC_ENTER;
  2267     CCoeControl::GetColorUseListL(aColorUseList);
  2165     CCoeControl::GetColorUseListL(aColorUseList);
  2268 
  2166 
  2269     TCoeColorUse colorUse;
  2167     TCoeColorUse colorUse;
  2270     colorUse.SetLogicalColor(EColorWindowText);
  2168     colorUse.SetLogicalColor(EColorWindowText);
  2271     colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EActive|TCoeColorUse::ESurrounds|TCoeColorUse::ENormal|TCoeColorUse::ENeutral);
  2169     colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EActive|TCoeColorUse::ESurrounds|TCoeColorUse::ENormal|TCoeColorUse::ENeutral);
  2272     aColorUseList.AppendL(colorUse);
  2170     aColorUseList.AppendL(colorUse);
  2273 
  2171 
  2274     const TInt count=CountComponentControls();
  2172     const TInt count=CountComponentControls();
  2275     for(TInt ii=0;ii<count;ii++)
  2173     for(TInt ii=0;ii<count;ii++)
  2276         ComponentControl(ii)->GetColorUseListL(aColorUseList);  
  2174         ComponentControl(ii)->GetColorUseListL(aColorUseList);  
       
  2175     _AKNTRACE_FUNC_EXIT;
  2277     }
  2176     }
  2278 
  2177 
  2279 /**
  2178 /**
  2280  * Handles a change to the control's resources of type aType
  2179  * Handles a change to the control's resources of type aType
  2281  * which are shared across the environment, e.g. colors or fonts.
  2180  * which are shared across the environment, e.g. colors or fonts.
  2282  *
  2181  *
  2283  * @since ER5U 
  2182  * @since ER5U 
  2284  */
  2183  */
  2285 EXPORT_C void CEikCaptionedControl::HandleResourceChange(TInt aType)
  2184 EXPORT_C void CEikCaptionedControl::HandleResourceChange(TInt aType)
  2286     {
  2185     {
       
  2186     _AKNTRACE_FUNC_ENTER;
       
  2187     _AKNTRACE( "[%s][%s][%d].", "CEikCaptionedControl", __FUNCTION__, aType );
  2287     CCoeControl::HandleResourceChange(aType);
  2188     CCoeControl::HandleResourceChange(aType);
  2288 
  2189 
  2289     // Animation is skin dependent, whenever skin changes animation changes
  2190     // Animation is skin dependent, whenever skin changes animation changes
  2290     // too.
  2191     // too.
  2291     if( KAknsMessageSkinChange == aType )
  2192     if( KAknsMessageSkinChange == aType )
  2305             {
  2206             {
  2306             iExtension->HandleLayoutSwitch( Rect().Size() );
  2207             iExtension->HandleLayoutSwitch( Rect().Size() );
  2307             }
  2208             }
  2308         DrawDeferred();
  2209         DrawDeferred();
  2309         }
  2210         }
       
  2211     _AKNTRACE_FUNC_EXIT;
  2310    }
  2212    }
  2311 
  2213 
  2312 
  2214 
  2313 /* Deactivated as requested in AISA-595AEZ
  2215 /* Deactivated as requested in AISA-595AEZ
  2314 */
  2216 */
  2317     {
  2219     {
  2318     }
  2220     }
  2319 
  2221 
  2320 EXPORT_C const TDesC* CEikCaptionedControl::ToolTipText() const 
  2222 EXPORT_C const TDesC* CEikCaptionedControl::ToolTipText() const 
  2321     {
  2223     {
  2322     if ( iToolTipText )
  2224     return NULL ;
  2323         return  iToolTipText ;
       
  2324     else
       
  2325         return NULL ;
       
  2326     }
  2225     }
  2327 
  2226 
  2328 /**
  2227 /**
  2329  * Writes the internal state of the control and its components to aStream.
  2228  * Writes the internal state of the control and its components to aStream.
  2330  * Does nothing in release mode.
  2229  * Does nothing in release mode.
  2380 EXPORT_C void CEikCaptionedControl::MCoeCaptionRetrieverForFep_Reserved_2()
  2279 EXPORT_C void CEikCaptionedControl::MCoeCaptionRetrieverForFep_Reserved_2()
  2381     {}
  2280     {}
  2382 
  2281 
  2383 EXPORT_C void CEikCaptionedControl::SetEditableL( TBool aEditable, TBool /*aShowEmptyFields*/ )
  2282 EXPORT_C void CEikCaptionedControl::SetEditableL( TBool aEditable, TBool /*aShowEmptyFields*/ )
  2384     {
  2283     {
       
  2284     _AKNTRACE_FUNC_ENTER;
       
  2285     _AKNTRACE( "CEikCaptionedControl::SetEditableL() aEditable: [%d]", aEditable );
  2385     // Construct extension object if needed
  2286     // Construct extension object if needed
  2386     ConstructExtensionL() ;
  2287     ConstructExtensionL() ;
  2387 
  2288 
  2388     // Animation is not run when editing
  2289     // Animation is not run when editing
  2389     if( iIsFormControl && iExtension->iAnimation && aEditable )
  2290     if( iIsFormControl && iExtension->iAnimation && aEditable )
  2454         ResetMinimumSizes() ;
  2355         ResetMinimumSizes() ;
  2455         LayoutSkinControlContexts();
  2356         LayoutSkinControlContexts();
  2456 		if (IsReadyToDraw())
  2357 		if (IsReadyToDraw())
  2457 			SizeChanged(); // needed because layout lines change when editable flag is switched.
  2358 			SizeChanged(); // needed because layout lines change when editable flag is switched.
  2458         }
  2359         }
  2459     }
  2360     _AKNTRACE_FUNC_EXIT;
  2460 
       
  2461 void CEikCaptionedControl::SetVertEdgeSpacing( TInt aVertEdgeSpacing ) 
       
  2462     {
       
  2463     iVertEdgeSpacing = aVertEdgeSpacing ;
       
  2464     }
       
  2465 
       
  2466 void CEikCaptionedControl::SetHorzEdgeSpacing( TInt aHorzEdgeSpacing ) 
       
  2467     {
       
  2468     iHorzEdgeSpacing = aHorzEdgeSpacing ;
       
  2469     }
  2361     }
  2470 
  2362 
  2471 /**
  2363 /**
  2472  * Avkon component positioning for Forms
  2364  * Avkon component positioning for Forms
  2473  */
  2365  */
  2474 
  2366 
  2475 void CEikCaptionedControl::PositionFormComponents()
  2367 void CEikCaptionedControl::PositionFormComponents()
  2476     {
  2368     {
  2477     if( iExtension->iPartiallyVisible )
  2369     _AKNTRACE_FUNC_ENTER;
       
  2370     MinimumSize() ;
       
  2371 
       
  2372     // if control has no height, return now (no point laying out)
       
  2373     if (!Rect().Height())  
  2478         return;
  2374         return;
       
  2375 
  2479     TBool isFocused = iIsCurrentLine;
  2376     TBool isFocused = iIsCurrentLine;
  2480     TBool isSingleLineLayout = ( FormLayout() == CEikDialogPage::ESingle);
  2377     TBool isSingleLineLayout = ( FormLayout() == CEikDialogPage::ESingle);
  2481     MinimumSize() ;
       
  2482     TBool hasBitmaps = ShowBitmap();
  2378     TBool hasBitmaps = ShowBitmap();
  2483     
       
  2484 /* 
       
  2485 if control has no height, return now (no point laying out)
       
  2486 */
       
  2487     if (!Rect().Height())  
       
  2488         return;
       
  2489 
       
  2490     TAknWindowLineLayout verticalLine = AKN_LAYOUT_WINDOW_List_pane_elements__single_heading__Line_1 ; 
  2379     TAknWindowLineLayout verticalLine = AKN_LAYOUT_WINDOW_List_pane_elements__single_heading__Line_1 ; 
  2491 
  2380 
  2492     // If double line layout update verticalLine
  2381     // If double line layout update verticalLine
  2493     if ( !isSingleLineLayout )
  2382     if ( !isSingleLineLayout )
  2494         {
  2383         {
  2513                 {
  2402                 {
  2514                 verticalLine = AKN_LAYOUT_WINDOW_List_pane_lines__A_column__Line_1(0);
  2403                 verticalLine = AKN_LAYOUT_WINDOW_List_pane_lines__A_column__Line_1(0);
  2515                 }
  2404                 }
  2516             }    
  2405             }    
  2517         }
  2406         }
  2518         TRect parentRect = Rect();
  2407 
  2519         TAknLayoutRect layoutRect;
  2408     TAknLayoutRect layoutRect;
  2520         layoutRect.LayoutRect( parentRect, verticalLine );
  2409     layoutRect.LayoutRect( Rect(), verticalLine );
  2521         TRect rectVerticalLine( layoutRect.Rect() );
  2410     TRect rectVerticalLine( layoutRect.Rect() );
  2522 
       
  2523 
  2411 
  2524     // set vertical line position.  
  2412     // set vertical line position.  
  2525     if ( AknLayoutUtils::LayoutMirrored() )
  2413     if ( AknLayoutUtils::LayoutMirrored() )
  2526         {
  2414         {
  2527         iVerticalLineXPosition = Rect().Width() - rectVerticalLine.iBr.iX;
  2415         iVerticalLineXPosition = Rect().Width() - rectVerticalLine.iBr.iX;
  2548 Each control type checks to see if it a user-defined control type is of that type, using the
  2436 Each control type checks to see if it a user-defined control type is of that type, using the
  2549 ConvertCustomControlTypeToBaseControlType mechanism so if the code gets here, the control is 
  2437 ConvertCustomControlTypeToBaseControlType mechanism so if the code gets here, the control is 
  2550 "none of the above".
  2438 "none of the above".
  2551 */
  2439 */
  2552         Panic(EEikFormPanicUnknownControlType);
  2440         Panic(EEikFormPanicUnknownControlType);
  2553         };
  2441         }
  2554 
       
  2555     //TRect layoutRectOfDataPane =(iIsEditable)? EditRect() : ViewRect();
       
  2556 
  2442 
  2557    //view and edit data pane rect should be the same
  2443    //view and edit data pane rect should be the same
  2558     TRect layoutRectOfDataPane = ViewRect();    
  2444     TRect layoutRectOfDataPane( Rect() );    
  2559 
  2445 
  2560     if ( hasBitmaps )
  2446     if ( hasBitmaps )
  2561         {
  2447         {
  2562         if (iBitmap)
  2448         if (iBitmap)
  2563             FormLayoutControlBitmap
  2449             FormLayoutControlBitmap
  2696         default:
  2582         default:
  2697             Panic(EEikFormPanicLayoutErrorUnknownControlType);  
  2583             Panic(EEikFormPanicLayoutErrorUnknownControlType);  
  2698         }
  2584         }
  2699         
  2585         
  2700     TRAP_IGNORE( SetElementTextColorsL(TRgb()));
  2586     TRAP_IGNORE( SetElementTextColorsL(TRgb()));
       
  2587     _AKNTRACE_FUNC_EXIT;
  2701     }
  2588     }
  2702 
  2589 
  2703 TBool CEikCaptionedControl::ShowBitmap() const
  2590 TBool CEikCaptionedControl::ShowBitmap() const
  2704     {
  2591     {
  2705     return (iFlags & EEikFormShowBitmaps);
  2592     return (iFlags & EEikFormShowBitmaps);
  2725         else
  2612         else
  2726             {
  2613             {
  2727             AknLayoutUtils::LayoutLabel( iCaption, aRect, R_AVKON_FORM_LABEL_NO_ICON ) ;
  2614             AknLayoutUtils::LayoutLabel( iCaption, aRect, R_AVKON_FORM_LABEL_NO_ICON ) ;
  2728             }
  2615             }
  2729         }
  2616         }
  2730     }
       
  2731 
       
  2732 TSize CEikCaptionedControl::EditorControlSize() const 
       
  2733     {
       
  2734     return iEditorControlSize ;
       
  2735     }
  2617     }
  2736 
  2618 
  2737 TInt CEikCaptionedControl::NumberOfLines() const
  2619 TInt CEikCaptionedControl::NumberOfLines() const
  2738 	{
  2620 	{
  2739 	return iNumberOfLines;
  2621 	return iNumberOfLines;
  2740 	}
  2622 	}
  2741 
  2623 
  2742 TInt CEikCaptionedControl::NumberOfLinesForScrollBar() const
       
  2743 	{
       
  2744 	if ( FormLayout() == CEikDialogPage::ESingle ) return NumberOfLines();
       
  2745 	return NumberOfLines()+1;
       
  2746 	}
       
  2747 
       
  2748 /**
  2624 /**
  2749  * Recalculates the number of required lines for a control.
  2625  * Recalculates the number of required lines for a control.
  2750  */
  2626  */
  2751 void CEikCaptionedControl::CalculateNumberOfLinesForControl( TInt aLines )
  2627 void CEikCaptionedControl::CalculateNumberOfLinesForControl( TInt aLines )
  2752     {
  2628     {
       
  2629 	_AKNTRACE_FUNC_ENTER;
  2753     // NB if new control types are added, ones which should be invisible in view mode
  2630     // NB if new control types are added, ones which should be invisible in view mode
  2754     // should be also added to IsDisplayable().
  2631     // should be also added to IsDisplayable().
  2755     if ( aLines == ENotSupplied )
  2632     if ( aLines == ENotSupplied )
  2756         {
  2633         {
  2757         // Function has to be aware of edit/view state.  
  2634         // Function has to be aware of edit/view state.  
  2803             else
  2680             else
  2804                 aLines=1;
  2681                 aLines=1;
  2805             }
  2682             }
  2806         }
  2683         }
  2807     iNumberOfLines = aLines ;
  2684     iNumberOfLines = aLines ;
       
  2685     _AKNTRACE( "iNumberOfLines: [%d]", iNumberOfLines );
       
  2686     _AKNTRACE_FUNC_EXIT;
  2808     }
  2687     }
  2809 
  2688 
  2810 EXPORT_C void CEikCaptionedControl::SetFormFlags( TInt aFlags ) 
  2689 EXPORT_C void CEikCaptionedControl::SetFormFlags( TInt aFlags ) 
  2811     {
  2690     {
  2812     iFlags = aFlags ;
  2691     iFlags = aFlags ;
  2841     
  2720     
  2842     if(ControlIsAnEdwin(iControlType))
  2721     if(ControlIsAnEdwin(iControlType))
  2843         {
  2722         {
  2844         AknLayoutUtils::OverrideControlColorL(*this, EColorControlText, textColor );
  2723         AknLayoutUtils::OverrideControlColorL(*this, EColorControlText, textColor );
  2845         }
  2724         }
  2846     
  2725     }
  2847     }
  2726 
  2848 
       
  2849 /**
       
  2850  * Retrieves the Series 60 European LAF layout values from avkon.rh
       
  2851  *
       
  2852  */
       
  2853 void CEikCaptionedControl::GetAknLayoutValuesL()
       
  2854     {
       
  2855     TAknWindowLineLayout l = AknLayoutScalable_Avkon::form_field_data_pane(0).LayoutLine();
       
  2856     TRect parentRect = iAvkonAppUi->ClientRect();
       
  2857     TAknLayoutRect layoutRect;
       
  2858     layoutRect.LayoutRect( parentRect, l );
       
  2859     TRect rectDataPane( layoutRect.Rect() );
       
  2860 
       
  2861     iAknFormControlWidth = rectDataPane.Width();
       
  2862     iAknFormControlHeight = rectDataPane.Height();
       
  2863    }
       
  2864 
       
  2865     
       
  2866 
  2727 
  2867 TBool   CEikCaptionedControl::IsDisplayable() const
  2728 TBool   CEikCaptionedControl::IsDisplayable() const
  2868     {
  2729     {
  2869 /*
  2730 /*
  2870 Added to provide whether the control should be displayed without calls to minimumsize.
  2731 Added to provide whether the control should be displayed without calls to minimumsize.
  2927         case EEikCtNumberEditor:
  2788         case EEikCtNumberEditor:
  2928         case EAknCtLocationEditor:
  2789         case EAknCtLocationEditor:
  2929         case EAknCtUnitEditor:
  2790         case EAknCtUnitEditor:
  2930             return ETrue;
  2791             return ETrue;
  2931         }
  2792         }
  2932     TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
  2793     if (iDialogPage)
  2933     if (typeOfControlToLayout==MEikDialogPageObserver::EMfneDerived)
  2794         {
  2934         return ETrue;
  2795 	    TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
       
  2796         if (typeOfControlToLayout==MEikDialogPageObserver::EMfneDerived)
       
  2797             return ETrue;
       
  2798         }
  2935     return EFalse;
  2799     return EFalse;
  2936     }
  2800     }
  2937 
  2801 
  2938 TBool CEikCaptionedControl::ControlIsAPopfield(TInt aControlType) const 
  2802 TBool CEikCaptionedControl::ControlIsAPopfield(TInt aControlType) const 
  2939     {
  2803     {
  2962         {
  2826         {
  2963         case EEikCtSecretEd:
  2827         case EEikCtSecretEd:
  2964         case EAknCtNumericSecretEditor:
  2828         case EAknCtNumericSecretEditor:
  2965             return ETrue;
  2829             return ETrue;
  2966         }
  2830         }
  2967     TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
  2831     if (iDialogPage)
  2968     if (typeOfControlToLayout==MEikDialogPageObserver::ESecretEditorDerived)
  2832         {
  2969         return ETrue;
  2833         TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
       
  2834         if (typeOfControlToLayout==MEikDialogPageObserver::ESecretEditorDerived)
       
  2835             return ETrue;
       
  2836         }
  2970     return EFalse;
  2837     return EFalse;
  2971     }
  2838     }
  2972 
  2839 
  2973 TBool CEikCaptionedControl::ControlIsASlider(TInt aControlType) const 
  2840 TBool CEikCaptionedControl::ControlIsASlider(TInt aControlType) const 
  2974     {
  2841     {
  2977     switch (aControlType)
  2844     switch (aControlType)
  2978         {
  2845         {
  2979         case EAknCtSlider :
  2846         case EAknCtSlider :
  2980             return ETrue;
  2847             return ETrue;
  2981         }
  2848         }
  2982     TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
  2849     if (iDialogPage)
  2983     if (typeOfControlToLayout==MEikDialogPageObserver::ESliderDerived)
  2850         {
  2984         return ETrue;
  2851         TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
       
  2852         if (typeOfControlToLayout==MEikDialogPageObserver::ESliderDerived)
       
  2853             return ETrue;
       
  2854         }
  2985     return EFalse;
  2855     return EFalse;
  2986     }
  2856     }
  2987 
  2857 
  2988 //------------------------------------------------------------------------
  2858 //------------------------------------------------------------------------
  2989 // CEikCaptionedControl::ControlIsAColourSelGrid
  2859 // CEikCaptionedControl::ControlIsAColourSelGrid
  2998         case EAknCtColourSelectionDialogGrid :   // Deprecated
  2868         case EAknCtColourSelectionDialogGrid :   // Deprecated
  2999         case EAknCtColourSelectionGridDialog :
  2869         case EAknCtColourSelectionGridDialog :
  3000         case EAknCtColourSelectionDialogNoneField:
  2870         case EAknCtColourSelectionDialogNoneField:
  3001             return ETrue;
  2871             return ETrue;
  3002         }
  2872         }
  3003     TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
  2873     if (iDialogPage)
  3004     if (typeOfControlToLayout==MEikDialogPageObserver::EColourSelectionGridDerived)
  2874         {
  3005         return ETrue;
  2875         TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
       
  2876         if (typeOfControlToLayout==MEikDialogPageObserver::EColourSelectionGridDerived)
       
  2877             return ETrue;
       
  2878         }
  3006     return EFalse;
  2879     return EFalse;
  3007     }  
  2880     }  
  3008  
  2881  
  3009 void CEikCaptionedControl::DoFormCaptionSettingsL(const TDesC& aText)
  2882 void CEikCaptionedControl::DoFormCaptionSettingsL(const TDesC& aText)
  3010     {
  2883     {
  3017 
  2890 
  3018 
  2891 
  3019 EXPORT_C const TPtrC CEikCaptionedControl::GetFullCaptionText() const
  2892 EXPORT_C const TPtrC CEikCaptionedControl::GetFullCaptionText() const
  3020     {
  2893     {
  3021     return *iCaptionText;
  2894     return *iCaptionText;
  3022     };
  2895     }
  3023 
  2896 
  3024 void CEikCaptionedControl::RegisterPageWithCaptionControl(CEikDialogPage* aPage)
  2897 void CEikCaptionedControl::RegisterPageWithCaptionControl(CEikDialogPage* aPage)
  3025     {
  2898     {
  3026     iDialogPage=aPage;
  2899     iDialogPage=aPage;
  3027     };
  2900     }
  3028 
  2901 
  3029 TInt CEikCaptionedControl::MaximumNumberOfControlLinesOnVisiblePage() const
  2902 TInt CEikCaptionedControl::MaximumNumberOfControlLinesOnVisiblePage() const
  3030     {
  2903     {
       
  2904 	_AKNTRACE_FUNC_ENTER;
  3031 	TInt maxItems = 0;
  2905 	TInt maxItems = 0;
  3032 	TAknLayoutScalableParameterLimits paneLimits;
  2906 	TAknLayoutScalableParameterLimits paneLimits;
  3033 	if (IsPopupField(this))
  2907 	if (IsPopupField(this))
  3034     	{
  2908     	{
  3035         if (iDialogPage&& CEikDialogPage::EDouble == iDialogPage->FormLayout())
  2909         if (iDialogPage&& CEikDialogPage::EDouble == iDialogPage->FormLayout())
  3068         TInt defineHeight = static_cast<CEikEdwin*>( iControl )->MaximumHeightInLines();
  2942         TInt defineHeight = static_cast<CEikEdwin*>( iControl )->MaximumHeightInLines();
  3069         if ( defineHeight && defineHeight < maxItems )
  2943         if ( defineHeight && defineHeight < maxItems )
  3070             return defineHeight;
  2944             return defineHeight;
  3071         }
  2945         }
  3072 	//maxItems -= 1; // TODO: this is a temporary workaround for layout data being incorrect, it has too many options available
  2946 	//maxItems -= 1; // TODO: this is a temporary workaround for layout data being incorrect, it has too many options available
       
  2947     _AKNTRACE( "maxItems: [%d]", maxItems );
       
  2948     _AKNTRACE_FUNC_EXIT;
  3073     return maxItems;
  2949     return maxItems;
  3074     };
  2950     }
  3075 
  2951 
  3076 
       
  3077 TRect CEikCaptionedControl::ViewRect() const
       
  3078 
       
  3079     {
       
  3080 /* 
       
  3081 The Rect that the view mode is expecting is:
       
  3082 176 across 
       
  3083 21 high
       
  3084 set from 0,0
       
  3085 
       
  3086 We are
       
  3087 174 across
       
  3088 23 high
       
  3089 set from (1,1) relative to viewwin.
       
  3090 
       
  3091 To convert we must:
       
  3092 * Shrink(-1,1) to make Y cord and size equal, and X coord equal.
       
  3093 * add 1 to the BR X coord. to make X size equal.
       
  3094 */
       
  3095     TRect viewRectConversion(EditRect());
       
  3096     viewRectConversion.Shrink(0,1);
       
  3097     return viewRectConversion;
       
  3098     }
       
  3099 
       
  3100 TRect CEikCaptionedControl::EditRect() const
       
  3101     {
       
  3102     //The Rect provided by Rect() is fine  
       
  3103     return Rect();
       
  3104     } 
       
  3105 
  2952 
  3106 void CEikCaptionedControl::FormLayoutControlBitmap(CEikImage* aBitmap, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines)
  2953 void CEikCaptionedControl::FormLayoutControlBitmap(CEikImage* aBitmap, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines)
  3107     {   
  2954     {   
  3108     if (!aNumberOfLines)
  2955     if (!aNumberOfLines)
  3109         return;
  2956         return;
  3249         AknLayoutUtils::LayoutEdwin( aEdwin, layoutRect, textLayout,
  3096         AknLayoutUtils::LayoutEdwin( aEdwin, layoutRect, textLayout,
  3250                                      colorIndex, 0, ETrue );
  3097                                      colorIndex, 0, ETrue );
  3251     	SetScrollRect(aEdwin, layoutRect, textLayout, aNumberOfLines);
  3098     	SetScrollRect(aEdwin, layoutRect, textLayout, aNumberOfLines);
  3252 	    }
  3099 	    }
  3253 
  3100 
  3254 	TBool isviewmode = !aIsEditable;
  3101 	aEdwin->SetSuppressBackgroundDrawing(!aIsEditable);
  3255 	aEdwin->SetSuppressBackgroundDrawing(isviewmode);
       
  3256     }
  3102     }
  3257 
  3103 
  3258 
  3104 
  3259 // Labels
  3105 // Labels
  3260 void CEikCaptionedControl::FormLayoutControlLabel(
  3106 void CEikCaptionedControl::FormLayoutControlLabel(
  3273     TAknTextLineLayout textLayout( AKN_LAYOUT_TEXT_Form_data_field_texts_Line_1(bitmap,0) );
  3119     TAknTextLineLayout textLayout( AKN_LAYOUT_TEXT_Form_data_field_texts_Line_1(bitmap,0) );
  3274     
  3120     
  3275     // Layout the label for the single line format
  3121     // Layout the label for the single line format
  3276     if (aSingleLayout) 
  3122     if (aSingleLayout) 
  3277         {
  3123         {
  3278         if (aIsEditable)
  3124         if (!aIsEditable)
  3279             {
       
  3280             // Do nothing; this is the default used
       
  3281             }
       
  3282         else
       
  3283             {
  3125             {
  3284             // This layout is dy
  3126             // This layout is dy
  3285             if (aBitmapPresent)
  3127             if (aBitmapPresent)
  3286                 {
  3128                 {
  3287                 TAknTextLineLayout anotherTextLayout(AKN_LAYOUT_TEXT_List_pane_texts__single_graphic_heading__Line_1(0) );
  3129                 TAknTextLineLayout anotherTextLayout(AKN_LAYOUT_TEXT_List_pane_texts__single_graphic_heading__Line_1(0) );
  3420 void CEikCaptionedControl::FormLayoutControlPopfield(
  3262 void CEikCaptionedControl::FormLayoutControlPopfield(
  3421         CAknPopupField* aPopfield, const TRect& aParent, TBool aIsEditable,
  3263         CAknPopupField* aPopfield, const TRect& aParent, TBool aIsEditable,
  3422         TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent,
  3264         TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent,
  3423         TBool /*aIsFocused*/)
  3265         TBool /*aIsFocused*/)
  3424     {
  3266     {
  3425     TRect layoutRect = aParent;
  3267     TRect layoutRect( aParent );
  3426     TAknWindowLineLayout layoutData(AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1));
  3268     TAknWindowLineLayout layoutData(AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1));
  3427 	TAknTextLineLayout labelLayout(AknLayout::Form_data_field_texts_Line_2(0));
  3269 	TAknTextLineLayout labelLayout(AknLayout::Form_data_field_texts_Line_2(0));
  3428     if (!aNumberOfLines)
  3270     if (!aNumberOfLines)
  3429         return;
  3271         return;
  3430     
  3272     
  3443     TBool isText = EFalse;
  3285     TBool isText = EFalse;
  3444 	if (aPopfield->SelectionMode() == CAknPopupField::EAknPopupFieldLabelMode)
  3286 	if (aPopfield->SelectionMode() == CAknPopupField::EAknPopupFieldLabelMode)
  3445 		{
  3287 		{
  3446 		isText = ETrue;
  3288 		isText = ETrue;
  3447 		}
  3289 		}
  3448  
  3290 	
  3449     if (aSingleLayout)
  3291     if (aSingleLayout)
  3450         {
  3292         {
  3451         if (aIsEditable)
  3293         layoutData=AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1);
  3452             {
       
  3453             layoutData=AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1);
       
  3454             }
       
  3455         else
       
  3456             {
       
  3457 /* 
       
  3458 popupfields not specified in lists.  
       
  3459 Have to convert aParent to form equivalent and use that layout.
       
  3460 */
       
  3461             ConvertViewRectToEditRect(layoutRect);
       
  3462             layoutData=AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1);
       
  3463             }
       
  3464         }
  3294         }
  3465     else  // double layout
  3295     else  // double layout
  3466         {
  3296         {
  3467         TInt newpar = ( aBitmapPresent ? 1 : 0 ) ;
  3297         TInt newpar = ( aBitmapPresent ? 1 : 0 ) ;
  3468         if (!aBitmapPresent)
  3298         layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
  3469             {
  3299 
  3470             if (aIsEditable)
  3300         if ( aBitmapPresent && !aIsEditable )
  3471                 {
  3301             {
  3472                 layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
  3302             //move bitmap's width for display second line text
  3473                 }
  3303             TAknWindowLineLayout l = AknLayout::List_pane_elements__single_graphic_heading__Line_1();
  3474             else
  3304             TAknLayoutRect bmpRect;
  3475                 {
  3305             TRect tempRect;
  3476                 // have to convert Rect before doing this.
  3306             bmpRect.LayoutRect( tempRect, l );
  3477                 ConvertViewRectToEditRect(layoutRect);
  3307             layoutRect.iTl.iX += bmpRect.Rect().Width();
  3478                 layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
  3308             }
  3479                 }
  3309         }
  3480             }
       
  3481         else //AKN_LAYOUT_WINDOW_list_form_graphic_wide_pane
       
  3482             {
       
  3483             if (aIsEditable)
       
  3484                 {
       
  3485                 layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
       
  3486                 }
       
  3487             else
       
  3488                 {
       
  3489                 // have to convert Rect before doing this.
       
  3490                 ConvertViewRectToEditRect(layoutRect);
       
  3491                 layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
       
  3492 				//move bitmap's width for display second line text
       
  3493 		        TAknWindowLineLayout l = AknLayout::List_pane_elements__single_graphic_heading__Line_1();
       
  3494 		        TAknLayoutRect bmpRect;
       
  3495 		        TRect tempRect;
       
  3496 		        bmpRect.LayoutRect( tempRect, l );
       
  3497 				layoutRect.iTl.iX += bmpRect.Rect().Width();
       
  3498                 }
       
  3499             }
       
  3500         };
       
  3501 	aPopfield->SetFormFieldRect(layoutRect);
  3310 	aPopfield->SetFormFieldRect(layoutRect);
  3502 	if (isText)
  3311 	if (isText)
  3503 		{ // popup field will be same size as text element
  3312 		{ // popup field will be same size as text element
  3504 		TAknLayoutText r;
  3313 		TAknLayoutText r;
  3505 		r.LayoutText(layoutRect, labelLayout);
  3314 		r.LayoutText(layoutRect, labelLayout);
  3506 		TRect resultRect = r.TextRect();
  3315 		TRect resultRect( r.TextRect() );
  3507 		aPopfield->SetRect(resultRect);
  3316 		aPopfield->SetRect(resultRect);
  3508 		}
  3317 		}
  3509 	else
  3318 	else
  3510 		{ // popup field will be same size as list_pane
  3319 		{ // popup field will be same size as list_pane
  3511 	    AknLayoutUtils::LayoutControl
  3320 	    AknLayoutUtils::LayoutControl
  3526         if (error == KErrNone )
  3335         if (error == KErrNone )
  3527             {
  3336             {
  3528             TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *aPopfield, EColorLabelText, textColor ) ); 
  3337             TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *aPopfield, EColorLabelText, textColor ) ); 
  3529             }          
  3338             }          
  3530         }
  3339         }
  3531         
       
  3532     }
  3340     }
  3533 
  3341 
  3534 // Password editor
  3342 // Password editor
  3535 void CEikCaptionedControl::FormLayoutControlSecretEditor(
  3343 void CEikCaptionedControl::FormLayoutControlSecretEditor(
  3536         CEikSecretEditor* aSecretEd, const TRect& aParent, TBool aIsEditable,
  3344         CEikSecretEditor* aSecretEd, const TRect& aParent, TBool aIsEditable,
  3598 // Slider control
  3406 // Slider control
  3599 void CEikCaptionedControl::FormLayoutControlSlider(CAknSlider* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool /*aBitmapPresent*/)
  3407 void CEikCaptionedControl::FormLayoutControlSlider(CAknSlider* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool /*aBitmapPresent*/)
  3600     {   
  3408     {   
  3601     if (!aNumberOfLines)
  3409     if (!aNumberOfLines)
  3602         return;
  3410         return;
  3603     if (aSingleLayout)
  3411     
  3604         {
  3412     TRect parentRect( aParent );
  3605         if (aIsEditable)
  3413     
  3606             {
  3414     if ( !aSingleLayout )
  3607             aSlider->SetRect(aParent);
       
  3608             }
       
  3609         else
       
  3610             {
       
  3611 /* 
       
  3612 sliders not specified in lists.  
       
  3613 Have to convert aParent to form equivalent and use that layout.
       
  3614 */
       
  3615             TRect conversionRect(aParent);
       
  3616             ConvertViewRectToEditRect(conversionRect);
       
  3617             aSlider->SetRect(conversionRect);
       
  3618             }
       
  3619         }
       
  3620     else 
       
  3621         {
  3415         {
  3622         // Not currently specified, so making temporary alterations here.
  3416         // Not currently specified, so making temporary alterations here.
  3623         TInt baselineSkip= AKN_LAYOUT_MULTILINE_TEXT_Form_data_field_texts_Line_2(1).BaselineSkip();
  3417         TInt baselineSkip = AKN_LAYOUT_MULTILINE_TEXT_Form_data_field_texts_Line_2(1).BaselineSkip();
  3624         TRect newParentRect(aParent);
  3418 
  3625         //Only move the rect will cover a part or next dialogline, so decrease height of rect form iTl.
  3419         // Only move the rect will cover a part or next dialogline, so decrease height of rect form iTl.
  3626         if( !aIsEditable )
  3420         if( !aIsEditable )
  3627 	        {
  3421 	        {
  3628 	        newParentRect.iTl.iX += baselineSkip;          	
  3422             parentRect.iTl.iX += baselineSkip;          	
  3629 	        }
  3423 	        }
  3630         newParentRect.iTl.iY += baselineSkip;
  3424         
  3631             
  3425         parentRect.iTl.iY += baselineSkip;
  3632         if (aIsEditable)
  3426         }
  3633             {
  3427     
  3634             aSlider->SetRect(newParentRect);
  3428     aSlider->SetRect( parentRect );
  3635             }
  3429     }
  3636         else 
  3430 
  3637             {
       
  3638             TRect conversionRect(newParentRect);
       
  3639             ConvertViewRectToEditRect(conversionRect);
       
  3640             aSlider->SetRect(conversionRect);
       
  3641             }
       
  3642         }   
       
  3643 
       
  3644         // Exteded skin support for sliders coded in slider file: \s60\AvKon\src\Aknslider.cpp
       
  3645     }
       
  3646 
       
  3647 void CEikCaptionedControl::ConvertViewRectToEditRect(TRect& aRect)
       
  3648     {
       
  3649     aRect.Grow(-1,1);
       
  3650     aRect.iBr.iX--;
       
  3651     }
       
  3652 
       
  3653 void CEikCaptionedControl::ConvertEditRectToViewRect(TRect& aRect)
       
  3654     {
       
  3655     aRect.Shrink(-1,1);
       
  3656     aRect.iBr.iX++;
       
  3657     }
       
  3658 
  3431 
  3659 // Standard access method for the form layout from within captioned control
  3432 // Standard access method for the form layout from within captioned control
  3660 CEikDialogPage::TFormLayoutSelection CEikCaptionedControl::FormLayout() const
  3433 CEikDialogPage::TFormLayoutSelection CEikCaptionedControl::FormLayout() const
  3661     {
  3434     {
  3662     // There is no undefined style, but initialize to single...
  3435     // There is no undefined style, but initialize to single...
  3663     CEikDialogPage::TFormLayoutSelection ret = CEikDialogPage::ESingle;
  3436     CEikDialogPage::TFormLayoutSelection ret = CEikDialogPage::ESingle;
  3664     if ( iDialogPage )
  3437     if ( iDialogPage )
       
  3438         {
  3665         ret = iDialogPage->FormLayout();
  3439         ret = iDialogPage->FormLayout();
  3666     
  3440         }
  3667     if (!iDialogPage)
  3441     else if (iFlags & EEikFormUseDoubleSpacedFormat) // similar to CEikDialogPage::ConstructFormFromResourceL()
  3668         {
  3442         {
  3669         if (iFlags & EEikFormUseDoubleSpacedFormat) // similar to CEikDialogPage::ConstructFormFromResourceL()
  3443         ret = CEikDialogPage::EDouble;
  3670             ret = CEikDialogPage::EDouble;
       
  3671         }
  3444         }
  3672     return ret;
  3445     return ret;
  3673     }
  3446     }
  3674 
  3447 
  3675 void CEikCaptionedControl::DrawFormSeparator( CWindowGc& gc ) const
  3448 void CEikCaptionedControl::DrawFormSeparator( CWindowGc& gc ) const
  3677     TAknLayoutRect sepLineRect;
  3450     TAknLayoutRect sepLineRect;
  3678     if ( FormLayout() == CEikDialogPage::ESingle )
  3451     if ( FormLayout() == CEikDialogPage::ESingle )
  3679         {
  3452         {
  3680         sepLineRect.LayoutRect
  3453         sepLineRect.LayoutRect
  3681             (
  3454             (
  3682             ViewRect(), 
  3455             Rect(), 
  3683             AKN_LAYOUT_WINDOW_List_pane_elements__single_heading__Line_2
  3456             AKN_LAYOUT_WINDOW_List_pane_elements__single_heading__Line_2
  3684             );
  3457             );
  3685         sepLineRect.DrawRect(gc);
  3458         sepLineRect.DrawRect(gc);
  3686 
  3459         }
  3687         }
       
  3688 //  else
       
  3689 //      {
       
  3690 // Currently no LAF specification for separator in double mode
       
  3691 //      sepLineRect.LayoutRect
       
  3692 //          (
       
  3693 //          ViewRect(), 
       
  3694 //          AKN_LAYOUT_WINDOW_List_pane_elements__double_graphic__Line_??
       
  3695 //          );
       
  3696 //      sepLineRect.DrawRect(gc);
       
  3697 //
       
  3698 //      }
       
  3699     }
  3460     }
  3700 
  3461 
  3701 void CEikCaptionedControl::DrawClosingLine() const
  3462 void CEikCaptionedControl::DrawClosingLine() const
  3702     {
  3463     {
  3703     if (iHighlightControl)
  3464     if (iHighlightControl)
  3779         iExtension->iEditModeHighlightControlContextPressed->SetParentContext(
  3540         iExtension->iEditModeHighlightControlContextPressed->SetParentContext(
  3780             GetDialogControlContext( iDialogPage ) );
  3541             GetDialogControlContext( iDialogPage ) );
  3781         }
  3542         }
  3782     else
  3543     else
  3783         {
  3544         {
  3784         outerRect = ViewRect() ;
       
  3785         innerRect = outerRect ;
       
  3786         innerRect.iTl = ViewFrameTopLeftRect( outerRect ).iBr ;
  3545         innerRect.iTl = ViewFrameTopLeftRect( outerRect ).iBr ;
  3787         innerRect.iBr = ViewFrameBottomRightRect( outerRect ).iTl ;
  3546         innerRect.iBr = ViewFrameBottomRightRect( outerRect ).iTl ;
  3788         iExtension->iViewModeHighlightControlContext->SetFrameRects( outerRect, innerRect );
  3547         iExtension->iViewModeHighlightControlContext->SetFrameRects( outerRect, innerRect );
  3789         iExtension->iViewModeHighlightControlContext->SetParentContext(
  3548         iExtension->iViewModeHighlightControlContext->SetParentContext(
  3790             GetDialogControlContext( iDialogPage ) );
  3549             GetDialogControlContext( iDialogPage ) );
  3809     }
  3568     }
  3810     
  3569     
  3811 void CEikCaptionedControl::DrawAsSkinnedForm( CWindowGc& aGc, const TRect& /*aRect*/ ) const
  3570 void CEikCaptionedControl::DrawAsSkinnedForm( CWindowGc& aGc, const TRect& /*aRect*/ ) const
  3812     {
  3571     {
  3813     MAknsSkinInstance* skin = AknsUtils::SkinInstance() ;
  3572     MAknsSkinInstance* skin = AknsUtils::SkinInstance() ;
       
  3573     TRgb textColor( KRgbBlack );
       
  3574     GetColor( EColorLabelText, textColor );
  3814 
  3575 
  3815     if ( !iIsCurrentLine )
  3576     if ( !iIsCurrentLine )
  3816         {
  3577         {
       
  3578         AknListUtils::DrawSeparator( aGc, Rect(), textColor, skin );
  3817         aGc.SetBrushStyle( CGraphicsContext::ENullBrush ) ; 
  3579         aGc.SetBrushStyle( CGraphicsContext::ENullBrush ) ; 
  3818         }
  3580         }
  3819     else // Highlight Skinning.  Requires Frame
  3581     else // Highlight Skinning.  Requires Frame
  3820         {
  3582         {
       
  3583         TRect outerRect( Rect() );
       
  3584         TRect innerRect( outerRect );
       
  3585         
  3821         if ( iIsEditable )
  3586         if ( iIsEditable )
  3822             {
  3587             {
  3823             TRect innerRect( EditRect() ) ;
  3588             innerRect.iTl = EditFrameTopLeftRect( outerRect ).iBr ;
  3824             innerRect.iTl = EditFrameTopLeftRect( Rect() ).iBr ;
  3589             innerRect.iBr = EditFrameBottomRightRect( outerRect ).iTl ;
  3825             innerRect.iBr = EditFrameBottomRightRect( Rect() ).iTl ;
       
  3826 
  3590 
  3827             MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ; 
  3591             MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ; 
  3828             AknsDrawUtils::Background( skin, parentCc, this, aGc, Rect() ) ;
  3592             AknsDrawUtils::Background( skin, parentCc, this, aGc, outerRect ) ;
  3829 
  3593 
       
  3594             AknListUtils::DrawSeparator( aGc, outerRect, textColor, skin );
       
  3595             
  3830             // Set the rectangle(s) for the Frame context
  3596             // Set the rectangle(s) for the Frame context
  3831             iExtension->iEditModeHighlightControlContext->SetFrameRects( EditRect(), innerRect ) ;
  3597             iExtension->iEditModeHighlightControlContext->SetFrameRects( outerRect, innerRect ) ;
  3832             iExtension->iEditModeHighlightControlContextPressed->SetFrameRects( EditRect(), innerRect ) ;
  3598             iExtension->iEditModeHighlightControlContextPressed->SetFrameRects( outerRect, innerRect ) ;
  3833             
  3599             
  3834             AknsDrawUtils::DrawFrame( skin, aGc, EditRect(), innerRect,
  3600             AknsDrawUtils::DrawFrame( skin, aGc, outerRect, innerRect,
  3835                                       PressedDownState() ?
  3601                                       PressedDownState() ?
  3836                                       KAknsIIDQsnFrListPressed : KAknsIIDQsnFrInput, KAknsIIDDefault );
  3602                                       KAknsIIDQsnFrListPressed : KAknsIIDQsnFrInput, KAknsIIDDefault );
  3837             }
  3603             }
  3838         else // View Mode highlight
  3604         else // View Mode highlight
  3839             {
  3605             {
  3840             TBool drawOk = EFalse;
  3606             TBool drawOk = EFalse;
  3841             if( iExtension->IsHighlightAnimated() ) // Draw animated highlight
  3607             innerRect.iTl = ViewFrameTopLeftRect( outerRect ).iBr;
  3842                 {
  3608             innerRect.iBr = ViewFrameBottomRightRect( outerRect ).iTl ;
  3843                 CAknsEffectAnim* anim = iExtension->iAnimation->Animation();
  3609     
  3844 
  3610             // The bit around the outside must use the parent's control context
  3845                 // TODO: Background is drawn first to prevent white stripes
  3611             MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage );
  3846                 // appearing above and below the highlight. Wasting resources
  3612             AknsDrawUtils::Background( skin, parentCc, this, aGc, outerRect ) ;
  3847                 // here, you could create animation that is a tad bigger and
  3613     
  3848                 // remove background drawing from here.
  3614             AknListUtils::DrawSeparator( aGc, outerRect, textColor, skin );
  3849                 TRect viewRect = ViewRect() ;
  3615 
  3850                 TRect innerRect( viewRect ) ;
  3616             // Draw the animation itself
  3851                 innerRect.iTl = ViewFrameTopLeftRect( viewRect ).iBr ;
  3617             if ( iExtension->IsHighlightAnimated() 
  3852                 innerRect.iTl.iX-- ; innerRect.iTl.iY-- ;  // not sure why this adjustment is required here and not above.
  3618                     && iExtension->iAnimation->Animation() )
  3853                 innerRect.iBr = ViewFrameBottomRightRect( viewRect ).iTl ;
  3619                 {
  3854 
  3620                 drawOk = iExtension->iAnimation->Animation()->Render( aGc, 
  3855                 // The bit around the outside must use the parent's control context
  3621                         outerRect );
  3856                 MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ;
  3622                 }
  3857                 AknsDrawUtils::BackgroundBetweenRects( skin, parentCc, this, aGc, Rect() , innerRect ) ;
  3623     
  3858 
  3624             if ( !drawOk )
  3859                 // Draw the animation itself
  3625                 {
  3860                 if( anim )
       
  3861                     {
       
  3862                     drawOk = anim->Render( aGc, ViewRect() );
       
  3863                     }
       
  3864                 }
       
  3865 
       
  3866             if( !drawOk )
       
  3867                 {
       
  3868                 // Code for skinning Highlight ( Using AVKON LAF highlight in place of
       
  3869                 // Skins LAF to establish highlight outer rect )
       
  3870                 TRect viewRect = ViewRect() ;
       
  3871                 TRect innerRect( viewRect ) ;
       
  3872                 innerRect.iTl = ViewFrameTopLeftRect( viewRect ).iBr ;
       
  3873                 innerRect.iTl.iX-- ; innerRect.iTl.iY-- ;  // not sure why this adjustment is required here and not above.
       
  3874                 innerRect.iBr = ViewFrameBottomRightRect( viewRect ).iTl ;
       
  3875 
       
  3876                 // The bit around the outside must use the parent's control context
       
  3877                 MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ;
       
  3878                 AknsDrawUtils::BackgroundBetweenRects( skin, parentCc, this, aGc, Rect() , innerRect ) ;
       
  3879 
       
  3880                 // Set the rectangle(s) for the Frame context
  3626                 // Set the rectangle(s) for the Frame context
  3881                 iExtension->iViewModeHighlightControlContext->SetFrameRects( viewRect, innerRect ) ;
  3627                 iExtension->iViewModeHighlightControlContext->SetFrameRects( 
  3882                 iExtension->iViewModeHighlightControlContextPressed->SetFrameRects( viewRect, innerRect ) ;
  3628                         outerRect, innerRect ) ;
       
  3629                 iExtension->iViewModeHighlightControlContextPressed->
       
  3630                     SetFrameRects( outerRect, innerRect ) ;
  3883                 
  3631                 
  3884                 AknsDrawUtils::DrawFrame( skin, aGc, viewRect, innerRect,
  3632                 AknsDrawUtils::DrawFrame( skin, aGc, outerRect, innerRect,
  3885                                           PressedDownState() ?
  3633                         PressedDownState() ? KAknsIIDQsnFrListPressed : 
  3886                                           KAknsIIDQsnFrListPressed : KAknsIIDQsnFrList, KAknsIIDDefault );
  3634                         KAknsIIDQsnFrList, KAknsIIDDefault );
  3887                 }
  3635                 }
  3888             }
  3636             }
  3889         }
  3637         }
  3890 
  3638 
  3891     // Enable/disable the control line as required.  (Hide first, show if necessary)
  3639     // Enable/disable the control line as required.  (Hide first, show if necessary)
  4019         TRect rectElements( layoutRect.Rect() );
  3767         TRect rectElements( layoutRect.Rect() );
  4020 
  3768 
  4021         User::LeaveIfError(AknIconUtils::SetSize(aBitmap, 
  3769         User::LeaveIfError(AknIconUtils::SetSize(aBitmap, 
  4022                               rectElements.Size() ));
  3770                               rectElements.Size() ));
  4023         }
  3771         }
  4024 /*        
  3772     }
  4025     
       
  4026     if (iIsFormControl)
       
  4027         {
       
  4028         if (iIsEditable)
       
  4029             {
       
  4030             if (iBitmap && iBitmap->Bitmap())
       
  4031                 {
       
  4032                 AknIconUtils::SetSize(CONST_CAST(CFbsBitmap*, iBitmap->Bitmap()), 
       
  4033                                         TSize(AKN_LAYOUT_WINDOW_Form_data_field_elements_Line_4.iW, 
       
  4034                                         AKN_LAYOUT_WINDOW_Form_data_field_elements_Line_4.iH));
       
  4035                 }
       
  4036             }
       
  4037         else
       
  4038             {
       
  4039             if (iBitmap && iBitmap->Bitmap())
       
  4040                 {
       
  4041                 AknIconUtils::SetSize(CONST_CAST(CFbsBitmap*, iBitmap->Bitmap()), 
       
  4042                                         TSize(AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iW, 
       
  4043                                         AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iH));
       
  4044                 }
       
  4045             }
       
  4046         }
       
  4047     else
       
  4048         {
       
  4049         if (iBitmap && iBitmap->Bitmap())
       
  4050             {
       
  4051             AknIconUtils::SetSize(CONST_CAST(CFbsBitmap*, iBitmap->Bitmap()), 
       
  4052                         TSize(AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iW, 
       
  4053                         AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iH));
       
  4054             }
       
  4055         }                       */
       
  4056     }
       
  4057     
       
  4058 
  3773 
  4059 
  3774 
  4060 // -----------------------------------------------------------------------------
  3775 // -----------------------------------------------------------------------------
  4061 // CEikCaptionedControl::HandleControlEventL
  3776 // CEikCaptionedControl::HandleControlEventL
  4062 // Implementation of MCoeControlObserver observer interface for observing touch button 
  3777 // Implementation of MCoeControlObserver observer interface for observing touch button 
  4146     else
  3861     else
  4147         SetFocus(aSelected,EDrawNow); 
  3862         SetFocus(aSelected,EDrawNow); 
  4148     }
  3863     }
  4149 
  3864 
  4150 
  3865 
  4151 void CEikCaptionedControl::SetPartiallyVisible( TBool aPVisible )
       
  4152     {
       
  4153     iExtension->iPartiallyVisible = aPVisible;
       
  4154     }
       
  4155     
       
  4156 /*  
  3866 /*  
  4157  * Special Label Class which appends colon to label text
  3867  * Special Label Class which appends colon to label text
  4158  */
  3868  */
  4159 
  3869 
  4160 CEikCapCLabel::CEikCapCLabel() : iIsColonEnabled( EFalse ) 
  3870 CEikCapCLabel::CEikCapCLabel() : iIsColonEnabled( EFalse )