branch | CompilerCompatibility |
changeset 8 | b57f3d42a10e |
parent 4 | 8ca85d2f0db7 |
child 10 | 9f56a4e1b8ab |
6:05fbbb041e1f | 8:b57f3d42a10e |
---|---|
78 #include <avkon.mbg> |
78 #include <avkon.mbg> |
79 // For MAknMfneCommandObserver |
79 // For MAknMfneCommandObserver |
80 #include <aknmfnecommandobserver.h> |
80 #include <aknmfnecommandobserver.h> |
81 #endif //if defined( RD_SCALABLE_UI_V2) |
81 #endif //if defined( RD_SCALABLE_UI_V2) |
82 |
82 |
83 |
83 #include "akntrace.h" |
84 |
84 |
85 GLREF_C void Panic(TEikDialogPanic aPanic); |
85 GLREF_C void Panic(TEikDialogPanic aPanic); |
86 |
86 |
87 const TInt KViewHighlightColor = 244 ; |
87 const TInt KViewHighlightColor = 244 ; |
88 // const TInt KViewHighlightShadowColor = 222 ; |
88 // const TInt KViewHighlightShadowColor = 222 ; |
392 iFeedback( MTouchFeedback::Instance() ), |
392 iFeedback( MTouchFeedback::Instance() ), |
393 iIdle(NULL), |
393 iIdle(NULL), |
394 iIdleData(NULL), |
394 iIdleData(NULL), |
395 iPartiallyVisible( EFalse ) |
395 iPartiallyVisible( EFalse ) |
396 { |
396 { |
397 _AKNTRACE_FUNC_ENTER; |
|
397 if ( iAvkonAppUi ) |
398 if ( iAvkonAppUi ) |
398 { |
399 { |
399 iUsesSingleClick = iAvkonAppUi->IsSingleClickCompatible(); |
400 iUsesSingleClick = iAvkonAppUi->IsSingleClickCompatible(); |
400 } |
401 } |
402 _AKNTRACE_FUNC_EXIT; |
|
401 }; |
403 }; |
402 |
404 |
403 CEikCapCExtension::~CEikCapCExtension() |
405 CEikCapCExtension::~CEikCapCExtension() |
404 { |
406 { |
407 _AKNTRACE_FUNC_ENTER; |
|
405 // Remember to unacquire animation |
408 // Remember to unacquire animation |
406 if( iAnimation && iSelf ) |
409 if( iAnimation && iSelf ) |
407 { |
410 { |
408 if( iSelf->iDialogPage ) |
411 if( iSelf->iDialogPage ) |
409 iSelf->iDialogPage->AcquireAnim( EFalse, this ); |
412 iSelf->iDialogPage->AcquireAnim( EFalse, this ); |
410 } |
413 } |
414 _AKNTRACE_FUNC_EXIT; |
|
411 } |
415 } |
412 |
416 |
413 TBool CEikCapCExtension::IsHighlightAnimated() const |
417 TBool CEikCapCExtension::IsHighlightAnimated() const |
414 { |
418 { |
415 if( iAnimation ) |
419 if( iAnimation ) |
422 return EFalse; |
426 return EFalse; |
423 } |
427 } |
424 |
428 |
425 void CEikCapCExtension::SkinChanged() |
429 void CEikCapCExtension::SkinChanged() |
426 { |
430 { |
431 _AKNTRACE_FUNC_ENTER; |
|
427 iAnimation = NULL; |
432 iAnimation = NULL; |
428 if( iSelf->iDialogPage ) |
433 if( iSelf->iDialogPage ) |
429 iAnimation = iSelf->iDialogPage->AcquireAnim( ETrue, this ); |
434 iAnimation = iSelf->iDialogPage->AcquireAnim( ETrue, this ); |
430 |
435 |
431 if( iAnimation ) |
436 if( iAnimation ) |
432 { |
437 { |
433 iAnimation->SetHighlightSize( iSelf->Rect().Size() ); |
438 iAnimation->SetHighlightSize( iSelf->Rect().Size() ); |
434 } |
439 } |
440 _AKNTRACE_FUNC_EXIT; |
|
435 } |
441 } |
436 |
442 |
437 void CEikCapCExtension::HandleLayoutSwitch( const TSize& aSize ) |
443 void CEikCapCExtension::HandleLayoutSwitch( const TSize& aSize ) |
438 { |
444 { |
445 _AKNTRACE_FUNC_ENTER; |
|
439 if( iAnimation ) |
446 if( iAnimation ) |
440 { |
447 { |
441 if( iAnimation->Size() == aSize ) |
448 if( iAnimation->Size() == aSize ) |
442 { |
449 { |
443 // No need to resize, just change the background used |
450 // No need to resize, just change the background used |
447 else |
454 else |
448 { |
455 { |
449 iAnimation->SetHighlightSize( aSize ); |
456 iAnimation->SetHighlightSize( aSize ); |
450 } |
457 } |
451 } |
458 } |
459 _AKNTRACE_FUNC_EXIT; |
|
452 } |
460 } |
453 |
461 |
454 void CEikCapCExtension::AnimFrameReady() |
462 void CEikCapCExtension::AnimFrameReady() |
455 { |
463 { |
456 if( iSelf ) |
464 if( iSelf ) |
587 * This draws the form highlight line |
595 * This draws the form highlight line |
588 * |
596 * |
589 */ |
597 */ |
590 void CEikCaptionedControlFormHighlightLine::Draw(const TRect& /*aRect*/) const |
598 void CEikCaptionedControlFormHighlightLine::Draw(const TRect& /*aRect*/) const |
591 { |
599 { |
600 _AKNTRACE_FUNC_ENTER; |
|
592 CWindowGc& gc=SystemGc(); |
601 CWindowGc& gc=SystemGc(); |
593 TBool drawn = EFalse; |
602 TBool drawn = EFalse; |
594 |
603 |
595 if ( IsVisible() && DrawingSkins() ) |
604 if ( IsVisible() && DrawingSkins() ) |
596 { |
605 { |
656 gc.SetPenColor( line3Rect.Color() ) ; // black line; |
665 gc.SetPenColor( line3Rect.Color() ) ; // black line; |
657 gc.DrawRect(rectToDraw); |
666 gc.DrawRect(rectToDraw); |
658 } |
667 } |
659 } |
668 } |
660 } |
669 } |
670 _AKNTRACE_FUNC_EXIT; |
|
661 }; |
671 }; |
662 |
672 |
663 |
673 |
664 TInt CEikCaptionedControlFormHighlightLine::HeightOfHighlight(TTopOrBottom aTopOrBottom) const |
674 TInt CEikCaptionedControlFormHighlightLine::HeightOfHighlight(TTopOrBottom aTopOrBottom) const |
665 { |
675 { |
696 } |
706 } |
697 |
707 |
698 |
708 |
699 TBool CEikCaptionedControlFormHighlightLine::DrawingSkins() const |
709 TBool CEikCaptionedControlFormHighlightLine::DrawingSkins() const |
700 { |
710 { |
711 _AKNTRACE_FUNC_ENTER; |
|
701 TBool drawingSkins = EFalse; |
712 TBool drawingSkins = EFalse; |
702 if ( AknsUtils::AvkonSkinEnabled() ) |
713 if ( AknsUtils::AvkonSkinEnabled() ) |
703 { |
714 { |
704 MAknsSkinInstance* skin = AknsUtils::SkinInstance() ; |
715 MAknsSkinInstance* skin = AknsUtils::SkinInstance() ; |
705 MAknsControlContext* cc = AknsDrawUtils::ControlContext( &iCapCtl ) ; |
716 MAknsControlContext* cc = AknsDrawUtils::ControlContext( &iCapCtl ) ; |
706 CWindowGc& gc = SystemGc(); |
717 CWindowGc& gc = SystemGc(); |
707 drawingSkins = AknsDrawUtils::Background( skin, cc, this, gc, Rect(), KAknsDrawParamPrepareOnly ); |
718 drawingSkins = AknsDrawUtils::Background( skin, cc, this, gc, Rect(), KAknsDrawParamPrepareOnly ); |
708 } |
719 } |
720 _AKNTRACE_FUNC_EXIT; |
|
709 return drawingSkins; |
721 return drawingSkins; |
710 } |
722 } |
711 |
723 |
712 EXPORT_C CEikCaptionedControl::CEikCaptionedControl() : iHasAppendedEditIndicator(EFalse) |
724 EXPORT_C CEikCaptionedControl::CEikCaptionedControl() : iHasAppendedEditIndicator(EFalse) |
713 { |
725 { |
726 _AKNTRACE_FUNC_ENTER; |
|
714 iNumberOfLines = 1 ; // default starting value |
727 iNumberOfLines = 1 ; // default starting value |
715 AKNTASHOOK_ADD( this, "CEikCaptionedControl" ); |
728 AKNTASHOOK_ADD( this, "CEikCaptionedControl" ); |
729 _AKNTRACE_FUNC_EXIT; |
|
716 } |
730 } |
717 |
731 |
718 EXPORT_C CEikCaptionedControl::~CEikCaptionedControl() |
732 EXPORT_C CEikCaptionedControl::~CEikCaptionedControl() |
719 { |
733 { |
734 _AKNTRACE_FUNC_ENTER; |
|
720 AKNTASHOOK_REMOVE(); |
735 AKNTASHOOK_REMOVE(); |
721 AknsUtils::DeregisterControlPosition(this); |
736 AknsUtils::DeregisterControlPosition(this); |
722 AknsUtils::DeregisterControlPosition(iBitmap); |
737 AknsUtils::DeregisterControlPosition(iBitmap); |
723 AknsUtils::DeregisterControlPosition(iCaption); |
738 AknsUtils::DeregisterControlPosition(iCaption); |
724 AknsUtils::DeregisterControlPosition(iControl); |
739 AknsUtils::DeregisterControlPosition(iControl); |
747 delete iExtension->iViewModeHighlightControlContextPressed; |
762 delete iExtension->iViewModeHighlightControlContextPressed; |
748 delete iExtension->iIndicator; |
763 delete iExtension->iIndicator; |
749 delete iExtension->iIndicator2; |
764 delete iExtension->iIndicator2; |
750 } |
765 } |
751 delete iExtension ; |
766 delete iExtension ; |
767 _AKNTRACE_FUNC_EXIT; |
|
752 } |
768 } |
753 |
769 |
754 EXPORT_C void CEikCaptionedControl::SetPointerEventObserver(MPointerEventObserver *aObserver) |
770 EXPORT_C void CEikCaptionedControl::SetPointerEventObserver(MPointerEventObserver *aObserver) |
755 { |
771 { |
756 if (iExtension) |
772 if (iExtension) |
790 return KErrNone; |
806 return KErrNone; |
791 } |
807 } |
792 |
808 |
793 EXPORT_C TSize CEikCaptionedControl::MinimumSize() |
809 EXPORT_C TSize CEikCaptionedControl::MinimumSize() |
794 { |
810 { |
811 _AKNTRACE_FUNC_ENTER; |
|
795 // NTBD Add an extra line for those with the label on a separate |
812 // NTBD Add an extra line for those with the label on a separate |
796 if ( iIsFormControl ) |
813 if ( iIsFormControl ) |
797 { |
814 { |
798 if (iControl->IsDimmed()) |
815 if (iControl->IsDimmed()) |
799 { |
816 { |
800 iSize = TSize( 0, 0) ; |
817 iSize = TSize( 0, 0) ; |
818 _AKNTRACE_FUNC_EXIT; |
|
801 return iSize; |
819 return iSize; |
802 } |
820 } |
803 // We can get the minimum size from the resource - and the size of the editor (EditorControlSize() in lines) |
821 // We can get the minimum size from the resource - and the size of the editor (EditorControlSize() in lines) |
804 CalculateNumberOfLinesForControl( ENotSupplied ); |
822 CalculateNumberOfLinesForControl( ENotSupplied ); |
805 |
823 |
870 iNumberOfLines = 0; |
888 iNumberOfLines = 0; |
871 } |
889 } |
872 // ------------------------ |
890 // ------------------------ |
873 |
891 |
874 iSize = layout.Size(); |
892 iSize = layout.Size(); |
893 _AKNTRACE_FUNC_EXIT; |
|
875 return ( iSize ) ; |
894 return ( iSize ) ; |
876 } |
895 } |
877 else |
896 else |
878 { |
897 { |
879 TSize size=iControl->MinimumSize(); |
898 TSize size=iControl->MinimumSize(); |
946 iMinSize=size; |
965 iMinSize=size; |
947 |
966 |
948 if ( iDoNotDisplay ) |
967 if ( iDoNotDisplay ) |
949 // This flag is set if the control is not to be shown - so set it's height to zero |
968 // This flag is set if the control is not to be shown - so set it's height to zero |
950 iMinSize.iHeight = 0 ; |
969 iMinSize.iHeight = 0 ; |
970 _AKNTRACE_FUNC_EXIT; |
|
951 return(size); |
971 return(size); |
952 } |
972 } |
953 } |
973 } |
954 /** |
974 /** |
955 * This routine should always called when any state affecting layout changed, including |
975 * This routine should always called when any state affecting layout changed, including |
957 * |
977 * |
958 * This is also called from Cone as a matter of course when SetRect is called on the object. |
978 * This is also called from Cone as a matter of course when SetRect is called on the object. |
959 */ |
979 */ |
960 EXPORT_C void CEikCaptionedControl::SizeChanged() |
980 EXPORT_C void CEikCaptionedControl::SizeChanged() |
961 { |
981 { |
982 _AKNTRACE_FUNC_ENTER; |
|
962 // Resize the animation |
983 // Resize the animation |
963 if( iIsFormControl && iExtension->iAnimation ) |
984 if( iIsFormControl && iExtension->iAnimation ) |
964 { |
985 { |
965 iExtension->iAnimation->SetHighlightSize( Rect().Size() ); |
986 iExtension->iAnimation->SetHighlightSize( Rect().Size() ); |
966 } |
987 } |
1123 else if ( mfne ) |
1144 else if ( mfne ) |
1124 { |
1145 { |
1125 mfne->SetSuppressBackgroundDrawing( EFalse ); |
1146 mfne->SetSuppressBackgroundDrawing( EFalse ); |
1126 } |
1147 } |
1127 } |
1148 } |
1149 _AKNTRACE_FUNC_EXIT; |
|
1128 } |
1150 } |
1129 |
1151 |
1130 |
1152 |
1131 void CEikCaptionedControl::StretchComponents() |
1153 void CEikCaptionedControl::StretchComponents() |
1132 { |
1154 { |
1364 } |
1386 } |
1365 |
1387 |
1366 |
1388 |
1367 static TInt IdleCallback(TAny *aAny) |
1389 static TInt IdleCallback(TAny *aAny) |
1368 { |
1390 { |
1391 _AKNTRACE_FUNC_ENTER; |
|
1369 CIdleCallbackData *data = (CIdleCallbackData*)aAny; |
1392 CIdleCallbackData *data = (CIdleCallbackData*)aAny; |
1370 CEikCapCExtension *ext = data->iExt; |
1393 CEikCapCExtension *ext = data->iExt; |
1371 CEikCaptionedControl *ctrl = data->iCtrl; |
1394 CEikCaptionedControl *ctrl = data->iCtrl; |
1372 |
1395 |
1373 CEikEdwin *edwin = (CEikEdwin*)ctrl->iControl; |
1396 CEikEdwin *edwin = (CEikEdwin*)ctrl->iControl; |
1376 TRAP_IGNORE ( edwin->SetCursorPosL( (textLength>=0 ? textLength : 0), EFalse) ); |
1399 TRAP_IGNORE ( edwin->SetCursorPosL( (textLength>=0 ? textLength : 0), EFalse) ); |
1377 delete ext->iIdle; |
1400 delete ext->iIdle; |
1378 ext->iIdle = NULL; |
1401 ext->iIdle = NULL; |
1379 delete data; |
1402 delete data; |
1380 ext->iIdleData = NULL; |
1403 ext->iIdleData = NULL; |
1404 _AKNTRACE_FUNC_EXIT; |
|
1381 return EFalse; |
1405 return EFalse; |
1382 } |
1406 } |
1383 |
1407 |
1384 void CEikCaptionedControl::ScrollBackEditor() |
1408 void CEikCaptionedControl::ScrollBackEditor() |
1385 { |
1409 { |
1410 _AKNTRACE_FUNC_ENTER; |
|
1386 // |
1411 // |
1387 // For long single-line edwin, scroll horizontally to show beginning of the edwin |
1412 // For long single-line edwin, scroll horizontally to show beginning of the edwin |
1388 // when focus changes away from the edwin. |
1413 // when focus changes away from the edwin. |
1389 // |
1414 // |
1390 if ( iIsEditable && ControlIsAnEdwin(iControlType) ) |
1415 if ( iIsEditable && ControlIsAnEdwin(iControlType) ) |
1395 iExtension->iIdleData->iCtrl = this; |
1420 iExtension->iIdleData->iCtrl = this; |
1396 iExtension->iIdleData->iExt = iExtension; |
1421 iExtension->iIdleData->iExt = iExtension; |
1397 iExtension->iIdle = CIdle::NewL(0); |
1422 iExtension->iIdle = CIdle::NewL(0); |
1398 iExtension->iIdle->Start(TCallBack(&IdleCallback, iExtension->iIdleData)); |
1423 iExtension->iIdle->Start(TCallBack(&IdleCallback, iExtension->iIdleData)); |
1399 } |
1424 } |
1425 _AKNTRACE_FUNC_EXIT; |
|
1400 } |
1426 } |
1401 |
1427 |
1402 EXPORT_C void CEikCaptionedControl::FocusChanged(TDrawNow aDrawNow) |
1428 EXPORT_C void CEikCaptionedControl::FocusChanged(TDrawNow aDrawNow) |
1403 { |
1429 { |
1430 _AKNTRACE_FUNC_ENTER; |
|
1404 // Only form controls need to adapt animation to focus changes. |
1431 // Only form controls need to adapt animation to focus changes. |
1405 if( iExtension->iAnimation && iIsFormControl ) |
1432 if( iExtension->iAnimation && iIsFormControl ) |
1406 { |
1433 { |
1407 // Pause animation when losing focus (other states ignored) |
1434 // Pause animation when losing focus (other states ignored) |
1408 if( !IsFocused() ) |
1435 if( !IsFocused() ) |
1479 } |
1506 } |
1480 |
1507 |
1481 |
1508 |
1482 if (aDrawNow && iCapCFlags&EUsesEars && IsReadyToDraw()) |
1509 if (aDrawNow && iCapCFlags&EUsesEars && IsReadyToDraw()) |
1483 DrawEarsNow(EBothEars); |
1510 DrawEarsNow(EBothEars); |
1511 _AKNTRACE_FUNC_EXIT; |
|
1484 } |
1512 } |
1485 |
1513 |
1486 |
1514 |
1487 |
1515 |
1488 void CEikCaptionedControl::DrawEarsNow(TWhichEars aEar) const |
1516 void CEikCaptionedControl::DrawEarsNow(TWhichEars aEar) const |
1489 { |
1517 { |
1518 _AKNTRACE_FUNC_ENTER; |
|
1490 ActivateGc(); |
1519 ActivateGc(); |
1491 DrawEars(aEar); |
1520 DrawEars(aEar); |
1492 DeactivateGc(); |
1521 DeactivateGc(); |
1522 _AKNTRACE_FUNC_EXIT; |
|
1493 } |
1523 } |
1494 |
1524 |
1495 void CEikCaptionedControl::DrawEars(TWhichEars aEar) const |
1525 void CEikCaptionedControl::DrawEars(TWhichEars aEar) const |
1496 { |
1526 { |
1497 if (aEar&ELeftEar) |
1527 if (aEar&ELeftEar) |
1555 } |
1585 } |
1556 |
1586 |
1557 |
1587 |
1558 EXPORT_C void CEikCaptionedControl::Draw(const TRect& aRect) const |
1588 EXPORT_C void CEikCaptionedControl::Draw(const TRect& aRect) const |
1559 { |
1589 { |
1590 _AKNTRACE_FUNC_ENTER; |
|
1560 if (iIsFormControl ) |
1591 if (iIsFormControl ) |
1561 DrawAsForm( aRect ); |
1592 DrawAsForm( aRect ); |
1562 else |
1593 else |
1563 DrawAsEikonDialog( aRect ); |
1594 DrawAsEikonDialog( aRect ); |
1595 _AKNTRACE_FUNC_EXIT; |
|
1564 } |
1596 } |
1565 |
1597 |
1566 void CEikCaptionedControl::DrawAsForm( const TRect& aRect ) const |
1598 void CEikCaptionedControl::DrawAsForm( const TRect& aRect ) const |
1567 { |
1599 { |
1568 |
1600 _AKNTRACE_FUNC_ENTER; |
1569 CWindowGc& gc=SystemGc(); |
1601 CWindowGc& gc=SystemGc(); |
1570 |
1602 |
1571 gc.SetPenStyle(CGraphicsContext::ENullPen); |
1603 gc.SetPenStyle(CGraphicsContext::ENullPen); |
1572 if ( iRefresh ) |
1604 if ( iRefresh ) |
1573 { |
1605 { |
1607 DrawAsFormInEditMode( aRect ); |
1639 DrawAsFormInEditMode( aRect ); |
1608 else if (!iIsEditable && iIsCurrentLine ) |
1640 else if (!iIsEditable && iIsCurrentLine ) |
1609 DrawAsFormInViewMode( aRect ); |
1641 DrawAsFormInViewMode( aRect ); |
1610 else |
1642 else |
1611 DrawAsFormUnFocusedLine( aRect ); |
1643 DrawAsFormUnFocusedLine( aRect ); |
1644 _AKNTRACE_FUNC_EXIT; |
|
1612 } |
1645 } |
1613 |
1646 |
1614 void CEikCaptionedControl::DrawAsFormInEditMode( const TRect& /*aRect*/ ) const |
1647 void CEikCaptionedControl::DrawAsFormInEditMode( const TRect& /*aRect*/ ) const |
1615 { |
1648 { |
1649 _AKNTRACE_FUNC_ENTER; |
|
1616 CWindowGc& gc=SystemGc(); |
1650 CWindowGc& gc=SystemGc(); |
1617 |
1651 |
1618 gc.SetPenStyle(CGraphicsContext::ENullPen); |
1652 gc.SetPenStyle(CGraphicsContext::ENullPen); |
1619 |
1653 |
1620 if ( iRefresh ) |
1654 if ( iRefresh ) |
1682 ); |
1716 ); |
1683 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
1717 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
1684 gc.SetBrushStyle( CGraphicsContext::ENullBrush ) ; |
1718 gc.SetBrushStyle( CGraphicsContext::ENullBrush ) ; |
1685 gc.SetPenColor( line2Rect.Color() ) ; |
1719 gc.SetPenColor( line2Rect.Color() ) ; |
1686 gc.DrawRect(line2Rect.Rect()); |
1720 gc.DrawRect(line2Rect.Rect()); |
1721 _AKNTRACE_FUNC_EXIT; |
|
1687 } |
1722 } |
1688 |
1723 |
1689 |
1724 |
1690 void CEikCaptionedControl::DrawAsFormInViewMode( const TRect& /*aRect*/ ) const |
1725 void CEikCaptionedControl::DrawAsFormInViewMode( const TRect& /*aRect*/ ) const |
1691 { |
1726 { |
1727 _AKNTRACE_FUNC_ENTER; |
|
1692 CWindowGc& gc=SystemGc(); |
1728 CWindowGc& gc=SystemGc(); |
1693 |
1729 |
1694 gc.SetPenStyle(CGraphicsContext::ENullPen); |
1730 gc.SetPenStyle(CGraphicsContext::ENullPen); |
1695 |
1731 |
1696 if ( iRefresh ) |
1732 if ( iRefresh ) |
1747 TPoint(iVerticalLineXPosition,Rect().iTl.iY+2)); |
1783 TPoint(iVerticalLineXPosition,Rect().iTl.iY+2)); |
1748 } |
1784 } |
1749 |
1785 |
1750 gc.DrawLine(TPoint(iVerticalLineXPosition,Rect().iBr.iY-1), |
1786 gc.DrawLine(TPoint(iVerticalLineXPosition,Rect().iBr.iY-1), |
1751 TPoint(iVerticalLineXPosition,Rect().iBr.iY+1)); |
1787 TPoint(iVerticalLineXPosition,Rect().iBr.iY+1)); |
1788 _AKNTRACE_FUNC_EXIT; |
|
1752 } |
1789 } |
1753 |
1790 |
1754 void CEikCaptionedControl::DrawAsFormUnFocusedLine( const TRect& /*aRect*/ ) const |
1791 void CEikCaptionedControl::DrawAsFormUnFocusedLine( const TRect& /*aRect*/ ) const |
1755 { |
1792 { |
1793 _AKNTRACE_FUNC_ENTER; |
|
1756 CWindowGc& gc=SystemGc(); |
1794 CWindowGc& gc=SystemGc(); |
1757 |
1795 |
1758 gc.SetPenStyle(CGraphicsContext::ENullPen); |
1796 gc.SetPenStyle(CGraphicsContext::ENullPen); |
1759 |
1797 |
1760 if ( iRefresh ) |
1798 if ( iRefresh ) |
1789 //draw separator line unless This control is at or off the top of the page. |
1827 //draw separator line unless This control is at or off the top of the page. |
1790 TBool atTopOfPage = (iDialogPage && iDialogPage->IsAtOrOffTopOfPage(iControl) ); |
1828 TBool atTopOfPage = (iDialogPage && iDialogPage->IsAtOrOffTopOfPage(iControl) ); |
1791 if (HasSeparator() && !atTopOfPage) |
1829 if (HasSeparator() && !atTopOfPage) |
1792 DrawFormSeparator( gc ); |
1830 DrawFormSeparator( gc ); |
1793 } |
1831 } |
1832 _AKNTRACE_FUNC_EXIT; |
|
1794 } |
1833 } |
1795 |
1834 |
1796 |
1835 |
1797 // --------------------------------------------------------------------------- |
1836 // --------------------------------------------------------------------------- |
1798 // CEikCaptionedControl::TextColorIndex |
1837 // CEikCaptionedControl::TextColorIndex |
1815 } |
1854 } |
1816 |
1855 |
1817 |
1856 |
1818 void CEikCaptionedControl::DrawAsEikonDialog( const TRect& aRect ) const |
1857 void CEikCaptionedControl::DrawAsEikonDialog( const TRect& aRect ) const |
1819 { |
1858 { |
1859 _AKNTRACE_FUNC_ENTER; |
|
1820 CWindowGc& gc=SystemGc(); |
1860 CWindowGc& gc=SystemGc(); |
1821 gc.SetPenStyle(CGraphicsContext::ENullPen); |
1861 gc.SetPenStyle(CGraphicsContext::ENullPen); |
1822 |
1862 |
1823 if (iHighlightControl) |
1863 if (iHighlightControl) |
1824 STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->SetTopOrBottom(CEikCaptionedControlFormHighlightLine::EUnset); |
1864 STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->SetTopOrBottom(CEikCaptionedControlFormHighlightLine::EUnset); |
1854 gc.DrawLine(separatorStartPt, separatorEndPt); |
1894 gc.DrawLine(separatorStartPt, separatorEndPt); |
1855 }; |
1895 }; |
1856 |
1896 |
1857 if (iCapCFlags&EUsesEars) |
1897 if (iCapCFlags&EUsesEars) |
1858 DrawEars(EBothEars); |
1898 DrawEars(EBothEars); |
1899 _AKNTRACE_FUNC_EXIT; |
|
1859 } |
1900 } |
1860 |
1901 |
1861 /* |
1902 /* |
1862 * Method to return T/F whether this CEikCaptionedControl has a separator. |
1903 * Method to return T/F whether this CEikCaptionedControl has a separator. |
1863 */ |
1904 */ |
1867 } |
1908 } |
1868 |
1909 |
1869 |
1910 |
1870 EXPORT_C TKeyResponse CEikCaptionedControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
1911 EXPORT_C TKeyResponse CEikCaptionedControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
1871 { |
1912 { |
1913 _AKNTRACE_FUNC_ENTER; |
|
1872 if ( !iIsFormControl) |
1914 if ( !iIsFormControl) |
1873 return iControl->OfferKeyEventL(aKeyEvent,aType); |
1915 return iControl->OfferKeyEventL(aKeyEvent,aType); |
1874 else if ( iIsFormControl && iIsEditable ) |
1916 else if ( iIsFormControl && iIsEditable ) |
1875 { |
1917 { |
1876 TKeyResponse retVal ; |
1918 TKeyResponse retVal ; |
1877 retVal = iControl->OfferKeyEventL( aKeyEvent, aType ) ; |
1919 retVal = iControl->OfferKeyEventL( aKeyEvent, aType ) ; |
1920 _AKNTRACE_FUNC_EXIT; |
|
1878 return retVal ; |
1921 return retVal ; |
1879 } |
1922 } |
1880 else |
1923 else |
1924 _AKNTRACE_FUNC_EXIT; |
|
1881 return EKeyWasNotConsumed ; |
1925 return EKeyWasNotConsumed ; |
1882 } |
1926 } |
1883 |
1927 |
1884 EXPORT_C TCoeInputCapabilities CEikCaptionedControl::InputCapabilities() const |
1928 EXPORT_C TCoeInputCapabilities CEikCaptionedControl::InputCapabilities() const |
1885 { |
1929 { |
1886 return TCoeInputCapabilities(TCoeInputCapabilities::ENone, NULL, CONST_CAST(CEikCaptionedControl*, this)); |
1930 return TCoeInputCapabilities(TCoeInputCapabilities::ENone, NULL, CONST_CAST(CEikCaptionedControl*, this)); |
1887 } |
1931 } |
1888 |
1932 |
1889 EXPORT_C void CEikCaptionedControl::SetDimmed(TBool aDimmed) |
1933 EXPORT_C void CEikCaptionedControl::SetDimmed(TBool aDimmed) |
1890 { |
1934 { |
1935 _AKNTRACE_FUNC_ENTER; |
|
1891 CCoeControl::SetDimmed(aDimmed); |
1936 CCoeControl::SetDimmed(aDimmed); |
1892 if (iControl && iControl->IsVisible()) |
1937 if (iControl && iControl->IsVisible()) |
1893 { |
1938 { |
1894 iControl->SetDimmed(aDimmed); |
1939 iControl->SetDimmed(aDimmed); |
1895 } |
1940 } |
1899 } |
1944 } |
1900 if (iTrailer) |
1945 if (iTrailer) |
1901 { |
1946 { |
1902 iTrailer->SetDimmed(aDimmed); |
1947 iTrailer->SetDimmed(aDimmed); |
1903 } |
1948 } |
1949 _AKNTRACE_FUNC_EXIT; |
|
1904 } |
1950 } |
1905 |
1951 |
1906 EXPORT_C void* CEikCaptionedControl::ExtensionInterface( TUid /*aInterface*/ ) |
1952 EXPORT_C void* CEikCaptionedControl::ExtensionInterface( TUid /*aInterface*/ ) |
1907 { |
1953 { |
1908 return NULL; |
1954 return NULL; |
1909 } |
1955 } |
1910 |
1956 |
1911 EXPORT_C void CEikCaptionedControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
1957 EXPORT_C void CEikCaptionedControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
1912 { |
1958 { |
1959 _AKNTRACE_FUNC_ENTER; |
|
1913 if (!IsNonFocusing()) |
1960 if (!IsNonFocusing()) |
1914 { |
1961 { |
1915 TWhichEars ear=ENoEar; |
1962 TWhichEars ear=ENoEar; |
1916 if (aPointerEvent.iType!=TPointerEvent::EButton1Down) |
1963 if (aPointerEvent.iType!=TPointerEvent::EButton1Down) |
1917 { |
1964 { |
1965 _AKNTRACE("TPointerEvent::EButton1Down"); |
|
1918 if (iCapCFlags&ELeftEarGrab) |
1966 if (iCapCFlags&ELeftEarGrab) |
1919 ear=ELeftEar; |
1967 ear=ELeftEar; |
1920 else if (iCapCFlags&ERightEarGrab) |
1968 else if (iCapCFlags&ERightEarGrab) |
1921 ear=ERightEar; |
1969 ear=ERightEar; |
1922 if (ear) |
1970 if (ear) |
1933 return; |
1981 return; |
1934 } |
1982 } |
1935 } |
1983 } |
1936 if (oldDrawFlags!=(iCapCFlags&(ELeftEarDown|ERightEarDown))) |
1984 if (oldDrawFlags!=(iCapCFlags&(ELeftEarDown|ERightEarDown))) |
1937 DrawEarsNow(ear); |
1985 DrawEarsNow(ear); |
1986 _AKNTRACE_FUNC_EXIT; |
|
1938 return; |
1987 return; |
1939 } |
1988 } |
1940 } |
1989 } |
1941 else if (iCapCFlags&EUsesEars) |
1990 else if (iCapCFlags&EUsesEars) |
1942 { |
1991 { |
1946 else if (EarRect(ERightEar).Contains(aPointerEvent.iPosition)) |
1995 else if (EarRect(ERightEar).Contains(aPointerEvent.iPosition)) |
1947 ear=ERightEar; |
1996 ear=ERightEar; |
1948 if (ear) |
1997 if (ear) |
1949 { |
1998 { |
1950 FireEarL(ear, KCapCInitialEarRepeat); |
1999 FireEarL(ear, KCapCInitialEarRepeat); |
2000 _AKNTRACE_FUNC_EXIT; |
|
1951 return; |
2001 return; |
1952 } |
2002 } |
1953 } |
2003 } |
1954 } |
2004 } |
1955 if (iIsFormControl) |
2005 if (iIsFormControl) |
1960 SetPressedDownState( ETrue ); |
2010 SetPressedDownState( ETrue ); |
1961 DrawDeferred(); |
2011 DrawDeferred(); |
1962 } |
2012 } |
1963 else if(aPointerEvent.iType == TPointerEvent::EButton1Up) |
2013 else if(aPointerEvent.iType == TPointerEvent::EButton1Up) |
1964 { |
2014 { |
2015 _AKNTRACE("TPointerEvent::EButton1Up"); |
|
1965 SetPressedDownState( EFalse ); |
2016 SetPressedDownState( EFalse ); |
1966 DrawDeferred(); |
2017 DrawDeferred(); |
1967 } |
2018 } |
1968 } |
2019 } |
1969 |
2020 |
1970 if ( !iIsEditable && (ControlIsAnEdwin(iControlType) || ControlIsAMfne(iControlType)) |
2021 if ( !iIsEditable && (ControlIsAnEdwin(iControlType) || ControlIsAMfne(iControlType)) |
1971 &&( iDialogPage && CEikDialogPage::EDouble == iDialogPage->FormLayout() )) |
2022 &&( iDialogPage && CEikDialogPage::EDouble == iDialogPage->FormLayout() )) |
1972 { |
2023 { |
2024 _AKNTRACE_FUNC_EXIT; |
|
1973 return; |
2025 return; |
1974 } |
2026 } |
1975 |
2027 |
1976 CCoeControl::HandlePointerEventL(aPointerEvent); |
2028 CCoeControl::HandlePointerEventL(aPointerEvent); |
1977 |
2029 |
2000 iControl->OfferKeyEventL(key,EEventKey); |
2052 iControl->OfferKeyEventL(key,EEventKey); |
2001 } |
2053 } |
2002 |
2054 |
2003 EXPORT_C void CEikCaptionedControl::SetCaptionL(const TDesC& aText) |
2055 EXPORT_C void CEikCaptionedControl::SetCaptionL(const TDesC& aText) |
2004 { |
2056 { |
2057 _AKNTRACE_FUNC_ENTER; |
|
2058 _AKNTRACE("aText = %s", &aText); |
|
2005 ConstructExtensionL() ; // One of several places where this is made |
2059 ConstructExtensionL() ; // One of several places where this is made |
2006 if (!iCaption) |
2060 if (!iCaption) |
2007 { |
2061 { |
2008 // Retain a zero sized caption for formatting forms |
2062 // Retain a zero sized caption for formatting forms |
2009 iCaption=new(ELeave) CEikCapCLabel; |
2063 iCaption=new(ELeave) CEikCapCLabel; |
2026 */ |
2080 */ |
2027 if (iIsFormControl) |
2081 if (iIsFormControl) |
2028 DoFormCaptionSettingsL(aText); |
2082 DoFormCaptionSettingsL(aText); |
2029 else |
2083 else |
2030 iCaption->SetTextL(aText); |
2084 iCaption->SetTextL(aText); |
2085 _AKNTRACE_FUNC_EXIT; |
|
2031 } |
2086 } |
2032 |
2087 |
2033 EXPORT_C void CEikCaptionedControl::SetDrawNoWhiteBackground(TBool aEnabled) |
2088 EXPORT_C void CEikCaptionedControl::SetDrawNoWhiteBackground(TBool aEnabled) |
2034 { |
2089 { |
2035 iExtension->iDrawNoWhiteBackground = aEnabled; |
2090 iExtension->iDrawNoWhiteBackground = aEnabled; |
2036 } |
2091 } |
2037 |
2092 |
2038 EXPORT_C void CEikCaptionedControl::SetTrailerL(const TDesC& aText) |
2093 EXPORT_C void CEikCaptionedControl::SetTrailerL(const TDesC& aText) |
2039 { |
2094 { |
2095 _AKNTRACE_FUNC_ENTER; |
|
2040 if (!aText.Length()) |
2096 if (!aText.Length()) |
2041 return; |
2097 return; |
2042 if (!iTrailer) |
2098 if (!iTrailer) |
2043 { |
2099 { |
2044 iTrailer=new(ELeave) CEikLabel; |
2100 iTrailer=new(ELeave) CEikLabel; |
2047 iTrailer->CopyControlContextFrom(this); |
2103 iTrailer->CopyControlContextFrom(this); |
2048 iTrailer->SetAllMarginsTo(1); |
2104 iTrailer->SetAllMarginsTo(1); |
2049 iTrailer->SetNonFocusing(); |
2105 iTrailer->SetNonFocusing(); |
2050 } |
2106 } |
2051 iTrailer->SetTextL(aText); |
2107 iTrailer->SetTextL(aText); |
2108 _AKNTRACE( "SetTextL = %s" , &aText); |
|
2109 _AKNTRACE_FUNC_EXIT; |
|
2052 } |
2110 } |
2053 |
2111 |
2054 EXPORT_C void CEikCaptionedControl::SetCurrent(TBool aSelected) |
2112 EXPORT_C void CEikCaptionedControl::SetCurrent(TBool aSelected) |
2055 { |
2113 { |
2056 SetCurrent( aSelected, ETrue ); |
2114 SetCurrent( aSelected, ETrue ); |
2057 } |
2115 } |
2058 |
2116 |
2059 EXPORT_C void CEikCaptionedControl::ConstructFromResourceL(TResourceReader& aReader) |
2117 EXPORT_C void CEikCaptionedControl::ConstructFromResourceL(TResourceReader& aReader) |
2060 { |
2118 { |
2119 _AKNTRACE_FUNC_ENTER; |
|
2061 TPtrC capTextTPtrC = aReader.ReadTPtrC(); |
2120 TPtrC capTextTPtrC = aReader.ReadTPtrC(); |
2062 iCaptionText = capTextTPtrC.AllocL(); |
2121 iCaptionText = capTextTPtrC.AllocL(); |
2063 SetCaptionL(capTextTPtrC); |
2122 SetCaptionL(capTextTPtrC); |
2064 iId=aReader.ReadInt16(); |
2123 iId=aReader.ReadInt16(); |
2065 TInt itemFlags=aReader.ReadInt32(); |
2124 TInt itemFlags=aReader.ReadInt32(); |
2133 { |
2192 { |
2134 iHighlightControl = new(ELeave) CEikCaptionedControlFormHighlightLine( *this ) ; |
2193 iHighlightControl = new(ELeave) CEikCaptionedControlFormHighlightLine( *this ) ; |
2135 STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->ConstructL() ; |
2194 STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->ConstructL() ; |
2136 } |
2195 } |
2137 ConstructExtensionL() ; |
2196 ConstructExtensionL() ; |
2197 _AKNTRACE_FUNC_EXIT; |
|
2138 } |
2198 } |
2139 |
2199 |
2140 |
2200 |
2141 EXPORT_C void CEikCaptionedControl::SetBitmapFromFileL( const TDesC& aFilename,TInt aMainId,TInt aMaskId /*=-1*/ ) |
2201 EXPORT_C void CEikCaptionedControl::SetBitmapFromFileL( const TDesC& aFilename,TInt aMainId,TInt aMaskId /*=-1*/ ) |
2142 { |
2202 { |
2175 } |
2235 } |
2176 } |
2236 } |
2177 |
2237 |
2178 EXPORT_C void CEikCaptionedControl::ResetMinimumSizes() |
2238 EXPORT_C void CEikCaptionedControl::ResetMinimumSizes() |
2179 { |
2239 { |
2240 _AKNTRACE_FUNC_ENTER; |
|
2180 iMinSize.iWidth=0; |
2241 iMinSize.iWidth=0; |
2181 iCaptionWidth=0; |
2242 iCaptionWidth=0; |
2182 iFullWidth=0; |
2243 iFullWidth=0; |
2244 _AKNTRACE_FUNC_EXIT; |
|
2183 } |
2245 } |
2184 |
2246 |
2185 EXPORT_C TBool CEikCaptionedControl::IsLatent() const |
2247 EXPORT_C TBool CEikCaptionedControl::IsLatent() const |
2186 { |
2248 { |
2187 return(iCapCFlags&ELatent); |
2249 return(iCapCFlags&ELatent); |
2262 * |
2324 * |
2263 * @since ER5U |
2325 * @since ER5U |
2264 */ |
2326 */ |
2265 EXPORT_C void CEikCaptionedControl::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const |
2327 EXPORT_C void CEikCaptionedControl::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const |
2266 { |
2328 { |
2329 _AKNTRACE_FUNC_ENTER; |
|
2267 CCoeControl::GetColorUseListL(aColorUseList); |
2330 CCoeControl::GetColorUseListL(aColorUseList); |
2268 |
2331 |
2269 TCoeColorUse colorUse; |
2332 TCoeColorUse colorUse; |
2270 colorUse.SetLogicalColor(EColorWindowText); |
2333 colorUse.SetLogicalColor(EColorWindowText); |
2271 colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EActive|TCoeColorUse::ESurrounds|TCoeColorUse::ENormal|TCoeColorUse::ENeutral); |
2334 colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EActive|TCoeColorUse::ESurrounds|TCoeColorUse::ENormal|TCoeColorUse::ENeutral); |
2272 aColorUseList.AppendL(colorUse); |
2335 aColorUseList.AppendL(colorUse); |
2273 |
2336 |
2274 const TInt count=CountComponentControls(); |
2337 const TInt count=CountComponentControls(); |
2275 for(TInt ii=0;ii<count;ii++) |
2338 for(TInt ii=0;ii<count;ii++) |
2276 ComponentControl(ii)->GetColorUseListL(aColorUseList); |
2339 ComponentControl(ii)->GetColorUseListL(aColorUseList); |
2340 _AKNTRACE_FUNC_EXIT; |
|
2277 } |
2341 } |
2278 |
2342 |
2279 /** |
2343 /** |
2280 * Handles a change to the control's resources of type aType |
2344 * Handles a change to the control's resources of type aType |
2281 * which are shared across the environment, e.g. colors or fonts. |
2345 * which are shared across the environment, e.g. colors or fonts. |
2282 * |
2346 * |
2283 * @since ER5U |
2347 * @since ER5U |
2284 */ |
2348 */ |
2285 EXPORT_C void CEikCaptionedControl::HandleResourceChange(TInt aType) |
2349 EXPORT_C void CEikCaptionedControl::HandleResourceChange(TInt aType) |
2286 { |
2350 { |
2351 _AKNTRACE_FUNC_ENTER; |
|
2352 _AKNTRACE( "[%s][%s][%d].", "CEikCaptionedControl", __FUNCTION__, aType ); |
|
2287 CCoeControl::HandleResourceChange(aType); |
2353 CCoeControl::HandleResourceChange(aType); |
2288 |
2354 |
2289 // Animation is skin dependent, whenever skin changes animation changes |
2355 // Animation is skin dependent, whenever skin changes animation changes |
2290 // too. |
2356 // too. |
2291 if( KAknsMessageSkinChange == aType ) |
2357 if( KAknsMessageSkinChange == aType ) |
2305 { |
2371 { |
2306 iExtension->HandleLayoutSwitch( Rect().Size() ); |
2372 iExtension->HandleLayoutSwitch( Rect().Size() ); |
2307 } |
2373 } |
2308 DrawDeferred(); |
2374 DrawDeferred(); |
2309 } |
2375 } |
2376 _AKNTRACE_FUNC_EXIT; |
|
2310 } |
2377 } |
2311 |
2378 |
2312 |
2379 |
2313 /* Deactivated as requested in AISA-595AEZ |
2380 /* Deactivated as requested in AISA-595AEZ |
2314 */ |
2381 */ |
2380 EXPORT_C void CEikCaptionedControl::MCoeCaptionRetrieverForFep_Reserved_2() |
2447 EXPORT_C void CEikCaptionedControl::MCoeCaptionRetrieverForFep_Reserved_2() |
2381 {} |
2448 {} |
2382 |
2449 |
2383 EXPORT_C void CEikCaptionedControl::SetEditableL( TBool aEditable, TBool /*aShowEmptyFields*/ ) |
2450 EXPORT_C void CEikCaptionedControl::SetEditableL( TBool aEditable, TBool /*aShowEmptyFields*/ ) |
2384 { |
2451 { |
2452 _AKNTRACE_FUNC_ENTER; |
|
2453 _AKNTRACE( "CEikCaptionedControl::SetEditableL() aEditable: [%d]", aEditable ); |
|
2385 // Construct extension object if needed |
2454 // Construct extension object if needed |
2386 ConstructExtensionL() ; |
2455 ConstructExtensionL() ; |
2387 |
2456 |
2388 // Animation is not run when editing |
2457 // Animation is not run when editing |
2389 if( iIsFormControl && iExtension->iAnimation && aEditable ) |
2458 if( iIsFormControl && iExtension->iAnimation && aEditable ) |
2454 ResetMinimumSizes() ; |
2523 ResetMinimumSizes() ; |
2455 LayoutSkinControlContexts(); |
2524 LayoutSkinControlContexts(); |
2456 if (IsReadyToDraw()) |
2525 if (IsReadyToDraw()) |
2457 SizeChanged(); // needed because layout lines change when editable flag is switched. |
2526 SizeChanged(); // needed because layout lines change when editable flag is switched. |
2458 } |
2527 } |
2528 _AKNTRACE_FUNC_EXIT; |
|
2459 } |
2529 } |
2460 |
2530 |
2461 void CEikCaptionedControl::SetVertEdgeSpacing( TInt aVertEdgeSpacing ) |
2531 void CEikCaptionedControl::SetVertEdgeSpacing( TInt aVertEdgeSpacing ) |
2462 { |
2532 { |
2463 iVertEdgeSpacing = aVertEdgeSpacing ; |
2533 iVertEdgeSpacing = aVertEdgeSpacing ; |
2472 * Avkon component positioning for Forms |
2542 * Avkon component positioning for Forms |
2473 */ |
2543 */ |
2474 |
2544 |
2475 void CEikCaptionedControl::PositionFormComponents() |
2545 void CEikCaptionedControl::PositionFormComponents() |
2476 { |
2546 { |
2547 _AKNTRACE_FUNC_ENTER; |
|
2477 if( iExtension->iPartiallyVisible ) |
2548 if( iExtension->iPartiallyVisible ) |
2478 return; |
2549 return; |
2479 TBool isFocused = iIsCurrentLine; |
2550 TBool isFocused = iIsCurrentLine; |
2480 TBool isSingleLineLayout = ( FormLayout() == CEikDialogPage::ESingle); |
2551 TBool isSingleLineLayout = ( FormLayout() == CEikDialogPage::ESingle); |
2481 MinimumSize() ; |
2552 MinimumSize() ; |
2696 default: |
2767 default: |
2697 Panic(EEikFormPanicLayoutErrorUnknownControlType); |
2768 Panic(EEikFormPanicLayoutErrorUnknownControlType); |
2698 } |
2769 } |
2699 |
2770 |
2700 TRAP_IGNORE( SetElementTextColorsL(TRgb())); |
2771 TRAP_IGNORE( SetElementTextColorsL(TRgb())); |
2772 _AKNTRACE_FUNC_EXIT; |
|
2701 } |
2773 } |
2702 |
2774 |
2703 TBool CEikCaptionedControl::ShowBitmap() const |
2775 TBool CEikCaptionedControl::ShowBitmap() const |
2704 { |
2776 { |
2705 return (iFlags & EEikFormShowBitmaps); |
2777 return (iFlags & EEikFormShowBitmaps); |
2748 /** |
2820 /** |
2749 * Recalculates the number of required lines for a control. |
2821 * Recalculates the number of required lines for a control. |
2750 */ |
2822 */ |
2751 void CEikCaptionedControl::CalculateNumberOfLinesForControl( TInt aLines ) |
2823 void CEikCaptionedControl::CalculateNumberOfLinesForControl( TInt aLines ) |
2752 { |
2824 { |
2825 _AKNTRACE_FUNC_ENTER; |
|
2753 // NB if new control types are added, ones which should be invisible in view mode |
2826 // NB if new control types are added, ones which should be invisible in view mode |
2754 // should be also added to IsDisplayable(). |
2827 // should be also added to IsDisplayable(). |
2755 if ( aLines == ENotSupplied ) |
2828 if ( aLines == ENotSupplied ) |
2756 { |
2829 { |
2757 // Function has to be aware of edit/view state. |
2830 // Function has to be aware of edit/view state. |
2803 else |
2876 else |
2804 aLines=1; |
2877 aLines=1; |
2805 } |
2878 } |
2806 } |
2879 } |
2807 iNumberOfLines = aLines ; |
2880 iNumberOfLines = aLines ; |
2881 _AKNTRACE( "iNumberOfLines: [%d]", iNumberOfLines ); |
|
2882 _AKNTRACE_FUNC_EXIT; |
|
2808 } |
2883 } |
2809 |
2884 |
2810 EXPORT_C void CEikCaptionedControl::SetFormFlags( TInt aFlags ) |
2885 EXPORT_C void CEikCaptionedControl::SetFormFlags( TInt aFlags ) |
2811 { |
2886 { |
2812 iFlags = aFlags ; |
2887 iFlags = aFlags ; |
2927 case EEikCtNumberEditor: |
3002 case EEikCtNumberEditor: |
2928 case EAknCtLocationEditor: |
3003 case EAknCtLocationEditor: |
2929 case EAknCtUnitEditor: |
3004 case EAknCtUnitEditor: |
2930 return ETrue; |
3005 return ETrue; |
2931 } |
3006 } |
2932 TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType); |
3007 if (iDialogPage) |
2933 if (typeOfControlToLayout==MEikDialogPageObserver::EMfneDerived) |
3008 { |
2934 return ETrue; |
3009 TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType); |
3010 if (typeOfControlToLayout==MEikDialogPageObserver::EMfneDerived) |
|
3011 return ETrue; |
|
3012 } |
|
2935 return EFalse; |
3013 return EFalse; |
2936 } |
3014 } |
2937 |
3015 |
2938 TBool CEikCaptionedControl::ControlIsAPopfield(TInt aControlType) const |
3016 TBool CEikCaptionedControl::ControlIsAPopfield(TInt aControlType) const |
2939 { |
3017 { |
2962 { |
3040 { |
2963 case EEikCtSecretEd: |
3041 case EEikCtSecretEd: |
2964 case EAknCtNumericSecretEditor: |
3042 case EAknCtNumericSecretEditor: |
2965 return ETrue; |
3043 return ETrue; |
2966 } |
3044 } |
2967 TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType); |
3045 if (iDialogPage) |
2968 if (typeOfControlToLayout==MEikDialogPageObserver::ESecretEditorDerived) |
3046 { |
2969 return ETrue; |
3047 TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType); |
3048 if (typeOfControlToLayout==MEikDialogPageObserver::ESecretEditorDerived) |
|
3049 return ETrue; |
|
3050 } |
|
2970 return EFalse; |
3051 return EFalse; |
2971 } |
3052 } |
2972 |
3053 |
2973 TBool CEikCaptionedControl::ControlIsASlider(TInt aControlType) const |
3054 TBool CEikCaptionedControl::ControlIsASlider(TInt aControlType) const |
2974 { |
3055 { |
2977 switch (aControlType) |
3058 switch (aControlType) |
2978 { |
3059 { |
2979 case EAknCtSlider : |
3060 case EAknCtSlider : |
2980 return ETrue; |
3061 return ETrue; |
2981 } |
3062 } |
2982 TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType); |
3063 if (iDialogPage) |
2983 if (typeOfControlToLayout==MEikDialogPageObserver::ESliderDerived) |
3064 { |
2984 return ETrue; |
3065 TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType); |
3066 if (typeOfControlToLayout==MEikDialogPageObserver::ESliderDerived) |
|
3067 return ETrue; |
|
3068 } |
|
2985 return EFalse; |
3069 return EFalse; |
2986 } |
3070 } |
2987 |
3071 |
2988 //------------------------------------------------------------------------ |
3072 //------------------------------------------------------------------------ |
2989 // CEikCaptionedControl::ControlIsAColourSelGrid |
3073 // CEikCaptionedControl::ControlIsAColourSelGrid |
2998 case EAknCtColourSelectionDialogGrid : // Deprecated |
3082 case EAknCtColourSelectionDialogGrid : // Deprecated |
2999 case EAknCtColourSelectionGridDialog : |
3083 case EAknCtColourSelectionGridDialog : |
3000 case EAknCtColourSelectionDialogNoneField: |
3084 case EAknCtColourSelectionDialogNoneField: |
3001 return ETrue; |
3085 return ETrue; |
3002 } |
3086 } |
3003 TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType); |
3087 if (iDialogPage) |
3004 if (typeOfControlToLayout==MEikDialogPageObserver::EColourSelectionGridDerived) |
3088 { |
3005 return ETrue; |
3089 TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType); |
3090 if (typeOfControlToLayout==MEikDialogPageObserver::EColourSelectionGridDerived) |
|
3091 return ETrue; |
|
3092 } |
|
3006 return EFalse; |
3093 return EFalse; |
3007 } |
3094 } |
3008 |
3095 |
3009 void CEikCaptionedControl::DoFormCaptionSettingsL(const TDesC& aText) |
3096 void CEikCaptionedControl::DoFormCaptionSettingsL(const TDesC& aText) |
3010 { |
3097 { |
3026 iDialogPage=aPage; |
3113 iDialogPage=aPage; |
3027 }; |
3114 }; |
3028 |
3115 |
3029 TInt CEikCaptionedControl::MaximumNumberOfControlLinesOnVisiblePage() const |
3116 TInt CEikCaptionedControl::MaximumNumberOfControlLinesOnVisiblePage() const |
3030 { |
3117 { |
3118 _AKNTRACE_FUNC_ENTER; |
|
3031 TInt maxItems = 0; |
3119 TInt maxItems = 0; |
3032 TAknLayoutScalableParameterLimits paneLimits; |
3120 TAknLayoutScalableParameterLimits paneLimits; |
3033 if (IsPopupField(this)) |
3121 if (IsPopupField(this)) |
3034 { |
3122 { |
3035 if (iDialogPage&& CEikDialogPage::EDouble == iDialogPage->FormLayout()) |
3123 if (iDialogPage&& CEikDialogPage::EDouble == iDialogPage->FormLayout()) |
3068 TInt defineHeight = static_cast<CEikEdwin*>( iControl )->MaximumHeightInLines(); |
3156 TInt defineHeight = static_cast<CEikEdwin*>( iControl )->MaximumHeightInLines(); |
3069 if ( defineHeight && defineHeight < maxItems ) |
3157 if ( defineHeight && defineHeight < maxItems ) |
3070 return defineHeight; |
3158 return defineHeight; |
3071 } |
3159 } |
3072 //maxItems -= 1; // TODO: this is a temporary workaround for layout data being incorrect, it has too many options available |
3160 //maxItems -= 1; // TODO: this is a temporary workaround for layout data being incorrect, it has too many options available |
3161 _AKNTRACE( "maxItems: [%d]", maxItems ); |
|
3162 _AKNTRACE_FUNC_EXIT; |
|
3073 return maxItems; |
3163 return maxItems; |
3074 }; |
3164 }; |
3075 |
3165 |
3076 |
3166 |
3077 TRect CEikCaptionedControl::ViewRect() const |
3167 TRect CEikCaptionedControl::ViewRect() const |
3809 } |
3899 } |
3810 |
3900 |
3811 void CEikCaptionedControl::DrawAsSkinnedForm( CWindowGc& aGc, const TRect& /*aRect*/ ) const |
3901 void CEikCaptionedControl::DrawAsSkinnedForm( CWindowGc& aGc, const TRect& /*aRect*/ ) const |
3812 { |
3902 { |
3813 MAknsSkinInstance* skin = AknsUtils::SkinInstance() ; |
3903 MAknsSkinInstance* skin = AknsUtils::SkinInstance() ; |
3904 TRgb textColor( KRgbBlack ); |
|
3905 GetColor( EColorLabelText, textColor ); |
|
3814 |
3906 |
3815 if ( !iIsCurrentLine ) |
3907 if ( !iIsCurrentLine ) |
3816 { |
3908 { |
3909 AknListUtils::DrawSeparator( aGc, Rect(), textColor ); |
|
3817 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ) ; |
3910 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ) ; |
3818 } |
3911 } |
3819 else // Highlight Skinning. Requires Frame |
3912 else // Highlight Skinning. Requires Frame |
3820 { |
3913 { |
3821 if ( iIsEditable ) |
3914 if ( iIsEditable ) |
3825 innerRect.iBr = EditFrameBottomRightRect( Rect() ).iTl ; |
3918 innerRect.iBr = EditFrameBottomRightRect( Rect() ).iTl ; |
3826 |
3919 |
3827 MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ; |
3920 MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ; |
3828 AknsDrawUtils::Background( skin, parentCc, this, aGc, Rect() ) ; |
3921 AknsDrawUtils::Background( skin, parentCc, this, aGc, Rect() ) ; |
3829 |
3922 |
3923 AknListUtils::DrawSeparator( aGc, Rect(), textColor ); |
|
3924 |
|
3830 // Set the rectangle(s) for the Frame context |
3925 // Set the rectangle(s) for the Frame context |
3831 iExtension->iEditModeHighlightControlContext->SetFrameRects( EditRect(), innerRect ) ; |
3926 iExtension->iEditModeHighlightControlContext->SetFrameRects( EditRect(), innerRect ) ; |
3832 iExtension->iEditModeHighlightControlContextPressed->SetFrameRects( EditRect(), innerRect ) ; |
3927 iExtension->iEditModeHighlightControlContextPressed->SetFrameRects( EditRect(), innerRect ) ; |
3833 |
3928 |
3834 AknsDrawUtils::DrawFrame( skin, aGc, EditRect(), innerRect, |
3929 AknsDrawUtils::DrawFrame( skin, aGc, EditRect(), innerRect, |
3836 KAknsIIDQsnFrListPressed : KAknsIIDQsnFrInput, KAknsIIDDefault ); |
3931 KAknsIIDQsnFrListPressed : KAknsIIDQsnFrInput, KAknsIIDDefault ); |
3837 } |
3932 } |
3838 else // View Mode highlight |
3933 else // View Mode highlight |
3839 { |
3934 { |
3840 TBool drawOk = EFalse; |
3935 TBool drawOk = EFalse; |
3841 if( iExtension->IsHighlightAnimated() ) // Draw animated highlight |
3936 TRect viewRect( ViewRect() ); |
3842 { |
3937 TRect innerRect( viewRect ); |
3843 CAknsEffectAnim* anim = iExtension->iAnimation->Animation(); |
3938 innerRect.iTl = ViewFrameTopLeftRect( viewRect ).iBr; |
3844 |
3939 innerRect.iTl.iX-- ; innerRect.iTl.iY--; |
3845 // TODO: Background is drawn first to prevent white stripes |
3940 innerRect.iBr = ViewFrameBottomRightRect( viewRect ).iTl ; |
3846 // appearing above and below the highlight. Wasting resources |
3941 |
3847 // here, you could create animation that is a tad bigger and |
3942 // The bit around the outside must use the parent's control context |
3848 // remove background drawing from here. |
3943 MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ); |
3849 TRect viewRect = ViewRect() ; |
3944 AknsDrawUtils::BackgroundBetweenRects( skin, parentCc, this, aGc, |
3850 TRect innerRect( viewRect ) ; |
3945 Rect(), innerRect ); |
3851 innerRect.iTl = ViewFrameTopLeftRect( viewRect ).iBr ; |
3946 |
3852 innerRect.iTl.iX-- ; innerRect.iTl.iY-- ; // not sure why this adjustment is required here and not above. |
3947 AknListUtils::DrawSeparator( aGc, Rect(), textColor ); |
3853 innerRect.iBr = ViewFrameBottomRightRect( viewRect ).iTl ; |
3948 |
3854 |
3949 // Draw the animation itself |
3855 // The bit around the outside must use the parent's control context |
3950 if ( iExtension->IsHighlightAnimated() |
3856 MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ; |
3951 && iExtension->iAnimation->Animation() ) |
3857 AknsDrawUtils::BackgroundBetweenRects( skin, parentCc, this, aGc, Rect() , innerRect ) ; |
3952 { |
3858 |
3953 drawOk = iExtension->iAnimation->Animation()->Render( aGc, |
3859 // Draw the animation itself |
3954 viewRect ); |
3860 if( anim ) |
3955 } |
3861 { |
3956 |
3862 drawOk = anim->Render( aGc, ViewRect() ); |
3957 if ( !drawOk ) |
3863 } |
3958 { |
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 |
3959 // Set the rectangle(s) for the Frame context |
3881 iExtension->iViewModeHighlightControlContext->SetFrameRects( viewRect, innerRect ) ; |
3960 iExtension->iViewModeHighlightControlContext->SetFrameRects( |
3882 iExtension->iViewModeHighlightControlContextPressed->SetFrameRects( viewRect, innerRect ) ; |
3961 viewRect, innerRect ) ; |
3962 iExtension->iViewModeHighlightControlContextPressed-> |
|
3963 SetFrameRects( viewRect, innerRect ) ; |
|
3883 |
3964 |
3884 AknsDrawUtils::DrawFrame( skin, aGc, viewRect, innerRect, |
3965 AknsDrawUtils::DrawFrame( skin, aGc, viewRect, innerRect, |
3885 PressedDownState() ? |
3966 PressedDownState() ? KAknsIIDQsnFrListPressed : |
3886 KAknsIIDQsnFrListPressed : KAknsIIDQsnFrList, KAknsIIDDefault ); |
3967 KAknsIIDQsnFrList, KAknsIIDDefault ); |
3887 } |
3968 } |
3888 } |
3969 } |
3889 } |
3970 } |
3890 |
3971 |
3891 // Enable/disable the control line as required. (Hide first, show if necessary) |
3972 // Enable/disable the control line as required. (Hide first, show if necessary) |