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 |
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 ) |
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 } |
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); |
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) ) ; |
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; |
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 |
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 } |
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; |
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(); |
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 ) |
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 { |
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. |
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; |
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 |
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 |
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 |