uifw/EikStd/dlgsrc/EIKCAPC.CPP
branchRCL_3
changeset 50 a1caeb42b3a3
parent 29 a8834a2e9a96
child 55 aecbbf00d063
equal deleted inserted replaced
38:c52421ed5f07 50:a1caeb42b3a3
    83 #include "akntrace.h"
    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
   348     MTouchFeedback* iFeedback;
   331     MTouchFeedback* iFeedback;
   349 
   332 
   350 public: // needs to be public because idle callback uses these members.
   333 public: // needs to be public because idle callback uses these members.
   351 	CIdle *iIdle;
   334 	CIdle *iIdle;
   352 	CIdleCallbackData *iIdleData;
   335 	CIdleCallbackData *iIdleData;
   353     /** iPartiallyVisible is used as a protection from changing subcontrol positions of 
   336 
   354       * partially-visible controls in PositionFormComponents(). This is needed only for
       
   355       * dynamic screen size change.
       
   356       */
       
   357     TBool iPartiallyVisible;
       
   358     
       
   359     /**
   337     /**
   360      * Boolean used to check if application is single touch compatible.
   338      * Boolean used to check if application is single touch compatible.
   361      */
   339      */
   362     TBool iUsesSingleClick;
   340     TBool iUsesSingleClick;
   363 
   341 
   391 	iIndicator2(NULL),
   369 	iIndicator2(NULL),
   392 	iObserver(NULL),
   370 	iObserver(NULL),
   393 	iSimulatedDownEvent( EFalse ),
   371 	iSimulatedDownEvent( EFalse ),
   394     iFeedback( MTouchFeedback::Instance() ),
   372     iFeedback( MTouchFeedback::Instance() ),
   395 	iIdle(NULL),
   373 	iIdle(NULL),
   396 	iIdleData(NULL),
   374 	iIdleData(NULL)
   397     iPartiallyVisible( EFalse )
       
   398     {
   375     {
   399     _AKNTRACE_FUNC_ENTER;
   376     _AKNTRACE_FUNC_ENTER;
   400     if ( iAvkonAppUi )
   377     if ( iAvkonAppUi )
   401         {
   378         {
   402         iUsesSingleClick = iAvkonAppUi->IsSingleClickCompatible();
   379         iUsesSingleClick = iAvkonAppUi->IsSingleClickCompatible();
   476     // drawing, we only grab a piece from the list background bitmap.
   453     // drawing, we only grab a piece from the list background bitmap.
   477     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   454     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   478     MAknsControlContext* cc = AknsDrawUtils::ControlContext( iSelf->iDialogPage );
   455     MAknsControlContext* cc = AknsDrawUtils::ControlContext( iSelf->iDialogPage );
   479 
   456 
   480     return AknsDrawUtils::DrawBackground( skin, cc, iSelf->iDialogPage, aGc, TPoint(0,0),
   457     return AknsDrawUtils::DrawBackground( skin, cc, iSelf->iDialogPage, aGc, TPoint(0,0),
   481                                           iSelf->ViewRect(), KAknsDrawParamRGBOnly );
   458                                           iSelf->Rect(), KAknsDrawParamRGBOnly );
   482     }
   459     }
   483 
   460 
   484 
   461 
   485 void CEikCapCExtension::SimulatePointerEventToControlL(
   462 void CEikCapCExtension::SimulatePointerEventToControlL(
   486         const TPointerEvent& aPointerEvent )
   463         const TPointerEvent& aPointerEvent )
   735         }
   712         }
   736     _AKNTRACE_FUNC_EXIT;
   713     _AKNTRACE_FUNC_EXIT;
   737     return drawingSkins;
   714     return drawingSkins;
   738     }
   715     }
   739 
   716 
   740 EXPORT_C CEikCaptionedControl::CEikCaptionedControl() : iHasAppendedEditIndicator(EFalse)
   717 EXPORT_C CEikCaptionedControl::CEikCaptionedControl()
   741     {
   718     {
   742     _AKNTRACE_FUNC_ENTER;
   719     _AKNTRACE_FUNC_ENTER;
   743     iNumberOfLines = 1 ;  // default starting value
   720     iNumberOfLines = 1 ;  // default starting value
   744     AKNTASHOOK_ADD( this, "CEikCaptionedControl" );
   721     AKNTASHOOK_ADD( this, "CEikCaptionedControl" );
   745     _AKNTRACE_FUNC_EXIT;
   722     _AKNTRACE_FUNC_EXIT;
   763         iControl->SetFocus( EFalse);
   740         iControl->SetFocus( EFalse);
   764     delete iControl;
   741     delete iControl;
   765     delete iCaptionText;
   742     delete iCaptionText;
   766     delete iCaption;
   743     delete iCaption;
   767     delete iTrailer;
   744     delete iTrailer;
   768     delete iToolTipText ;
       
   769     delete iBitmap ;
   745     delete iBitmap ;
   770     delete iHighlightControl ;
   746     delete iHighlightControl ;
   771     if ( iExtension )
   747     if ( iExtension )
   772         {
   748         {
   773 		delete iExtension->iIdle;
   749 		delete iExtension->iIdle;
   972         if (iCapCFlags&EUsesEars)
   948         if (iCapCFlags&EUsesEars)
   973             {
   949             {
   974             size.iWidth+=KCapCEarWidth+KCapCEarSpacing;
   950             size.iWidth+=KCapCEarWidth+KCapCEarSpacing;
   975             iCaptionWidth+=KCapCEarWidth+KCapCEarSpacing;
   951             iCaptionWidth+=KCapCEarWidth+KCapCEarSpacing;
   976             }
   952             }
   977         size.iHeight+=2*iVertEdgeSpacing;
   953         size.iWidth+=iCaptionWidth;
   978         size.iWidth+=iCaptionWidth+2*iHorzEdgeSpacing;
       
   979         if (iCapCFlags&ESeparatorAfter)
   954         if (iCapCFlags&ESeparatorAfter)
   980             size.iHeight+=KCapCSeparatorAfterSpace;
   955             size.iHeight+=KCapCSeparatorAfterSpace;
   981         iMinSize=size;
   956 
   982 
       
   983         if ( iDoNotDisplay )
       
   984             // This flag is set if the control is not to be shown - so set it's height to zero
       
   985             iMinSize.iHeight = 0 ;
       
   986         _AKNTRACE_FUNC_EXIT;
   957         _AKNTRACE_FUNC_EXIT;
   987        return(size);
   958        return(size);
   988         }
   959         }
   989     }
   960     }
   990 /**
   961 /**
  1169 void CEikCaptionedControl::StretchComponents()
  1140 void CEikCaptionedControl::StretchComponents()
  1170     {
  1141     {
  1171     if (iCapCFlags&EIfTooSmallDontStrech)
  1142     if (iCapCFlags&EIfTooSmallDontStrech)
  1172     	return;
  1143     	return;
  1173     
  1144     
  1174     TRect rect=Rect();
  1145     TRect rect(Rect());
  1175     rect.Shrink(iHorzEdgeSpacing,iVertEdgeSpacing);
       
  1176     if (iCapCFlags&ESeparatorAfter)
  1146     if (iCapCFlags&ESeparatorAfter)
  1177         rect.iBr.iY-=KCapCSeparatorAfterSpace;
  1147         rect.iBr.iY-=KCapCSeparatorAfterSpace;
  1178 
  1148 
  1179     const CFont* editorFont = AknLayoutUtils::FontFromId( iEditorFontId ) ;
  1149     const CFont* editorFont = AknLayoutUtils::FontFromId( iEditorFontId ) ;
  1180 
  1150 
  1181     TInt normalEditorHeight = editorFont->HeightInPixels() + editorFont->DescentInPixels() + ( 2 * iVertEdgeSpacing ) ;
  1151     TInt normalEditorHeight = editorFont->HeightInPixels() + editorFont->DescentInPixels();
  1182     if ( normalEditorHeight > rect.Height() )
  1152     if ( normalEditorHeight > rect.Height() )
  1183         normalEditorHeight = rect.Height() ;
  1153         normalEditorHeight = rect.Height() ;
  1184 
  1154 
  1185     // Insert Bitmap before caption 
  1155     // Insert Bitmap before caption 
  1186     // 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
  1187     if ( iBitmap )
  1157     if ( iBitmap )
  1188         {       
  1158         {       
  1189         TPoint bitmapTl = rect.iTl ;
  1159         TPoint bitmapTl( rect.iTl );
  1190         TSize bitmapSize = iBitmap->MinimumSize() ;
  1160         TSize bitmapSize( iBitmap->MinimumSize() );
  1191         if ( bitmapSize.iHeight > normalEditorHeight )
  1161         if ( bitmapSize.iHeight > normalEditorHeight )
  1192             {
  1162             {
  1193             // 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)
  1194             TReal ratio = normalEditorHeight/bitmapSize.iHeight ;
  1164             TReal ratio = normalEditorHeight/bitmapSize.iHeight ;
  1195             bitmapSize = TSize( TInt(bitmapSize.iWidth * ratio) , TInt(bitmapSize.iHeight * ratio) ) ;
  1165             bitmapSize = TSize( TInt(bitmapSize.iWidth * ratio) , TInt(bitmapSize.iHeight * ratio) ) ;
  1213         iCaption->SetExtent(capPos,capSize);
  1183         iCaption->SetExtent(capPos,capSize);
  1214         if (iCapCFlags&EExtraAscent)
  1184         if (iCapCFlags&EExtraAscent)
  1215             rect.iTl.iY+=KCapCExtraAscent;
  1185             rect.iTl.iY+=KCapCExtraAscent;
  1216         }
  1186         }
  1217     rect.iTl.iX+=iCaptionWidth;
  1187     rect.iTl.iX+=iCaptionWidth;
  1218 
       
  1219     if ((iCapCFlags&EUsesEars) && !(iCapCFlags&ETrailerAfterEar))
       
  1220         rect.iBr.iX-=(KCapCEarWidth+KCapCEarSpacing);
       
  1221 
  1188 
  1222     if (iTrailer)
  1189     if (iTrailer)
  1223         {
  1190         {
  1224         TSize trailSize=iTrailer->MinimumSize();
  1191         TSize trailSize=iTrailer->MinimumSize();
  1225         TInt trailPosX=rect.iBr.iX-trailSize.iWidth;
  1192         TInt trailPosX=rect.iBr.iX-trailSize.iWidth;
  1227         if(trailSize.iHeight+trailPosY>Rect().iBr.iY)
  1194         if(trailSize.iHeight+trailPosY>Rect().iBr.iY)
  1228             trailSize.iHeight=Rect().iBr.iY-trailPosY;
  1195             trailSize.iHeight=Rect().iBr.iY-trailPosY;
  1229         iTrailer->SetExtent(TPoint(trailPosX,trailPosY),trailSize);
  1196         iTrailer->SetExtent(TPoint(trailPosX,trailPosY),trailSize);
  1230         rect.iBr.iX=trailPosX-KControlTrailerSpacing;
  1197         rect.iBr.iX=trailPosX-KControlTrailerSpacing;
  1231         }
  1198         }
  1232     if ((iCapCFlags&EUsesEars) && (iCapCFlags&ETrailerAfterEar))
       
  1233         rect.iBr.iX-=(KCapCEarWidth+KCapCEarSpacing);
       
  1234 
  1199 
  1235     if(iCapCFlags&EIfTooBigCtlStaysMinHeight && rect.Height()>iControl->MinimumSize().iHeight)
  1200     if(iCapCFlags&EIfTooBigCtlStaysMinHeight && rect.Height()>iControl->MinimumSize().iHeight)
  1236         rect.iBr.iY=rect.iTl.iY+iControl->MinimumSize().iHeight;
  1201         rect.iBr.iY=rect.iTl.iY+iControl->MinimumSize().iHeight;
  1237     if(iCapCFlags&EIfTooBigCtlStaysMinWidth && rect.Width()>iControl->MinimumSize().iWidth)
  1202     if(iCapCFlags&EIfTooBigCtlStaysMinWidth && rect.Width()>iControl->MinimumSize().iWidth)
  1238         rect.iBr.iX=rect.iTl.iX+iControl->MinimumSize().iWidth;
  1203         rect.iBr.iX=rect.iTl.iX+iControl->MinimumSize().iWidth;
  1239     iControl->SetRect(rect);
  1204     iControl->SetRect(rect);
  1240     
  1205     
  1241     }
  1206     }
  1242 
  1207 
  1243 
  1208 
  1244 TInt CEikCaptionedControl::WidthForEars(TInt aWidthRemaining) const
       
  1245     {
       
  1246     TInt earWidth=0;
       
  1247     if(iCapCFlags&EUsesEars)
       
  1248         {
       
  1249         const TInt earAndMarginWidth=KCapCEarWidth+KCapCEarSpacing;
       
  1250         if(iTrailer || iCaption)
       
  1251             {
       
  1252             if(aWidthRemaining>(2+(iTrailer?1:0)+(iCaption?1:0))*earAndMarginWidth)
       
  1253                 earWidth=earAndMarginWidth;
       
  1254             else if(aWidthRemaining>(2+(iTrailer?1:0)+(iCaption?1:0))*KCapCEarWidth)
       
  1255                 earWidth=KCapCEarWidth;
       
  1256             }
       
  1257         else
       
  1258             earWidth=Min(aWidthRemaining/2,earAndMarginWidth);
       
  1259         }
       
  1260     return earWidth;
       
  1261     }
       
  1262 
       
  1263 
       
  1264 void CEikCaptionedControl::SquashComponents()
  1209 void CEikCaptionedControl::SquashComponents()
  1265     {
  1210     {
  1266     TRect rect=Rect();
  1211     TRect rect=Rect();
  1267     // Shrink for Separator
  1212     // Shrink for Separator
  1268     if (iCapCFlags&ESeparatorAfter)
  1213     if (iCapCFlags&ESeparatorAfter)
  1269         rect.iBr.iY-=KCapCSeparatorAfterSpace;
  1214         rect.iBr.iY-=KCapCSeparatorAfterSpace;
  1270 
  1215 
  1271     // Space required before the left of the control rect
  1216     // Space required before the left of the control rect
  1272     TInt desiredLeft=iHorzEdgeSpacing;
  1217     TInt desiredLeft=0;
  1273     if(iCaption)
  1218     if(iCaption)
  1274         desiredLeft+=iCaption->MinimumSize().iWidth+KCapCCenterSpacing;
  1219         desiredLeft+=iCaption->MinimumSize().iWidth+KCapCCenterSpacing;
  1275     if ( iBitmap )
  1220     if ( iBitmap )
  1276         desiredLeft += iBitmap->MinimumSize().iWidth ; // + additional separation?
  1221         desiredLeft += iBitmap->MinimumSize().iWidth ; // + additional separation?
  1277 
  1222 
  1278     // Space required after the right of the control rect
  1223     // Space required after the right of the control rect
  1279     TInt desiredRight=iHorzEdgeSpacing;
  1224     TInt desiredRight=0;
  1280     if(iTrailer)
  1225     if(iTrailer)
  1281         desiredRight+=iTrailer->MinimumSize().iWidth+KControlTrailerSpacing;
  1226         desiredRight+=iTrailer->MinimumSize().iWidth+KControlTrailerSpacing;
  1282     
  1227     
  1283     // Decide on space for the control rect.
  1228     // Decide on space for the control rect.
  1284     TInt controlWidth=0;
  1229     TInt controlWidth=0;
  1294         else
  1239         else
  1295             controlWidth=Max(0,widthRemaining-(desiredLeft+desiredRight+2*(KCapCEarWidth+KCapCEarSpacing)));
  1240             controlWidth=Max(0,widthRemaining-(desiredLeft+desiredRight+2*(KCapCEarWidth+KCapCEarSpacing)));
  1296         widthRemaining-=controlWidth;
  1241         widthRemaining-=controlWidth;
  1297         }
  1242         }
  1298     
  1243     
  1299     // Decide if there is space for ears with margins, ears only, or no ears.
       
  1300     TInt earWidth=WidthForEars(widthRemaining);
       
  1301     widthRemaining-=2*earWidth;
       
  1302     
       
  1303     // Space assigned for before the left of the control rect
  1244     // Space assigned for before the left of the control rect
  1304     TInt actualLeft=0;
  1245     TInt actualLeft=0;
  1305     actualLeft=ScaledSubLength(widthRemaining,desiredLeft,desiredLeft+desiredRight);
  1246     actualLeft=ScaledSubLength(widthRemaining,desiredLeft,desiredLeft+desiredRight);
  1306     // Space assigned for after the right of the control rect
  1247     // Space assigned for after the right of the control rect
  1307     TInt actualRight=widthRemaining-actualLeft;
  1248     TInt actualRight=widthRemaining-actualLeft;
  1332         captionRect.iTl.iX+=actualLeft-actualCaption;
  1273         captionRect.iTl.iX+=actualLeft-actualCaption;
  1333         captionRect.iBr.iX=captionRect.iTl.iX+actualCaption;
  1274         captionRect.iBr.iX=captionRect.iTl.iX+actualCaption;
  1334         if (iCapCFlags&EExtraAscent)
  1275         if (iCapCFlags&EExtraAscent)
  1335             rect.iTl.iY+=KCapCExtraAscent;
  1276             rect.iTl.iY+=KCapCExtraAscent;
  1336         
  1277         
  1337         if(actualLeft>2*(KCapCCenterSpacing+iHorzEdgeSpacing))
  1278         if(actualLeft>2*(KCapCCenterSpacing))
  1338                 {
  1279                 {
  1339                 captionRect.iTl.iX+=iHorzEdgeSpacing;
       
  1340                 captionRect.iBr.iX-=KCapCCenterSpacing;
  1280                 captionRect.iBr.iX-=KCapCCenterSpacing;
  1341                 }
  1281                 }
  1342         const TSize capMin=iCaption->MinimumSize();
  1282         const TSize capMin=iCaption->MinimumSize();
  1343         iCaption->SetExtent(captionRect.iTl,TSize(Min(captionRect.Width(),capMin.iWidth)
  1283         iCaption->SetExtent(captionRect.iTl,TSize(Min(captionRect.Width(),capMin.iWidth)
  1344             ,Min(captionRect.Height(),iCaption->MinimumSize().iHeight)));
  1284             ,Min(captionRect.Height(),iCaption->MinimumSize().iHeight)));
  1347     // 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.
  1348     if(iTrailer)
  1288     if(iTrailer)
  1349         {
  1289         {
  1350         TInt leftAdjust=0;
  1290         TInt leftAdjust=0;
  1351         TInt rightAdjust=0;
  1291         TInt rightAdjust=0;
  1352         TRect trailerRect=rect;
  1292         TRect trailerRect(rect);
  1353         trailerRect.iTl.iX+=actualLeft+controlWidth+(iCapCFlags&EUsesEars ? earWidth : 0);
  1293         trailerRect.iTl.iX+=actualLeft+controlWidth;
  1354         trailerRect.iTl.iY+=KTrailCVertCaptionOffset;
  1294         trailerRect.iTl.iY+=KTrailCVertCaptionOffset;
  1355 
  1295 
  1356         if(actualRight>2*(iHorzEdgeSpacing+KControlTrailerSpacing))
  1296         if(actualRight>2*(KControlTrailerSpacing))
  1357             {
  1297             {
  1358             if(iCapCFlags&ETrailerAfterEar)
  1298             leftAdjust=KControlTrailerSpacing;
  1359                 {
  1299             }
  1360                 leftAdjust=KControlTrailerSpacing+earWidth;
  1300 
  1361                 rightAdjust=iHorzEdgeSpacing;
       
  1362                 }
       
  1363             else
       
  1364                 {
       
  1365                 rightAdjust=earWidth+iHorzEdgeSpacing;
       
  1366                 leftAdjust=KControlTrailerSpacing;
       
  1367                 }
       
  1368             }
       
  1369         else
       
  1370             {
       
  1371             if(iCapCFlags&ETrailerAfterEar)
       
  1372                 leftAdjust=earWidth;
       
  1373             else
       
  1374                 rightAdjust=earWidth;
       
  1375             }
       
  1376         trailerRect.iTl.iX+=leftAdjust;
  1301         trailerRect.iTl.iX+=leftAdjust;
  1377         trailerRect.iBr.iX-=rightAdjust;
  1302         trailerRect.iBr.iX-=rightAdjust;
  1378         iTrailer->SetExtent(trailerRect.iTl,TSize(trailerRect.Width(),
  1303         iTrailer->SetExtent(trailerRect.iTl,TSize(trailerRect.Width(),
  1379             Min(trailerRect.Height(),iTrailer->MinimumSize().iHeight)));
  1304             Min(trailerRect.Height(),iTrailer->MinimumSize().iHeight)));
  1380         }
  1305         }
  1381     // Position and set the controls space
  1306     // Position and set the controls space
  1382     TRect controlRect=rect;
  1307     TRect controlRect=rect;
  1383     controlRect.iTl.iX+=actualLeft+earWidth;
  1308     controlRect.iTl.iX+=actualLeft;
  1384     controlRect.iBr.iX-=(actualRight+earWidth);
  1309     controlRect.iBr.iX-=actualRight;
  1385     if(iCapCFlags&EIfTooBigCtlStaysMinHeight && controlRect.Height()>iControl->MinimumSize().iHeight)
  1310     if(iCapCFlags&EIfTooBigCtlStaysMinHeight && controlRect.Height()>iControl->MinimumSize().iHeight)
  1386         controlRect.iBr.iY=controlRect.iTl.iY+iControl->MinimumSize().iHeight;
  1311         controlRect.iBr.iY=controlRect.iTl.iY+iControl->MinimumSize().iHeight;
  1387     iControl->SetRect(controlRect);
  1312     iControl->SetRect(controlRect);
  1388     
  1313     }
  1389     }
       
  1390 
       
  1391 
  1314 
  1392 
  1315 
  1393 /**
  1316 /**
  1394  * Sets the flags, aFlags, (see TSpaceSharingFlags), which determine
  1317  * Sets the flags, aFlags, (see TSpaceSharingFlags), which determine
  1395  * 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
  1521             if (!focused)
  1444             if (!focused)
  1522                 emphasis=(iCapCFlags&ECurrent? CEikLabel::EPartialEmphasis: CEikLabel::ENoEmphasis);
  1445                 emphasis=(iCapCFlags&ECurrent? CEikLabel::EPartialEmphasis: CEikLabel::ENoEmphasis);
  1523             iCaption->SetEmphasis(emphasis);
  1446             iCaption->SetEmphasis(emphasis);
  1524             }
  1447             }
  1525         }
  1448         }
  1526     
  1449 
  1527 
       
  1528     if (aDrawNow && iCapCFlags&EUsesEars && IsReadyToDraw())
       
  1529         DrawEarsNow(EBothEars);
       
  1530     _AKNTRACE_FUNC_EXIT;
  1450     _AKNTRACE_FUNC_EXIT;
  1531     }
  1451     }
  1532 
  1452 
  1533 
       
  1534 
       
  1535 void CEikCaptionedControl::DrawEarsNow(TWhichEars aEar) const
       
  1536     {
       
  1537     _AKNTRACE_FUNC_ENTER;
       
  1538     ActivateGc();
       
  1539     DrawEars(aEar);
       
  1540     DeactivateGc();
       
  1541     _AKNTRACE_FUNC_EXIT;
       
  1542     }
       
  1543 
       
  1544 void CEikCaptionedControl::DrawEars(TWhichEars aEar) const
       
  1545     {
       
  1546     if (aEar&ELeftEar)
       
  1547         DrawSingleEar(ELeftEar,iCapCFlags&ELeftEarDown);
       
  1548     if (aEar&ERightEar)
       
  1549         DrawSingleEar(ERightEar,iCapCFlags&ERightEarDown);
       
  1550     }
       
  1551 
       
  1552 void CEikCaptionedControl::DrawSingleEar(TWhichEars /*aEar*/,TBool /*aPressed*/) const
       
  1553     {
       
  1554     // not needed in S60
       
  1555     }
       
  1556 
       
  1557 TRect CEikCaptionedControl::EarRect(TWhichEars /*aEar*/) const
       
  1558     {
       
  1559     return(TRect(0,0,0,0)); // not needed in S60
       
  1560     }
       
  1561 
  1453 
  1562 EXPORT_C TInt CEikCaptionedControl::CountComponentControls() const
  1454 EXPORT_C TInt CEikCaptionedControl::CountComponentControls() const
  1563     {
  1455     {
  1564     CCoeControl* controls[] = 
  1456     CCoeControl* controls[] = 
  1565     {
  1457     {
  1618     {
  1510     {
  1619     _AKNTRACE_FUNC_ENTER;
  1511     _AKNTRACE_FUNC_ENTER;
  1620     CWindowGc& gc=SystemGc();
  1512     CWindowGc& gc=SystemGc();
  1621 
  1513 
  1622     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1514     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1623     if ( iRefresh )
       
  1624         {
       
  1625         gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
       
  1626         gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
       
  1627         }
       
  1628 
  1515 
  1629     if ( iCaption )
  1516     if ( iCaption )
  1630         {
  1517         {
  1631 // Draw ':' for edit indicator.  ( Skin independant )
  1518 // Draw ':' for edit indicator.  ( Skin independant )
  1632         if ( iIsEditable && iIsCurrentLine )
  1519         if ( iIsEditable && iIsCurrentLine )
  1667     {
  1554     {
  1668     _AKNTRACE_FUNC_ENTER;
  1555     _AKNTRACE_FUNC_ENTER;
  1669     CWindowGc& gc=SystemGc();
  1556     CWindowGc& gc=SystemGc();
  1670 
  1557 
  1671     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1558     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1672 
       
  1673     if ( iRefresh )
       
  1674         {
       
  1675         gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
       
  1676         gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
       
  1677         }
       
  1678 
  1559 
  1679     if (iDialogPage&& iHighlightControl)
  1560     if (iDialogPage&& iHighlightControl)
  1680         {
  1561         {
  1681         TInt height(Rect().Height());
  1562         TInt height(Rect().Height());
  1682         TBool top = iDialogPage->VisibleSizeOnPage(height,iControl);
  1563         TBool top = iDialogPage->VisibleSizeOnPage(height,iControl);
  1746     _AKNTRACE_FUNC_ENTER;
  1627     _AKNTRACE_FUNC_ENTER;
  1747     CWindowGc& gc=SystemGc();
  1628     CWindowGc& gc=SystemGc();
  1748 
  1629 
  1749     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1630     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1750 
  1631 
  1751     if ( iRefresh )
       
  1752         {
       
  1753         gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
       
  1754         gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
       
  1755         }
       
  1756 
       
  1757     // This gives the correct Rect for using the Layout functions
  1632     // This gives the correct Rect for using the Layout functions
  1758     TRect viewRect=ViewRect(); 
  1633     TRect viewRect( Rect() ); 
  1759 
  1634 
  1760     TAknLayoutRect line1Rect;
  1635     TAknLayoutRect line1Rect;
  1761     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) );
  1762 
  1637 
  1763     /* This is in view mode, and is the current line
  1638     /* This is in view mode, and is the current line
  1809     
  1684     
  1810 void CEikCaptionedControl::DrawAsFormUnFocusedLine( const TRect& /*aRect*/ ) const
  1685 void CEikCaptionedControl::DrawAsFormUnFocusedLine( const TRect& /*aRect*/ ) const
  1811     {
  1686     {
  1812     _AKNTRACE_FUNC_ENTER;
  1687     _AKNTRACE_FUNC_ENTER;
  1813     CWindowGc& gc=SystemGc();
  1688     CWindowGc& gc=SystemGc();
  1814 
       
  1815     gc.SetPenStyle(CGraphicsContext::ENullPen);
       
  1816 
       
  1817     if ( iRefresh )
       
  1818         {
       
  1819         gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
       
  1820         gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
       
  1821         }
       
  1822 
  1689 
  1823     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1690     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1824     gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
  1691     gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
  1825     gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;  
  1692     gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;  
  1826 
  1693 
  1835     gc.SetPenStyle(CGraphicsContext::ESolidPen);
  1702     gc.SetPenStyle(CGraphicsContext::ESolidPen);
  1836     gc.SetPenColor(iEikonEnv->ControlColor(EColorDialogText,*this));
  1703     gc.SetPenColor(iEikonEnv->ControlColor(EColorDialogText,*this));
  1837     gc.SetBrushStyle( CGraphicsContext::ENullBrush ) ;
  1704     gc.SetBrushStyle( CGraphicsContext::ENullBrush ) ;
  1838     gc.DrawLine(TPoint(iVerticalLineXPosition,Rect().iTl.iY),
  1705     gc.DrawLine(TPoint(iVerticalLineXPosition,Rect().iTl.iY),
  1839         TPoint(iVerticalLineXPosition,Rect().iBr.iY+1));
  1706         TPoint(iVerticalLineXPosition,Rect().iBr.iY+1));
  1840     // CEikCaptionedControl* visibleBelow=0; (NOT USED)
       
  1841 
  1707 
  1842     if (iDialogPage) 
  1708     if (iDialogPage) 
  1843         {
  1709         {
  1844         // visibleBelow=iDialogPage->FindNextControlOnPageWithHeight(EFalse,this); 
  1710         // visibleBelow=iDialogPage->FindNextControlOnPageWithHeight(EFalse,this); 
  1845 
  1711 
  1871     
  1737     
  1872     return colorIndex;
  1738     return colorIndex;
  1873     }
  1739     }
  1874 
  1740 
  1875 
  1741 
  1876 void CEikCaptionedControl::DrawAsEikonDialog( const TRect& aRect ) const
  1742 void CEikCaptionedControl::DrawAsEikonDialog( const TRect& /*aRect*/ ) const
  1877     {
  1743     {
  1878     _AKNTRACE_FUNC_ENTER;
  1744     _AKNTRACE_FUNC_ENTER;
  1879     CWindowGc& gc=SystemGc();
  1745     CWindowGc& gc=SystemGc();
  1880     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1746     gc.SetPenStyle(CGraphicsContext::ENullPen);
  1881 
  1747 
  1882     if (iHighlightControl)
  1748     if (iHighlightControl)
  1883         STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->SetTopOrBottom(CEikCaptionedControlFormHighlightLine::EUnset);
  1749         STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->SetTopOrBottom(CEikCaptionedControlFormHighlightLine::EUnset);
  1884 
       
  1885     if ( iRefresh )
       
  1886         {
       
  1887         gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
       
  1888         gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
       
  1889         }
       
  1890 
       
  1891 
       
  1892     TRect redrawRect=Rect();
       
  1893     redrawRect.Intersection(aRect);
       
  1894 
  1750 
  1895     /*
  1751     /*
  1896     *
  1752     *
  1897     * FIX TSW JTON-6HGAND - see also eikdpage.cpp
  1753     * FIX TSW JTON-6HGAND - see also eikdpage.cpp
  1898     *
  1754     *
  1900     *    gc.DrawRect(redrawRect);
  1756     *    gc.DrawRect(redrawRect);
  1901     *
  1757     *
  1902     * 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'
  1903     * should be fixed also.
  1759     * should be fixed also.
  1904     */
  1760     */
  1905     
       
  1906     if (iCapCFlags&ESeparatorAfter)
  1761     if (iCapCFlags&ESeparatorAfter)
  1907         {
  1762         {
  1908         TRect rect(Rect());
  1763         TRect rect(Rect());
  1909         TPoint separatorStartPt(rect.iTl.iX+iHorzEdgeSpacing/2,rect.iBr.iY-1);
  1764         TPoint separatorStartPt(rect.iTl.iX,rect.iBr.iY-1);
  1910         TPoint separatorEndPt(separatorStartPt.iX+(iFullWidth-iHorzEdgeSpacing), separatorStartPt.iY);
  1765         TPoint separatorEndPt(separatorStartPt.iX, separatorStartPt.iY);
  1911         gc.SetPenStyle(CGraphicsContext::ESolidPen);
  1766         gc.SetPenStyle(CGraphicsContext::ESolidPen);
  1912         gc.SetPenColor(iEikonEnv->ControlColor(EColorWindowText, *this));
  1767         gc.SetPenColor(iEikonEnv->ControlColor(EColorWindowText, *this));
  1913         gc.DrawLine(separatorStartPt, separatorEndPt);
  1768         gc.DrawLine(separatorStartPt, separatorEndPt);
  1914         };
  1769         }
  1915 
  1770 
  1916     if (iCapCFlags&EUsesEars)
       
  1917         DrawEars(EBothEars); 
       
  1918     _AKNTRACE_FUNC_EXIT;
  1771     _AKNTRACE_FUNC_EXIT;
  1919     }
  1772     }
  1920 
  1773 
  1921 /*
  1774 /*
  1922 * Method to return T/F whether this CEikCaptionedControl has a separator.
  1775 * Method to return T/F whether this CEikCaptionedControl has a separator.
  1974     }   
  1827     }   
  1975 
  1828 
  1976 EXPORT_C void CEikCaptionedControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
  1829 EXPORT_C void CEikCaptionedControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
  1977     {
  1830     {
  1978     _AKNTRACE_FUNC_ENTER;
  1831     _AKNTRACE_FUNC_ENTER;
  1979     if (!IsNonFocusing())
       
  1980         {
       
  1981         TWhichEars ear=ENoEar;
       
  1982         if (aPointerEvent.iType!=TPointerEvent::EButton1Down)
       
  1983             {
       
  1984             _AKNTRACE("TPointerEvent::EButton1Down");
       
  1985             if (iCapCFlags&ELeftEarGrab)
       
  1986                 ear=ELeftEar;
       
  1987             else if (iCapCFlags&ERightEarGrab)
       
  1988                 ear=ERightEar;
       
  1989             if (ear)
       
  1990                 {
       
  1991                 TInt oldDrawFlags=iCapCFlags&(ELeftEarDown|ERightEarDown);
       
  1992                 if (aPointerEvent.iType==TPointerEvent::EButton1Up)
       
  1993                     iCapCFlags&=(~KDynamicEarMask);
       
  1994                 else
       
  1995                     {
       
  1996                     iCapCFlags&=(~(ELeftEarDown|ERightEarDown));
       
  1997                     if (EarRect(ear).Contains(aPointerEvent.iPosition))
       
  1998                         {
       
  1999                         FireEarL(ear, KCapCEarRepeat);
       
  2000                         return;
       
  2001                         }
       
  2002                     }
       
  2003                 if (oldDrawFlags!=(iCapCFlags&(ELeftEarDown|ERightEarDown)))
       
  2004                     DrawEarsNow(ear);
       
  2005                 _AKNTRACE_FUNC_EXIT;
       
  2006                 return;
       
  2007                 }
       
  2008             }
       
  2009         else if (iCapCFlags&EUsesEars)
       
  2010             {
       
  2011             iCapCFlags&=(~KDynamicEarMask);
       
  2012             if (EarRect(ELeftEar).Contains(aPointerEvent.iPosition))
       
  2013                 ear=ELeftEar;
       
  2014             else if (EarRect(ERightEar).Contains(aPointerEvent.iPosition))
       
  2015                 ear=ERightEar;
       
  2016             if (ear)
       
  2017                 {
       
  2018                 FireEarL(ear, KCapCInitialEarRepeat);
       
  2019                 _AKNTRACE_FUNC_EXIT;
       
  2020                 return;
       
  2021                 }
       
  2022             }
       
  2023         }
       
  2024 
       
  2025     TBool edwinControl( ControlIsAnEdwin( iControlType ) );
  1832     TBool edwinControl( ControlIsAnEdwin( iControlType ) );
  2026     
  1833     
  2027      if ( iIsFormControl )
  1834      if ( iIsFormControl )
  2028         {
  1835         {
  2029         if ( !PressedDownState() &&
  1836         if ( !PressedDownState() &&
  2083         {
  1890         {
  2084         iExtension->SimulatePointerEventToControlL( aPointerEvent );
  1891         iExtension->SimulatePointerEventToControlL( aPointerEvent );
  2085         }
  1892         }
  2086     }
  1893     }
  2087 
  1894 
  2088 void CEikCaptionedControl::FireEarL(TWhichEars aEar, TInt aEarRepeat)
       
  2089     {
       
  2090     Window().RequestPointerRepeatEvent(aEarRepeat, EarRect(aEar));
       
  2091     TKeyEvent key;
       
  2092     key.iModifiers=0;
       
  2093     if (aEar==ELeftEar)
       
  2094         {
       
  2095         key.iCode=EKeyLeftArrow;
       
  2096         iCapCFlags|=ELeftEarDown|ELeftEarGrab;
       
  2097         }
       
  2098     else
       
  2099         {
       
  2100         key.iCode=EKeyRightArrow;
       
  2101         iCapCFlags|=ERightEarDown|ERightEarGrab;
       
  2102         }
       
  2103     DrawEarsNow(aEar);
       
  2104     iControl->OfferKeyEventL(key,EEventKey);
       
  2105     }
       
  2106 
  1895 
  2107 EXPORT_C void CEikCaptionedControl::SetCaptionL(const TDesC& aText)
  1896 EXPORT_C void CEikCaptionedControl::SetCaptionL(const TDesC& aText)
  2108     {
  1897     {
  2109     _AKNTRACE_FUNC_ENTER;
  1898     _AKNTRACE_FUNC_ENTER;
  2110     _AKNTRACE("aText = %s", &aText);    
  1899     _AKNTRACE("aText = %s", &aText);    
  2118         delete iCaptionText; // get rid of old iCaptionText
  1907         delete iCaptionText; // get rid of old iCaptionText
  2119         iCaptionText=0;
  1908         iCaptionText=0;
  2120         iCaptionText = aText.AllocL();
  1909         iCaptionText = aText.AllocL();
  2121         }
  1910         }
  2122         
  1911         
  2123     if (iCaption->DrawableWindow() == NULL)    
  1912     if (!iCaption->DrawableWindow())    
  2124         {
  1913         {
  2125         iCaption->SetContainerWindowL(*this);
  1914         iCaption->SetContainerWindowL(*this);
  2126         iCaption->CopyControlContextFrom(this);
  1915         iCaption->CopyControlContextFrom(this);
  2127         }
  1916         }
  2128 /*
  1917 /*
  2233 
  2022 
  2234     // Process ToolTip
  2023     // Process ToolTip
  2235     TPtrC16 toolTip = aReader.ReadTPtrC() ;
  2024     TPtrC16 toolTip = aReader.ReadTPtrC() ;
  2236     SetToolTipTextL( toolTip ) ; 
  2025     SetToolTipTextL( toolTip ) ; 
  2237     
  2026     
  2238     // Set the border spacing to the default value
       
  2239     SetVertEdgeSpacing( KCapCDefaultVertEdgeSpacing ) ;
       
  2240     SetHorzEdgeSpacing( KCapCDefaultHorzEdgeSpacing ) ;
       
  2241 
       
  2242     //Added to create new form box closer for edwins in forms.
  2027     //Added to create new form box closer for edwins in forms.
  2243     if (!iHighlightControl)
  2028     if (!iHighlightControl)
  2244         {
  2029         {
  2245         iHighlightControl = new(ELeave) CEikCaptionedControlFormHighlightLine( *this ) ;
  2030         iHighlightControl = new(ELeave) CEikCaptionedControlFormHighlightLine( *this ) ;
  2246         STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->ConstructL() ;
  2031         STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->ConstructL() ;
  2288     }
  2073     }
  2289 
  2074 
  2290 EXPORT_C void CEikCaptionedControl::ResetMinimumSizes()
  2075 EXPORT_C void CEikCaptionedControl::ResetMinimumSizes()
  2291     {
  2076     {
  2292 	_AKNTRACE_FUNC_ENTER;
  2077 	_AKNTRACE_FUNC_ENTER;
  2293     iMinSize.iWidth=0;
       
  2294     iCaptionWidth=0;
  2078     iCaptionWidth=0;
  2295     iFullWidth=0;
       
  2296     _AKNTRACE_FUNC_EXIT;
  2079     _AKNTRACE_FUNC_EXIT;
  2297     }
  2080     }
  2298 
  2081 
  2299 EXPORT_C TBool CEikCaptionedControl::IsLatent() const
  2082 EXPORT_C TBool CEikCaptionedControl::IsLatent() const
  2300     {
  2083     {
  2436     {
  2219     {
  2437     }
  2220     }
  2438 
  2221 
  2439 EXPORT_C const TDesC* CEikCaptionedControl::ToolTipText() const 
  2222 EXPORT_C const TDesC* CEikCaptionedControl::ToolTipText() const 
  2440     {
  2223     {
  2441     if ( iToolTipText )
  2224     return NULL ;
  2442         return  iToolTipText ;
       
  2443     else
       
  2444         return NULL ;
       
  2445     }
  2225     }
  2446 
  2226 
  2447 /**
  2227 /**
  2448  * 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.
  2449  * Does nothing in release mode.
  2229  * Does nothing in release mode.
  2578 			SizeChanged(); // needed because layout lines change when editable flag is switched.
  2358 			SizeChanged(); // needed because layout lines change when editable flag is switched.
  2579         }
  2359         }
  2580     _AKNTRACE_FUNC_EXIT;
  2360     _AKNTRACE_FUNC_EXIT;
  2581     }
  2361     }
  2582 
  2362 
  2583 void CEikCaptionedControl::SetVertEdgeSpacing( TInt aVertEdgeSpacing ) 
       
  2584     {
       
  2585     iVertEdgeSpacing = aVertEdgeSpacing ;
       
  2586     }
       
  2587 
       
  2588 void CEikCaptionedControl::SetHorzEdgeSpacing( TInt aHorzEdgeSpacing ) 
       
  2589     {
       
  2590     iHorzEdgeSpacing = aHorzEdgeSpacing ;
       
  2591     }
       
  2592 
       
  2593 /**
  2363 /**
  2594  * Avkon component positioning for Forms
  2364  * Avkon component positioning for Forms
  2595  */
  2365  */
  2596 
  2366 
  2597 void CEikCaptionedControl::PositionFormComponents()
  2367 void CEikCaptionedControl::PositionFormComponents()
  2598     {
  2368     {
  2599     _AKNTRACE_FUNC_ENTER;
  2369     _AKNTRACE_FUNC_ENTER;
  2600     if( iExtension->iPartiallyVisible )
  2370     MinimumSize() ;
       
  2371 
       
  2372     // if control has no height, return now (no point laying out)
       
  2373     if (!Rect().Height())  
  2601         return;
  2374         return;
       
  2375 
  2602     TBool isFocused = iIsCurrentLine;
  2376     TBool isFocused = iIsCurrentLine;
  2603     TBool isSingleLineLayout = ( FormLayout() == CEikDialogPage::ESingle);
  2377     TBool isSingleLineLayout = ( FormLayout() == CEikDialogPage::ESingle);
  2604     MinimumSize() ;
       
  2605     TBool hasBitmaps = ShowBitmap();
  2378     TBool hasBitmaps = ShowBitmap();
  2606     
       
  2607 /* 
       
  2608 if control has no height, return now (no point laying out)
       
  2609 */
       
  2610     if (!Rect().Height())  
       
  2611         return;
       
  2612 
       
  2613     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 ; 
  2614 
  2380 
  2615     // If double line layout update verticalLine
  2381     // If double line layout update verticalLine
  2616     if ( !isSingleLineLayout )
  2382     if ( !isSingleLineLayout )
  2617         {
  2383         {
  2636                 {
  2402                 {
  2637                 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);
  2638                 }
  2404                 }
  2639             }    
  2405             }    
  2640         }
  2406         }
  2641         TRect parentRect = Rect();
  2407 
  2642         TAknLayoutRect layoutRect;
  2408     TAknLayoutRect layoutRect;
  2643         layoutRect.LayoutRect( parentRect, verticalLine );
  2409     layoutRect.LayoutRect( Rect(), verticalLine );
  2644         TRect rectVerticalLine( layoutRect.Rect() );
  2410     TRect rectVerticalLine( layoutRect.Rect() );
  2645 
       
  2646 
  2411 
  2647     // set vertical line position.  
  2412     // set vertical line position.  
  2648     if ( AknLayoutUtils::LayoutMirrored() )
  2413     if ( AknLayoutUtils::LayoutMirrored() )
  2649         {
  2414         {
  2650         iVerticalLineXPosition = Rect().Width() - rectVerticalLine.iBr.iX;
  2415         iVerticalLineXPosition = Rect().Width() - rectVerticalLine.iBr.iX;
  2671 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
  2672 ConvertCustomControlTypeToBaseControlType mechanism so if the code gets here, the control is 
  2437 ConvertCustomControlTypeToBaseControlType mechanism so if the code gets here, the control is 
  2673 "none of the above".
  2438 "none of the above".
  2674 */
  2439 */
  2675         Panic(EEikFormPanicUnknownControlType);
  2440         Panic(EEikFormPanicUnknownControlType);
  2676         };
  2441         }
  2677 
       
  2678     //TRect layoutRectOfDataPane =(iIsEditable)? EditRect() : ViewRect();
       
  2679 
  2442 
  2680    //view and edit data pane rect should be the same
  2443    //view and edit data pane rect should be the same
  2681     TRect layoutRectOfDataPane = ViewRect();    
  2444     TRect layoutRectOfDataPane( Rect() );    
  2682 
  2445 
  2683     if ( hasBitmaps )
  2446     if ( hasBitmaps )
  2684         {
  2447         {
  2685         if (iBitmap)
  2448         if (iBitmap)
  2686             FormLayoutControlBitmap
  2449             FormLayoutControlBitmap
  2851             AknLayoutUtils::LayoutLabel( iCaption, aRect, R_AVKON_FORM_LABEL_NO_ICON ) ;
  2614             AknLayoutUtils::LayoutLabel( iCaption, aRect, R_AVKON_FORM_LABEL_NO_ICON ) ;
  2852             }
  2615             }
  2853         }
  2616         }
  2854     }
  2617     }
  2855 
  2618 
  2856 TSize CEikCaptionedControl::EditorControlSize() const 
       
  2857     {
       
  2858     return iEditorControlSize ;
       
  2859     }
       
  2860 
       
  2861 TInt CEikCaptionedControl::NumberOfLines() const
  2619 TInt CEikCaptionedControl::NumberOfLines() const
  2862 	{
  2620 	{
  2863 	return iNumberOfLines;
  2621 	return iNumberOfLines;
  2864 	}
       
  2865 
       
  2866 TInt CEikCaptionedControl::NumberOfLinesForScrollBar() const
       
  2867 	{
       
  2868 	if ( FormLayout() == CEikDialogPage::ESingle ) return NumberOfLines();
       
  2869 	return NumberOfLines()+1;
       
  2870 	}
  2622 	}
  2871 
  2623 
  2872 /**
  2624 /**
  2873  * Recalculates the number of required lines for a control.
  2625  * Recalculates the number of required lines for a control.
  2874  */
  2626  */
  2968     
  2720     
  2969     if(ControlIsAnEdwin(iControlType))
  2721     if(ControlIsAnEdwin(iControlType))
  2970         {
  2722         {
  2971         AknLayoutUtils::OverrideControlColorL(*this, EColorControlText, textColor );
  2723         AknLayoutUtils::OverrideControlColorL(*this, EColorControlText, textColor );
  2972         }
  2724         }
  2973     
  2725     }
  2974     }
  2726 
  2975 
       
  2976 /**
       
  2977  * Retrieves the Series 60 European LAF layout values from avkon.rh
       
  2978  *
       
  2979  */
       
  2980 void CEikCaptionedControl::GetAknLayoutValuesL()
       
  2981     {
       
  2982     TAknWindowLineLayout l = AknLayoutScalable_Avkon::form_field_data_pane(0).LayoutLine();
       
  2983     TRect parentRect = iAvkonAppUi->ClientRect();
       
  2984     TAknLayoutRect layoutRect;
       
  2985     layoutRect.LayoutRect( parentRect, l );
       
  2986     TRect rectDataPane( layoutRect.Rect() );
       
  2987 
       
  2988     iAknFormControlWidth = rectDataPane.Width();
       
  2989     iAknFormControlHeight = rectDataPane.Height();
       
  2990    }
       
  2991 
       
  2992     
       
  2993 
  2727 
  2994 TBool   CEikCaptionedControl::IsDisplayable() const
  2728 TBool   CEikCaptionedControl::IsDisplayable() const
  2995     {
  2729     {
  2996 /*
  2730 /*
  2997 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.
  3156 
  2890 
  3157 
  2891 
  3158 EXPORT_C const TPtrC CEikCaptionedControl::GetFullCaptionText() const
  2892 EXPORT_C const TPtrC CEikCaptionedControl::GetFullCaptionText() const
  3159     {
  2893     {
  3160     return *iCaptionText;
  2894     return *iCaptionText;
  3161     };
  2895     }
  3162 
  2896 
  3163 void CEikCaptionedControl::RegisterPageWithCaptionControl(CEikDialogPage* aPage)
  2897 void CEikCaptionedControl::RegisterPageWithCaptionControl(CEikDialogPage* aPage)
  3164     {
  2898     {
  3165     iDialogPage=aPage;
  2899     iDialogPage=aPage;
  3166     };
  2900     }
  3167 
  2901 
  3168 TInt CEikCaptionedControl::MaximumNumberOfControlLinesOnVisiblePage() const
  2902 TInt CEikCaptionedControl::MaximumNumberOfControlLinesOnVisiblePage() const
  3169     {
  2903     {
  3170 	_AKNTRACE_FUNC_ENTER;
  2904 	_AKNTRACE_FUNC_ENTER;
  3171 	TInt maxItems = 0;
  2905 	TInt maxItems = 0;
  3211         }
  2945         }
  3212 	//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
  3213     _AKNTRACE( "maxItems: [%d]", maxItems );
  2947     _AKNTRACE( "maxItems: [%d]", maxItems );
  3214     _AKNTRACE_FUNC_EXIT;
  2948     _AKNTRACE_FUNC_EXIT;
  3215     return maxItems;
  2949     return maxItems;
  3216     };
  2950     }
  3217 
  2951 
  3218 
       
  3219 TRect CEikCaptionedControl::ViewRect() const
       
  3220 
       
  3221     {
       
  3222 /* 
       
  3223 The Rect that the view mode is expecting is:
       
  3224 176 across 
       
  3225 21 high
       
  3226 set from 0,0
       
  3227 
       
  3228 We are
       
  3229 174 across
       
  3230 23 high
       
  3231 set from (1,1) relative to viewwin.
       
  3232 
       
  3233 To convert we must:
       
  3234 * Shrink(-1,1) to make Y cord and size equal, and X coord equal.
       
  3235 * add 1 to the BR X coord. to make X size equal.
       
  3236 */
       
  3237     TRect viewRectConversion(EditRect());
       
  3238     viewRectConversion.Shrink(0,1);
       
  3239     return viewRectConversion;
       
  3240     }
       
  3241 
       
  3242 TRect CEikCaptionedControl::EditRect() const
       
  3243     {
       
  3244     //The Rect provided by Rect() is fine  
       
  3245     return Rect();
       
  3246     } 
       
  3247 
  2952 
  3248 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)
  3249     {   
  2954     {   
  3250     if (!aNumberOfLines)
  2955     if (!aNumberOfLines)
  3251         return;
  2956         return;
  3391         AknLayoutUtils::LayoutEdwin( aEdwin, layoutRect, textLayout,
  3096         AknLayoutUtils::LayoutEdwin( aEdwin, layoutRect, textLayout,
  3392                                      colorIndex, 0, ETrue );
  3097                                      colorIndex, 0, ETrue );
  3393     	SetScrollRect(aEdwin, layoutRect, textLayout, aNumberOfLines);
  3098     	SetScrollRect(aEdwin, layoutRect, textLayout, aNumberOfLines);
  3394 	    }
  3099 	    }
  3395 
  3100 
  3396 	TBool isviewmode = !aIsEditable;
  3101 	aEdwin->SetSuppressBackgroundDrawing(!aIsEditable);
  3397 	aEdwin->SetSuppressBackgroundDrawing(isviewmode);
       
  3398     }
  3102     }
  3399 
  3103 
  3400 
  3104 
  3401 // Labels
  3105 // Labels
  3402 void CEikCaptionedControl::FormLayoutControlLabel(
  3106 void CEikCaptionedControl::FormLayoutControlLabel(
  3415     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) );
  3416     
  3120     
  3417     // Layout the label for the single line format
  3121     // Layout the label for the single line format
  3418     if (aSingleLayout) 
  3122     if (aSingleLayout) 
  3419         {
  3123         {
  3420         if (aIsEditable)
  3124         if (!aIsEditable)
  3421             {
       
  3422             // Do nothing; this is the default used
       
  3423             }
       
  3424         else
       
  3425             {
  3125             {
  3426             // This layout is dy
  3126             // This layout is dy
  3427             if (aBitmapPresent)
  3127             if (aBitmapPresent)
  3428                 {
  3128                 {
  3429                 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) );
  3562 void CEikCaptionedControl::FormLayoutControlPopfield(
  3262 void CEikCaptionedControl::FormLayoutControlPopfield(
  3563         CAknPopupField* aPopfield, const TRect& aParent, TBool aIsEditable,
  3263         CAknPopupField* aPopfield, const TRect& aParent, TBool aIsEditable,
  3564         TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent,
  3264         TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent,
  3565         TBool /*aIsFocused*/)
  3265         TBool /*aIsFocused*/)
  3566     {
  3266     {
  3567     TRect layoutRect = aParent;
  3267     TRect layoutRect( aParent );
  3568     TAknWindowLineLayout layoutData(AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1));
  3268     TAknWindowLineLayout layoutData(AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1));
  3569 	TAknTextLineLayout labelLayout(AknLayout::Form_data_field_texts_Line_2(0));
  3269 	TAknTextLineLayout labelLayout(AknLayout::Form_data_field_texts_Line_2(0));
  3570     if (!aNumberOfLines)
  3270     if (!aNumberOfLines)
  3571         return;
  3271         return;
  3572     
  3272     
  3585     TBool isText = EFalse;
  3285     TBool isText = EFalse;
  3586 	if (aPopfield->SelectionMode() == CAknPopupField::EAknPopupFieldLabelMode)
  3286 	if (aPopfield->SelectionMode() == CAknPopupField::EAknPopupFieldLabelMode)
  3587 		{
  3287 		{
  3588 		isText = ETrue;
  3288 		isText = ETrue;
  3589 		}
  3289 		}
  3590  
  3290 	
  3591     if (aSingleLayout)
  3291     if (aSingleLayout)
  3592         {
  3292         {
  3593         if (aIsEditable)
  3293         layoutData=AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1);
  3594             {
       
  3595             layoutData=AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1);
       
  3596             }
       
  3597         else
       
  3598             {
       
  3599 /* 
       
  3600 popupfields not specified in lists.  
       
  3601 Have to convert aParent to form equivalent and use that layout.
       
  3602 */
       
  3603             ConvertViewRectToEditRect(layoutRect);
       
  3604             layoutData=AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1);
       
  3605             }
       
  3606         }
  3294         }
  3607     else  // double layout
  3295     else  // double layout
  3608         {
  3296         {
  3609         TInt newpar = ( aBitmapPresent ? 1 : 0 ) ;
  3297         TInt newpar = ( aBitmapPresent ? 1 : 0 ) ;
  3610         if (!aBitmapPresent)
  3298         layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
  3611             {
  3299 
  3612             if (aIsEditable)
  3300         if ( aBitmapPresent && !aIsEditable )
  3613                 {
  3301             {
  3614                 layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
  3302             //move bitmap's width for display second line text
  3615                 }
  3303             TAknWindowLineLayout l = AknLayout::List_pane_elements__single_graphic_heading__Line_1();
  3616             else
  3304             TAknLayoutRect bmpRect;
  3617                 {
  3305             TRect tempRect;
  3618                 // have to convert Rect before doing this.
  3306             bmpRect.LayoutRect( tempRect, l );
  3619                 ConvertViewRectToEditRect(layoutRect);
  3307             layoutRect.iTl.iX += bmpRect.Rect().Width();
  3620                 layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
  3308             }
  3621                 }
  3309         }
  3622             }
       
  3623         else //AKN_LAYOUT_WINDOW_list_form_graphic_wide_pane
       
  3624             {
       
  3625             if (aIsEditable)
       
  3626                 {
       
  3627                 layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
       
  3628                 }
       
  3629             else
       
  3630                 {
       
  3631                 // have to convert Rect before doing this.
       
  3632                 ConvertViewRectToEditRect(layoutRect);
       
  3633                 layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
       
  3634 				//move bitmap's width for display second line text
       
  3635 		        TAknWindowLineLayout l = AknLayout::List_pane_elements__single_graphic_heading__Line_1();
       
  3636 		        TAknLayoutRect bmpRect;
       
  3637 		        TRect tempRect;
       
  3638 		        bmpRect.LayoutRect( tempRect, l );
       
  3639 				layoutRect.iTl.iX += bmpRect.Rect().Width();
       
  3640                 }
       
  3641             }
       
  3642         };
       
  3643 	aPopfield->SetFormFieldRect(layoutRect);
  3310 	aPopfield->SetFormFieldRect(layoutRect);
  3644 	if (isText)
  3311 	if (isText)
  3645 		{ // popup field will be same size as text element
  3312 		{ // popup field will be same size as text element
  3646 		TAknLayoutText r;
  3313 		TAknLayoutText r;
  3647 		r.LayoutText(layoutRect, labelLayout);
  3314 		r.LayoutText(layoutRect, labelLayout);
  3668         if (error == KErrNone )
  3335         if (error == KErrNone )
  3669             {
  3336             {
  3670             TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *aPopfield, EColorLabelText, textColor ) ); 
  3337             TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *aPopfield, EColorLabelText, textColor ) ); 
  3671             }          
  3338             }          
  3672         }
  3339         }
  3673         
       
  3674     }
  3340     }
  3675 
  3341 
  3676 // Password editor
  3342 // Password editor
  3677 void CEikCaptionedControl::FormLayoutControlSecretEditor(
  3343 void CEikCaptionedControl::FormLayoutControlSecretEditor(
  3678         CEikSecretEditor* aSecretEd, const TRect& aParent, TBool aIsEditable,
  3344         CEikSecretEditor* aSecretEd, const TRect& aParent, TBool aIsEditable,
  3740 // Slider control
  3406 // Slider control
  3741 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*/)
  3742     {   
  3408     {   
  3743     if (!aNumberOfLines)
  3409     if (!aNumberOfLines)
  3744         return;
  3410         return;
  3745     if (aSingleLayout)
  3411     
  3746         {
  3412     TRect parentRect( aParent );
  3747         if (aIsEditable)
  3413     
  3748             {
  3414     if ( !aSingleLayout )
  3749             aSlider->SetRect(aParent);
       
  3750             }
       
  3751         else
       
  3752             {
       
  3753 /* 
       
  3754 sliders not specified in lists.  
       
  3755 Have to convert aParent to form equivalent and use that layout.
       
  3756 */
       
  3757             TRect conversionRect(aParent);
       
  3758             ConvertViewRectToEditRect(conversionRect);
       
  3759             aSlider->SetRect(conversionRect);
       
  3760             }
       
  3761         }
       
  3762     else 
       
  3763         {
  3415         {
  3764         // Not currently specified, so making temporary alterations here.
  3416         // Not currently specified, so making temporary alterations here.
  3765         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();
  3766         TRect newParentRect(aParent);
  3418 
  3767         //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.
  3768         if( !aIsEditable )
  3420         if( !aIsEditable )
  3769 	        {
  3421 	        {
  3770 	        newParentRect.iTl.iX += baselineSkip;          	
  3422             parentRect.iTl.iX += baselineSkip;          	
  3771 	        }
  3423 	        }
  3772         newParentRect.iTl.iY += baselineSkip;
  3424         
  3773             
  3425         parentRect.iTl.iY += baselineSkip;
  3774         if (aIsEditable)
  3426         }
  3775             {
  3427     
  3776             aSlider->SetRect(newParentRect);
  3428     aSlider->SetRect( parentRect );
  3777             }
  3429     }
  3778         else 
  3430 
  3779             {
       
  3780             TRect conversionRect(newParentRect);
       
  3781             ConvertViewRectToEditRect(conversionRect);
       
  3782             aSlider->SetRect(conversionRect);
       
  3783             }
       
  3784         }   
       
  3785 
       
  3786         // Exteded skin support for sliders coded in slider file: \s60\AvKon\src\Aknslider.cpp
       
  3787     }
       
  3788 
       
  3789 void CEikCaptionedControl::ConvertViewRectToEditRect(TRect& aRect)
       
  3790     {
       
  3791     aRect.Grow(-1,1);
       
  3792     aRect.iBr.iX--;
       
  3793     }
       
  3794 
       
  3795 void CEikCaptionedControl::ConvertEditRectToViewRect(TRect& aRect)
       
  3796     {
       
  3797     aRect.Shrink(-1,1);
       
  3798     aRect.iBr.iX++;
       
  3799     }
       
  3800 
  3431 
  3801 // Standard access method for the form layout from within captioned control
  3432 // Standard access method for the form layout from within captioned control
  3802 CEikDialogPage::TFormLayoutSelection CEikCaptionedControl::FormLayout() const
  3433 CEikDialogPage::TFormLayoutSelection CEikCaptionedControl::FormLayout() const
  3803     {
  3434     {
  3804     // There is no undefined style, but initialize to single...
  3435     // There is no undefined style, but initialize to single...
  3805     CEikDialogPage::TFormLayoutSelection ret = CEikDialogPage::ESingle;
  3436     CEikDialogPage::TFormLayoutSelection ret = CEikDialogPage::ESingle;
  3806     if ( iDialogPage )
  3437     if ( iDialogPage )
       
  3438         {
  3807         ret = iDialogPage->FormLayout();
  3439         ret = iDialogPage->FormLayout();
  3808     
  3440         }
  3809     if (!iDialogPage)
  3441     else if (iFlags & EEikFormUseDoubleSpacedFormat) // similar to CEikDialogPage::ConstructFormFromResourceL()
  3810         {
  3442         {
  3811         if (iFlags & EEikFormUseDoubleSpacedFormat) // similar to CEikDialogPage::ConstructFormFromResourceL()
  3443         ret = CEikDialogPage::EDouble;
  3812             ret = CEikDialogPage::EDouble;
       
  3813         }
  3444         }
  3814     return ret;
  3445     return ret;
  3815     }
  3446     }
  3816 
  3447 
  3817 void CEikCaptionedControl::DrawFormSeparator( CWindowGc& gc ) const
  3448 void CEikCaptionedControl::DrawFormSeparator( CWindowGc& gc ) const
  3819     TAknLayoutRect sepLineRect;
  3450     TAknLayoutRect sepLineRect;
  3820     if ( FormLayout() == CEikDialogPage::ESingle )
  3451     if ( FormLayout() == CEikDialogPage::ESingle )
  3821         {
  3452         {
  3822         sepLineRect.LayoutRect
  3453         sepLineRect.LayoutRect
  3823             (
  3454             (
  3824             ViewRect(), 
  3455             Rect(), 
  3825             AKN_LAYOUT_WINDOW_List_pane_elements__single_heading__Line_2
  3456             AKN_LAYOUT_WINDOW_List_pane_elements__single_heading__Line_2
  3826             );
  3457             );
  3827         sepLineRect.DrawRect(gc);
  3458         sepLineRect.DrawRect(gc);
  3828 
  3459         }
  3829         }
       
  3830 //  else
       
  3831 //      {
       
  3832 // Currently no LAF specification for separator in double mode
       
  3833 //      sepLineRect.LayoutRect
       
  3834 //          (
       
  3835 //          ViewRect(), 
       
  3836 //          AKN_LAYOUT_WINDOW_List_pane_elements__double_graphic__Line_??
       
  3837 //          );
       
  3838 //      sepLineRect.DrawRect(gc);
       
  3839 //
       
  3840 //      }
       
  3841     }
  3460     }
  3842 
  3461 
  3843 void CEikCaptionedControl::DrawClosingLine() const
  3462 void CEikCaptionedControl::DrawClosingLine() const
  3844     {
  3463     {
  3845     if (iHighlightControl)
  3464     if (iHighlightControl)
  3921         iExtension->iEditModeHighlightControlContextPressed->SetParentContext(
  3540         iExtension->iEditModeHighlightControlContextPressed->SetParentContext(
  3922             GetDialogControlContext( iDialogPage ) );
  3541             GetDialogControlContext( iDialogPage ) );
  3923         }
  3542         }
  3924     else
  3543     else
  3925         {
  3544         {
  3926         outerRect = ViewRect() ;
       
  3927         innerRect = outerRect ;
       
  3928         innerRect.iTl = ViewFrameTopLeftRect( outerRect ).iBr ;
  3545         innerRect.iTl = ViewFrameTopLeftRect( outerRect ).iBr ;
  3929         innerRect.iBr = ViewFrameBottomRightRect( outerRect ).iTl ;
  3546         innerRect.iBr = ViewFrameBottomRightRect( outerRect ).iTl ;
  3930         iExtension->iViewModeHighlightControlContext->SetFrameRects( outerRect, innerRect );
  3547         iExtension->iViewModeHighlightControlContext->SetFrameRects( outerRect, innerRect );
  3931         iExtension->iViewModeHighlightControlContext->SetParentContext(
  3548         iExtension->iViewModeHighlightControlContext->SetParentContext(
  3932             GetDialogControlContext( iDialogPage ) );
  3549             GetDialogControlContext( iDialogPage ) );
  3961         AknListUtils::DrawSeparator( aGc, Rect(), textColor, skin );
  3578         AknListUtils::DrawSeparator( aGc, Rect(), textColor, skin );
  3962         aGc.SetBrushStyle( CGraphicsContext::ENullBrush ) ; 
  3579         aGc.SetBrushStyle( CGraphicsContext::ENullBrush ) ; 
  3963         }
  3580         }
  3964     else // Highlight Skinning.  Requires Frame
  3581     else // Highlight Skinning.  Requires Frame
  3965         {
  3582         {
       
  3583         TRect outerRect( Rect() );
       
  3584         TRect innerRect( outerRect );
       
  3585         
  3966         if ( iIsEditable )
  3586         if ( iIsEditable )
  3967             {
  3587             {
  3968             TRect innerRect( EditRect() ) ;
  3588             innerRect.iTl = EditFrameTopLeftRect( outerRect ).iBr ;
  3969             innerRect.iTl = EditFrameTopLeftRect( Rect() ).iBr ;
  3589             innerRect.iBr = EditFrameBottomRightRect( outerRect ).iTl ;
  3970             innerRect.iBr = EditFrameBottomRightRect( Rect() ).iTl ;
       
  3971 
  3590 
  3972             MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ; 
  3591             MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ; 
  3973             AknsDrawUtils::Background( skin, parentCc, this, aGc, Rect() ) ;
  3592             AknsDrawUtils::Background( skin, parentCc, this, aGc, outerRect ) ;
  3974 
  3593 
  3975             AknListUtils::DrawSeparator( aGc, Rect(), textColor, skin );
  3594             AknListUtils::DrawSeparator( aGc, outerRect, textColor, skin );
  3976             
  3595             
  3977             // Set the rectangle(s) for the Frame context
  3596             // Set the rectangle(s) for the Frame context
  3978             iExtension->iEditModeHighlightControlContext->SetFrameRects( EditRect(), innerRect ) ;
  3597             iExtension->iEditModeHighlightControlContext->SetFrameRects( outerRect, innerRect ) ;
  3979             iExtension->iEditModeHighlightControlContextPressed->SetFrameRects( EditRect(), innerRect ) ;
  3598             iExtension->iEditModeHighlightControlContextPressed->SetFrameRects( outerRect, innerRect ) ;
  3980             
  3599             
  3981             AknsDrawUtils::DrawFrame( skin, aGc, EditRect(), innerRect,
  3600             AknsDrawUtils::DrawFrame( skin, aGc, outerRect, innerRect,
  3982                                       PressedDownState() ?
  3601                                       PressedDownState() ?
  3983                                       KAknsIIDQsnFrListPressed : KAknsIIDQsnFrInput, KAknsIIDDefault );
  3602                                       KAknsIIDQsnFrListPressed : KAknsIIDQsnFrInput, KAknsIIDDefault );
  3984             }
  3603             }
  3985         else // View Mode highlight
  3604         else // View Mode highlight
  3986             {
  3605             {
  3987             TBool drawOk = EFalse;
  3606             TBool drawOk = EFalse;
  3988             TRect viewRect( ViewRect() );
  3607             innerRect.iTl = ViewFrameTopLeftRect( outerRect ).iBr;
  3989             TRect innerRect( viewRect );
  3608             innerRect.iBr = ViewFrameBottomRightRect( outerRect ).iTl ;
  3990             innerRect.iTl = ViewFrameTopLeftRect( viewRect ).iBr;
       
  3991             innerRect.iTl.iX-- ; innerRect.iTl.iY--;
       
  3992             innerRect.iBr = ViewFrameBottomRightRect( viewRect ).iTl ;
       
  3993     
  3609     
  3994             // The bit around the outside must use the parent's control context
  3610             // The bit around the outside must use the parent's control context
  3995             MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage );
  3611             MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage );
  3996             AknsDrawUtils::BackgroundBetweenRects( skin, parentCc, this, aGc, 
  3612             AknsDrawUtils::Background( skin, parentCc, this, aGc, outerRect ) ;
  3997                     Rect(), innerRect );
       
  3998     
  3613     
  3999             AknListUtils::DrawSeparator( aGc, Rect(), textColor, skin );
  3614             AknListUtils::DrawSeparator( aGc, outerRect, textColor, skin );
  4000 
  3615 
  4001             // Draw the animation itself
  3616             // Draw the animation itself
  4002             if ( iExtension->IsHighlightAnimated() 
  3617             if ( iExtension->IsHighlightAnimated() 
  4003                     && iExtension->iAnimation->Animation() )
  3618                     && iExtension->iAnimation->Animation() )
  4004                 {
  3619                 {
  4005                 drawOk = iExtension->iAnimation->Animation()->Render( aGc, 
  3620                 drawOk = iExtension->iAnimation->Animation()->Render( aGc, 
  4006                         viewRect );
  3621                         outerRect );
  4007                 }
  3622                 }
  4008     
  3623     
  4009             if ( !drawOk )
  3624             if ( !drawOk )
  4010                 {
  3625                 {
  4011                 // Set the rectangle(s) for the Frame context
  3626                 // Set the rectangle(s) for the Frame context
  4012                 iExtension->iViewModeHighlightControlContext->SetFrameRects( 
  3627                 iExtension->iViewModeHighlightControlContext->SetFrameRects( 
  4013                         viewRect, innerRect ) ;
  3628                         outerRect, innerRect ) ;
  4014                 iExtension->iViewModeHighlightControlContextPressed->
  3629                 iExtension->iViewModeHighlightControlContextPressed->
  4015                     SetFrameRects( viewRect, innerRect ) ;
  3630                     SetFrameRects( outerRect, innerRect ) ;
  4016                 
  3631                 
  4017                 AknsDrawUtils::DrawFrame( skin, aGc, viewRect, innerRect,
  3632                 AknsDrawUtils::DrawFrame( skin, aGc, outerRect, innerRect,
  4018                         PressedDownState() ? KAknsIIDQsnFrListPressed : 
  3633                         PressedDownState() ? KAknsIIDQsnFrListPressed : 
  4019                         KAknsIIDQsnFrList, KAknsIIDDefault );
  3634                         KAknsIIDQsnFrList, KAknsIIDDefault );
  4020                 }
  3635                 }
  4021             }
  3636             }
  4022         }
  3637         }
  4152         TRect rectElements( layoutRect.Rect() );
  3767         TRect rectElements( layoutRect.Rect() );
  4153 
  3768 
  4154         User::LeaveIfError(AknIconUtils::SetSize(aBitmap, 
  3769         User::LeaveIfError(AknIconUtils::SetSize(aBitmap, 
  4155                               rectElements.Size() ));
  3770                               rectElements.Size() ));
  4156         }
  3771         }
  4157 /*        
  3772     }
  4158     
       
  4159     if (iIsFormControl)
       
  4160         {
       
  4161         if (iIsEditable)
       
  4162             {
       
  4163             if (iBitmap && iBitmap->Bitmap())
       
  4164                 {
       
  4165                 AknIconUtils::SetSize(CONST_CAST(CFbsBitmap*, iBitmap->Bitmap()), 
       
  4166                                         TSize(AKN_LAYOUT_WINDOW_Form_data_field_elements_Line_4.iW, 
       
  4167                                         AKN_LAYOUT_WINDOW_Form_data_field_elements_Line_4.iH));
       
  4168                 }
       
  4169             }
       
  4170         else
       
  4171             {
       
  4172             if (iBitmap && iBitmap->Bitmap())
       
  4173                 {
       
  4174                 AknIconUtils::SetSize(CONST_CAST(CFbsBitmap*, iBitmap->Bitmap()), 
       
  4175                                         TSize(AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iW, 
       
  4176                                         AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iH));
       
  4177                 }
       
  4178             }
       
  4179         }
       
  4180     else
       
  4181         {
       
  4182         if (iBitmap && iBitmap->Bitmap())
       
  4183             {
       
  4184             AknIconUtils::SetSize(CONST_CAST(CFbsBitmap*, iBitmap->Bitmap()), 
       
  4185                         TSize(AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iW, 
       
  4186                         AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iH));
       
  4187             }
       
  4188         }                       */
       
  4189     }
       
  4190     
       
  4191 
  3773 
  4192 
  3774 
  4193 // -----------------------------------------------------------------------------
  3775 // -----------------------------------------------------------------------------
  4194 // CEikCaptionedControl::HandleControlEventL
  3776 // CEikCaptionedControl::HandleControlEventL
  4195 // Implementation of MCoeControlObserver observer interface for observing touch button 
  3777 // Implementation of MCoeControlObserver observer interface for observing touch button 
  4279     else
  3861     else
  4280         SetFocus(aSelected,EDrawNow); 
  3862         SetFocus(aSelected,EDrawNow); 
  4281     }
  3863     }
  4282 
  3864 
  4283 
  3865 
  4284 void CEikCaptionedControl::SetPartiallyVisible( TBool aPVisible )
       
  4285     {
       
  4286     iExtension->iPartiallyVisible = aPVisible;
       
  4287     }
       
  4288     
       
  4289 /*  
  3866 /*  
  4290  * Special Label Class which appends colon to label text
  3867  * Special Label Class which appends colon to label text
  4291  */
  3868  */
  4292 
  3869 
  4293 CEikCapCLabel::CEikCapCLabel() : iIsColonEnabled( EFalse ) 
  3870 CEikCapCLabel::CEikCapCLabel() : iIsColonEnabled( EFalse )