menufw/menufwui/mmwidgets/src/mmwidgetcontainer.cpp
changeset 4 4d54b72983ae
parent 2 08c6ee43b396
child 5 c743ef5928ba
equal deleted inserted replaced
3:fb3763350a08 4:4d54b72983ae
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *  Version     : %version: MM_71.1.17.1.47 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: MM_71.1.17.1.49 % << Don't touch! Updated by Synergy at check-out.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 #include <e32keys.h>
    20 #include <e32keys.h>
    31 
    31 
    32 #include "mmwidgetcontainer.h"
    32 #include "mmwidgetcontainer.h"
    33 #include "mmlistboxmodel.h"
    33 #include "mmlistboxmodel.h"
    34 #include "mmmarqueeadapter.h"
    34 #include "mmmarqueeadapter.h"
    35 #include "mmwidgetobserver.h"
    35 #include "mmwidgetobserver.h"
    36 #include "mmhighlighttimer.h"
       
    37 #include "mmvisibilityobserver.h"
    36 #include "mmvisibilityobserver.h"
    38 #include "mmlistboxcontainer.h"
    37 #include "mmlistboxcontainer.h"
    39 #include "mmgridcontainer.h"
    38 #include "mmgridcontainer.h"
    40 #include "mmlistboxitemdrawer.h"
    39 #include "mmlistboxitemdrawer.h"
    41 #include "mmmarqueeadapter.h"
    40 #include "mmmarqueeadapter.h"
    89 //
    88 //
    90 // -----------------------------------------------------------------------------
    89 // -----------------------------------------------------------------------------
    91 //
    90 //
    92 void CMmWidgetContainer::ConstructL()
    91 void CMmWidgetContainer::ConstructL()
    93 	{
    92 	{
    94     if ( AknLayoutUtils::PenEnabled() )
       
    95     	{
       
    96     	iTimer = CMmHighlightTimer::NewL( this );
       
    97     	}
       
    98     iBgContext = CAknsBasicBackgroundControlContext::NewL(
    93     iBgContext = CAknsBasicBackgroundControlContext::NewL(
    99     	KAknsIIDQsnBgAreaMainAppsGrid, Rect(), EFalse);
    94     	KAknsIIDQsnBgAreaMainAppsGrid, Rect(), EFalse);
   100     iLongTapDetector = CAknLongTapDetector::NewL( this );
    95     iLongTapDetector = CAknLongTapDetector::NewL( this );
   101     iLongTapDetector->EnableLongTapAnimation(ETrue);
    96     iLongTapDetector->EnableLongTapAnimation(ETrue);
   102 	}
    97 	}
   122 //
   117 //
   123 CMmWidgetContainer::~CMmWidgetContainer()
   118 CMmWidgetContainer::~CMmWidgetContainer()
   124     {
   119     {
   125     AknsUtils::DeregisterControlPosition( this );
   120     AknsUtils::DeregisterControlPosition( this );
   126     AknsUtils::DeregisterControlPosition( this->iWidget );
   121     AknsUtils::DeregisterControlPosition( this->iWidget );
   127     delete iTimer;
       
   128     delete iBgContext;
   122     delete iBgContext;
   129     delete iPostProcessor;
   123     delete iPostProcessor;
   130     delete iLongTapDetector;
   124     delete iLongTapDetector;
   131     }
   125     }
   132 
   126 
   439         iHasFocus = aHasFocus;
   433         iHasFocus = aHasFocus;
   440         StartOrStopMarquee();
   434         StartOrStopMarquee();
   441         }
   435         }
   442     if ( !aHasFocus )
   436     if ( !aHasFocus )
   443     	{
   437     	{
   444     	ASSERT(iTimer);
   438     	SetHighlightVisibilityL( EFalse );
   445     	iTimer->StopL();
       
   446     	}
   439     	}
   447     }
   440     }
   448 
   441 
   449 // -----------------------------------------------------------------------------
   442 // -----------------------------------------------------------------------------
   450 //
   443 //
   455     if ( !!aIsFaded != !!iIsFaded ) // logical Ex-OR
   448     if ( !!aIsFaded != !!iIsFaded ) // logical Ex-OR
   456         {
   449         {
   457         iIsFaded = aIsFaded;
   450         iIsFaded = aIsFaded;
   458         StartOrStopMarquee();
   451         StartOrStopMarquee();
   459         }
   452         }
       
   453     }
       
   454 
       
   455 // -----------------------------------------------------------------------------
       
   456 //
       
   457 // -----------------------------------------------------------------------------
       
   458 //
       
   459 TBool CMmWidgetContainer::LongTapInProgress() const
       
   460     {
       
   461     return iLongTapInProgress;
   460     }
   462     }
   461 
   463 
   462 // -----------------------------------------------------------------------------
   464 // -----------------------------------------------------------------------------
   463 //
   465 //
   464 // -----------------------------------------------------------------------------
   466 // -----------------------------------------------------------------------------
   608     	iMarqueeAdapter->StopMarqueeDrawing();
   610     	iMarqueeAdapter->StopMarqueeDrawing();
   609     	}
   611     	}
   610 
   612 
   611     TInt index = KErrNotFound;
   613     TInt index = KErrNotFound;
   612     TBool itemExists = iWidget->View()->XYPosToItemIndex( aPointerEvent.iPosition, index );
   614     TBool itemExists = iWidget->View()->XYPosToItemIndex( aPointerEvent.iPosition, index );
       
   615     
       
   616     if ( iLongTapDetector )
       
   617         {
       
   618         if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
   619             {
       
   620             iLongTapDetector->EnableLongTapAnimation( itemExists &&
       
   621                     GetMmModel()->GetNumberOfSpecificMenuItemsL( index ) > 0 );
       
   622             }
       
   623         TPointerEvent longTapPointerEvent = aPointerEvent;
       
   624         if ( aPointerEvent.iType == TPointerEvent::EButtonRepeat )
       
   625             {
       
   626             longTapPointerEvent.iType = TPointerEvent::EDrag;
       
   627             }
       
   628         iLongTapDetector->PointerEventL( longTapPointerEvent );
       
   629         }
   613 
   630 
   614     CCoeControl::HandlePointerEventL(aPointerEvent);
   631     CCoeControl::HandlePointerEventL(aPointerEvent);
   615 
   632 
   616     if ( aPointerEvent.iType == TPointerEvent::EButton1Down
   633     if ( aPointerEvent.iType == TPointerEvent::EButton1Down
   617             && itemExists  )
   634             && itemExists  )
   625     	{
   642     	{
   626     	if ( itemExists )
   643     	if ( itemExists )
   627     		{
   644     		{
   628         	if ( GetHighlight() != index )
   645         	if ( GetHighlight() != index )
   629         	    {
   646         	    {
   630         	    iTimer->StopL();
   647         	    SetHighlightVisibilityL( EFalse );
   631         	    if ( IsEditMode() )
   648         	    if ( IsEditMode() )
   632         	    	{
   649         	    	{
   633         		    SetHighlightL( index );
   650         		    SetHighlightL( index );
   634         	    	}
   651         	    	}
   635         	    }
   652         	    }
   636     		}
   653     		}
   637     	else
   654     	else
   638     		{
   655     		{
   639     		iTimer->StopL();
   656     		SetHighlightVisibilityL( EFalse );
   640     		}
   657     		}
   641     	}
   658     	}
   642 
   659 
   643 	TInt lastTopItemIndex = Widget()->TopItemIndex();
   660 	TInt lastTopItemIndex = Widget()->TopItemIndex();
   644 
   661 
   651 
   668 
   652     if ( IsEditMode() && iDragAndDropObserver )
   669     if ( IsEditMode() && iDragAndDropObserver )
   653     	{
   670     	{
   654 		HandlePointerEventsInEditModeL(aPointerEvent, abortAnimation);
   671 		HandlePointerEventsInEditModeL(aPointerEvent, abortAnimation);
   655     	}
   672     	}
   656 
       
   657     if ( iLongTapDetector )
       
   658     	{
       
   659     	if ( !itemExists )
       
   660     	    {
       
   661     	    iLongTapDetector->EnableLongTapAnimation( EFalse );
       
   662     	    }
       
   663     	TPointerEvent longTapPointerEvent = aPointerEvent;
       
   664         if ( aPointerEvent.iType == TPointerEvent::EButtonRepeat )
       
   665         	{
       
   666         	longTapPointerEvent.iType = TPointerEvent::EDrag;
       
   667         	}
       
   668         iLongTapDetector->PointerEventL( longTapPointerEvent );
       
   669     	}
       
   670 
       
   671     }
   673     }
   672 
   674 
   673 // -----------------------------------------------------------------------------
   675 // -----------------------------------------------------------------------------
   674 //
   676 //
   675 // -----------------------------------------------------------------------------
   677 // -----------------------------------------------------------------------------
   741 	    		iDrawer->Gc() );
   743 	    		iDrawer->Gc() );
   742 #endif
   744 #endif
   743     if ( !aEnable )
   745     if ( !aEnable )
   744         {
   746         {
   745         iWidget->View()->ItemDrawer()->SetFlags(
   747         iWidget->View()->ItemDrawer()->SetFlags(
   746             CListItemDrawer::EDisableHighlight );
   748             CListItemDrawer::ESingleClickDisabledHighlight );
   747 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
   749 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
   748 	    if ( transApi )
   750 	    if ( transApi )
   749 	        {
   751 	        {
   750            	transApi->Remove( MAknListBoxTfxInternal::EListHighlight );
   752            	transApi->Remove( MAknListBoxTfxInternal::EListHighlight );
   751   	        }
   753   	        }
   752 #endif
   754 #endif
   753         }
   755         }
   754     else
   756     else
   755         {
   757         {
   756         iWidget->View()->ItemDrawer()->ClearFlags(
   758         iWidget->View()->ItemDrawer()->ClearFlags(
   757             CListItemDrawer::EDisableHighlight );
   759             CListItemDrawer::ESingleClickDisabledHighlight );
   758         }
   760         }
   759    }
   761     
   760 
   762     if ( IsVisible() )
   761 // -----------------------------------------------------------------------------
   763         {
   762 //
   764         TInt highlight = GetHighlight();
   763 // -----------------------------------------------	------------------------------
   765         CListBoxView* view = Widget()->View();
       
   766         Widget()->DrawNow( TRect( view->ItemPos( highlight ),
       
   767                 view->ItemSize( highlight ) ) );
       
   768         }
       
   769     }
       
   770 
       
   771 // -----------------------------------------------------------------------------
       
   772 //
       
   773 // ----------------------------------------------------------------------------
   764 //
   774 //
   765 EXPORT_C TBool CMmWidgetContainer::IsHighlightVisible()
   775 EXPORT_C TBool CMmWidgetContainer::IsHighlightVisible()
   766     {
   776     {
   767     return IsTimerActive();
   777     return !( iWidget->View()->ItemDrawer()->Flags() & 
       
   778     		CListItemDrawer::ESingleClickDisabledHighlight );
   768     }
   779     }
   769 
   780 
   770 // -----------------------------------------------------------------------------
   781 // -----------------------------------------------------------------------------
   771 //
   782 //
   772 // -----------------------------------------------------------------------------
   783 // -----------------------------------------------------------------------------
  1012             }
  1023             }
  1013         }
  1024         }
  1014 
  1025 
  1015     if ( resp == EKeyWasNotConsumed )
  1026     if ( resp == EKeyWasNotConsumed )
  1016         {
  1027         {
  1017 //        here is a workaround for avkon to enable cursor movement we need to set highlight visibility
       
  1018 //        to ETrue so that single click implementation in avkon will change the current item index.
       
  1019         SetHighlightVisibilityL(ETrue); //workaround
       
  1020         resp = iWidget->OfferKeyEventL( aKeyEvent, aType );
  1028         resp = iWidget->OfferKeyEventL( aKeyEvent, aType );
  1021         SetHighlightVisibilityL(EFalse);//workaround
       
  1022         }
  1029         }
  1023 
  1030 
  1024     if ( iKeyEventObserver )
  1031     if ( iKeyEventObserver )
  1025     	{
  1032     	{
  1026     	resp = iKeyEventObserver->HandleKeyPressedL( aKeyEvent, aType );
  1033     	resp = iKeyEventObserver->HandleKeyPressedL( aKeyEvent, aType );
  1038     		{
  1045     		{
  1039     		iAllowLongPress = ETrue;
  1046     		iAllowLongPress = ETrue;
  1040 
  1047 
  1041 			SetHighlightVisibilityL( ETrue );
  1048 			SetHighlightVisibilityL( ETrue );
  1042 			SetDefaultHighlightL( ETrue );
  1049 			SetDefaultHighlightL( ETrue );
  1043 			if ( iTimer )
  1050 			HandleForegroundGainedL();
  1044 				{
       
  1045 				iTimer->StartL( KDelayInSeconds6, EFalse );
       
  1046 				HandleForegroundGainedL();
       
  1047 				}
       
  1048 			}
  1051 			}
  1049     	}
  1052     	}
  1050     return resp;
  1053     return resp;
  1051     }
  1054     }
  1052 
       
  1053 
       
  1054 // -----------------------------------------------------------------------------
       
  1055 //
       
  1056 // -----------------------------------------------------------------------------
       
  1057 //
       
  1058 //TBool CMmWidgetContainer::HighlightWouldLoop( const TKeyEvent& aKeyEvent,
       
  1059 //		const TEventCode& aType )
       
  1060 //	{
       
  1061 //	TInt viewColCount ( ColumnsInCurrentView() );
       
  1062 //
       
  1063 //	if ( viewColCount == 0 )
       
  1064 //		return ETrue;
       
  1065 //
       
  1066 //	// this allows to finish drag'n'drop operation
       
  1067 //	if ( iDraggedIndex != KErrNotFound && aType == EEventKeyUp )
       
  1068 //		return EFalse;
       
  1069 //
       
  1070 //	TBool wouldLoop = EFalse;
       
  1071 //	TInt highlightIndex = GetHighlight();
       
  1072 //
       
  1073 //	TInt highlightRow = highlightIndex / viewColCount;
       
  1074 //	TInt lastRowWithItems = ( NumberOfItems() - 1 ) / viewColCount;
       
  1075 //	TInt highlightCol = highlightIndex % viewColCount;
       
  1076 //	TInt lastItemCol = ( NumberOfItems() - 1 ) % viewColCount;
       
  1077 //
       
  1078 //	TInt keyScanCode = aKeyEvent.iScanCode;
       
  1079 //
       
  1080 //	if ( AknLayoutUtils::LayoutMirrored() )
       
  1081 //		{
       
  1082 //		if ( keyScanCode == EStdKeyLeftArrow )
       
  1083 //			keyScanCode = EStdKeyRightArrow;
       
  1084 //		else if ( keyScanCode == EStdKeyRightArrow )
       
  1085 //			keyScanCode = EStdKeyLeftArrow;
       
  1086 //		}
       
  1087 //
       
  1088 //	if ( keyScanCode == EStdKeyRightArrow )
       
  1089 //		{
       
  1090 //			if ( highlightIndex == NumberOfItems() - 1 )
       
  1091 //				wouldLoop = ETrue;
       
  1092 //			else if ( highlightCol == viewColCount - 1 )
       
  1093 //				wouldLoop = ETrue;
       
  1094 //		}
       
  1095 //	else if ( keyScanCode == EStdKeyLeftArrow )
       
  1096 //		{
       
  1097 //			if ( highlightCol == 0 )
       
  1098 //				wouldLoop = ETrue;
       
  1099 //		}
       
  1100 //	else if ( keyScanCode == EStdKeyUpArrow )
       
  1101 //		{
       
  1102 //			if ( highlightRow == 0 )
       
  1103 //				wouldLoop = ETrue;
       
  1104 //		}
       
  1105 //	else if ( keyScanCode == EStdKeyDownArrow )
       
  1106 //		{
       
  1107 //			if ( highlightRow == lastRowWithItems )
       
  1108 //				wouldLoop = ETrue;
       
  1109 //			else if ( highlightRow == lastRowWithItems - 1 && highlightCol > lastItemCol)
       
  1110 //				wouldLoop = ETrue;
       
  1111 //		}
       
  1112 //
       
  1113 //	return wouldLoop;
       
  1114 //	}
       
  1115 
  1055 
  1116 // -----------------------------------------------------------------------------
  1056 // -----------------------------------------------------------------------------
  1117 //
  1057 //
  1118 // -----------------------------------------------------------------------------
  1058 // -----------------------------------------------------------------------------
  1119 //
  1059 //
  1170 							|| aKeyEvent.iScanCode == EStdKeyDownArrow;
  1110 							|| aKeyEvent.iScanCode == EStdKeyDownArrow;
  1171 
  1111 
  1172     // handle arrow: draw highlight when arrow used
  1112     // handle arrow: draw highlight when arrow used
  1173     if ( arrowHasHandling )
  1113     if ( arrowHasHandling )
  1174         {
  1114         {
  1175         if ( !iTimer->IsActive() )
  1115         if ( !IsHighlightVisible() )
  1176             {
  1116             {
  1177             if ( aType == EEventKey  || aType == EEventKeyUp )
  1117             if ( aType == EEventKey  || aType == EEventKeyUp )
  1178                 {
  1118                 {
  1179                 // if no highlight and key released - show highlight
  1119                 SetHighlightVisibilityL( ETrue );
  1180                 SetDefaultHighlightL( EFalse );
  1120                 SetDefaultHighlightL( ETrue );
  1181                 }
  1121                 }
  1182            	// ignore all navigation events when highlight not visible
  1122            	// override avkon's default highlight setting
  1183          	resp = EKeyWasConsumed;
  1123          	resp = EKeyWasConsumed;
  1184             }
  1124             }
  1185         else
  1125         else
  1186             {
  1126             {
  1187 
       
  1188             // this block is used to set the highlight only once for each event
  1127             // this block is used to set the highlight only once for each event
  1189             if ( aKeyEvent.iRepeats > 0 )
  1128             if ( aKeyEvent.iRepeats > 0 )
  1190                 {
  1129                 {
  1191                 // if repeated key events we move focus on EEventKey
  1130                 // if repeated key events we move focus on EEventKey
  1192                 if ( aType == EEventKey )
  1131                 if ( aType == EEventKey )
  1201                     {
  1140                     {
  1202                     SetHighlightL( iWidget->CurrentItemIndex() );
  1141                     SetHighlightL( iWidget->CurrentItemIndex() );
  1203                     }
  1142                     }
  1204                 }
  1143                 }
  1205             }
  1144             }
  1206 
       
  1207     	// run timer in order to hide the highlight
       
  1208 	    if ( aType == EEventKey && iTimer)
       
  1209 	        {
       
  1210 	        iTimer->StartL( KDelayInSeconds6, EFalse );
       
  1211 	        HandleForegroundGainedL();
       
  1212 	        }
       
  1213     	}
  1145     	}
  1214     else if( arrowKeyPressed )
  1146     else if( arrowKeyPressed )
  1215         {
  1147         {
  1216         // ignore left and right arrows in list
  1148         // ignore left and right arrows in list
  1217         resp = EKeyWasConsumed;
  1149         resp = EKeyWasConsumed;
  1647 //
  1579 //
  1648 // ---------------------------------------------------------------------------
  1580 // ---------------------------------------------------------------------------
  1649 //
  1581 //
  1650 void CMmWidgetContainer::MakeVisible(TBool aVisible)
  1582 void CMmWidgetContainer::MakeVisible(TBool aVisible)
  1651 	{
  1583 	{
  1652 	if (!aVisible)
  1584 	if ( !aVisible )
  1653 		{
  1585 		{
  1654 		ASSERT(iTimer);
       
  1655 		TRAP_IGNORE( iTimer->StopL( EFalse ) );
       
  1656 		RestoreWidgetPosition();
  1586 		RestoreWidgetPosition();
  1657 		CacheWidgetPosition();
  1587 		CacheWidgetPosition();
  1658 		iDrawer->RemoveFloatingItems();
  1588 		iDrawer->RemoveFloatingItems();
  1659 		}
  1589 		}
  1660 	else if (aVisible)
  1590 	else if ( aVisible )
  1661 		{
  1591 		{
  1662 		RestoreWidgetPosition();
  1592 		RestoreWidgetPosition();
  1663 		}
  1593 		}
  1664 	CCoeControl::MakeVisible(aVisible);
  1594 	CCoeControl::MakeVisible(aVisible);
  1665 	iWidget->MakeVisible(aVisible);
  1595 	iWidget->MakeVisible(aVisible);
       
  1596 	if ( !aVisible )
       
  1597         {
       
  1598         SetHighlightVisibilityL( EFalse );
       
  1599         }
  1666 	}
  1600 	}
  1667 
  1601 
  1668 // ---------------------------------------------------------------------------
  1602 // ---------------------------------------------------------------------------
  1669 //
  1603 //
  1670 // ---------------------------------------------------------------------------
  1604 // ---------------------------------------------------------------------------
  1708 //
  1642 //
  1709 // ---------------------------------------------------------------------------
  1643 // ---------------------------------------------------------------------------
  1710 //
  1644 //
  1711 void CMmWidgetContainer::HandleNumberOfItemsChangedL( TItemsChangeType aChange )
  1645 void CMmWidgetContainer::HandleNumberOfItemsChangedL( TItemsChangeType aChange )
  1712 	{
  1646 	{
  1713 	ASSERT(iTimer);
  1647 	SetHighlightVisibilityL( EFalse );
  1714 	iTimer->StopL();
       
  1715 	if ( aChange == EItemsAdded )
  1648 	if ( aChange == EItemsAdded )
  1716 		{
  1649 		{
  1717 		HandleItemAdditionL();
  1650 		HandleItemAdditionL();
  1718 		}
  1651 		}
  1719 	else if ( aChange == EItemsRemoved )
  1652 	else if ( aChange == EItemsRemoved )
  1892 
  1825 
  1893 // -----------------------------------------------------------------------------
  1826 // -----------------------------------------------------------------------------
  1894 //
  1827 //
  1895 // -----------------------------------------------------------------------------
  1828 // -----------------------------------------------------------------------------
  1896 //
  1829 //
  1897 TBool CMmWidgetContainer::IsTimerActive( TInt aItemIndex )
       
  1898 	{
       
  1899 	ASSERT(iTimer);
       
  1900 	TBool timerActive = iTimer->IsActive();
       
  1901 	if ( aItemIndex >= 0 && timerActive )
       
  1902 		{
       
  1903 		timerActive = ( aItemIndex == iTimer->TimerHighlightIndex() );
       
  1904 		}
       
  1905 	return timerActive;
       
  1906 	}
       
  1907 
       
  1908 // -----------------------------------------------------------------------------
       
  1909 //
       
  1910 // -----------------------------------------------------------------------------
       
  1911 //
       
  1912 void CMmWidgetContainer::HandleLongTapEventL( const TPoint& aPenEventLocation,
  1830 void CMmWidgetContainer::HandleLongTapEventL( const TPoint& aPenEventLocation,
  1913                                       const TPoint& aPenEventScreenLocation )
  1831                                       const TPoint& aPenEventScreenLocation )
  1914 	{
  1832 	{
  1915 	TInt index( KErrNotFound );
  1833 	TInt index( KErrNotFound );
  1916 	if ( iWidget->View()->XYPosToItemIndex( aPenEventLocation, index ) )
  1834 	if ( iWidget->View()->XYPosToItemIndex( aPenEventLocation, index ) )
  1917 		{
  1835 		{
  1918 		ASSERT( iTimer );
  1836 		SetHighlightVisibilityL( ETrue );
  1919 		iTimer->ContinueL( KDelayInfinite );
       
  1920 	    iLongTapInProgress = ETrue;
  1837 	    iLongTapInProgress = ETrue;
  1921 		if ( iLongTapObserver )
  1838 		if ( iLongTapObserver )
  1922 			{
  1839 			{
  1923 			iLongTapObserver->HandleLongTapEventL( aPenEventScreenLocation );
  1840 			iLongTapObserver->HandleLongTapEventL( aPenEventScreenLocation );
  1924 			}
  1841 			}
  1943 	if ( iLongTapInProgress )
  1860 	if ( iLongTapInProgress )
  1944 		{
  1861 		{
  1945 		iLongTapInProgress = EFalse;
  1862 		iLongTapInProgress = EFalse;
  1946 		if( aStopTimer )
  1863 		if( aStopTimer )
  1947 			{
  1864 			{
  1948 			ASSERT( iTimer );
  1865 			SetHighlightVisibilityL( EFalse );
  1949 			iTimer->StopL();
       
  1950 			}
  1866 			}
  1951 		}
  1867 		}
  1952 	}
  1868 	}
  1953 
  1869 
  1954 // ---------------------------------------------------------------------------
  1870 // ---------------------------------------------------------------------------
  1956 // ---------------------------------------------------------------------------
  1872 // ---------------------------------------------------------------------------
  1957 //
  1873 //
  1958 void CMmWidgetContainer::HandleListBoxEventL( CEikListBox* aListBox,
  1874 void CMmWidgetContainer::HandleListBoxEventL( CEikListBox* aListBox,
  1959         TListBoxEvent aEventType )
  1875         TListBoxEvent aEventType )
  1960     {
  1876     {
  1961     ASSERT( iTimer );
       
  1962 //    handle same behaviour in edit mode and normal mode
  1877 //    handle same behaviour in edit mode and normal mode
  1963     switch ( aEventType )
  1878     switch ( aEventType )
  1964 		{
  1879 		{
  1965 		case MEikListBoxObserver::EEventPenDownOnItem:
  1880 		case MEikListBoxObserver::EEventPenDownOnItem:
  1966 			{
  1881 			{
  1967 			iDragOccured = EFalse;
  1882 			iDragOccured = EFalse;
  1968 			if ( !iLongTapInProgress )
  1883 			if ( !iLongTapInProgress )
  1969 				{
  1884 				{
  1970 				iTimer->StartL( KDelayInfinite );
  1885 				SetHighlightVisibilityL( ETrue );
  1971 				}
  1886 				}
  1972 			break;
  1887 			break;
  1973 			}
  1888 			}
  1974 		case MEikListBoxObserver::EEventItemSingleClicked:
  1889 		case MEikListBoxObserver::EEventItemSingleClicked:
  1975 			{
  1890 			{
  1976 			if ( !iDragOccured && !iLongTapInProgress )
  1891 			if ( !iDragOccured && !iLongTapInProgress )
  1977 				{
  1892 				{
  1978 				SetHighlightL( Widget()->CurrentItemIndex() );
  1893 				SetHighlightL( Widget()->CurrentItemIndex() );
  1979 				iTimer->StopL( ETrue );
  1894 				SetHighlightVisibilityL( EFalse );
  1980 				}
  1895 				}
  1981 			iDragOccured = EFalse;
  1896 			iDragOccured = EFalse;
  1982 			break;
  1897 			break;
  1983 			}
  1898 			}
  1984 		case MEikListBoxObserver::EEventItemDraggingActioned:
  1899 		case MEikListBoxObserver::EEventItemDraggingActioned:
  1985 			{
  1900 			{
  1986 			iTimer->StopL();
  1901 			SetHighlightVisibilityL( EFalse );
  1987 			iDragOccured = ETrue;
  1902 			iDragOccured = ETrue;
  1988 			break;
  1903 			break;
  1989 			}
  1904 			}
  1990 		case MEikListBoxObserver::EEventPanningStarted:
  1905 		case MEikListBoxObserver::EEventPanningStarted:
  1991 		case MEikListBoxObserver::EEventPanningStopped:
  1906 		case MEikListBoxObserver::EEventPanningStopped:
  1992 		case MEikListBoxObserver::EEventFlickStarted:
  1907 		case MEikListBoxObserver::EEventFlickStarted:
  1993 		case MEikListBoxObserver::EEventFlickStopped:
  1908 		case MEikListBoxObserver::EEventFlickStopped:
  1994 			{
  1909 			{
  1995 			iTimer->StopL( EFalse );
  1910 			SetHighlightVisibilityL( EFalse );
  1996 			break;
  1911 			break;
  1997 			}
  1912 			}
  1998 		}
  1913 		}
  1999 
  1914 
  2000 //    handle different behaviour in edit mode and normal mode
  1915 //    handle different behaviour in edit mode and normal mode
  2038         iListBoxObserver->HandleListBoxEventL( aListBox, aEventType );
  1953         iListBoxObserver->HandleListBoxEventL( aListBox, aEventType );
  2039         }
  1954         }
  2040 
  1955 
  2041     }
  1956     }
  2042 
  1957 
  2043 // ---------------------------------------------------------------------------
       
  2044 //
       
  2045 // ---------------------------------------------------------------------------
       
  2046 //
       
  2047 EXPORT_C void CMmWidgetContainer::HandleOptionsMenuVisibilityChangeL(
       
  2048 		TBool aOptionsMenuVisible )
       
  2049 	{
       
  2050 	if ( IsTimerActive() )
       
  2051 		{
       
  2052 		TInt delay = (aOptionsMenuVisible) ? KDelayInfinite : KDelayInSeconds6;
       
  2053 		iTimer->StartL( delay, EFalse );
       
  2054 		}
       
  2055 	}
       
  2056 //End of file
  1958 //End of file