menufw/menufwui/mmwidgets/src/mmwidgetcontainer.cpp
branchRCL_3
changeset 12 9674c1a575e9
parent 11 ff572dfe6d86
child 17 b8fae6b8a148
equal deleted inserted replaced
11:ff572dfe6d86 12:9674c1a575e9
    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.56 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: MM_71.1.17.1.57 % << 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>
   636     CCoeControl::HandlePointerEventL(aPointerEvent);
   636     CCoeControl::HandlePointerEventL(aPointerEvent);
   637 
   637 
   638     if ( aPointerEvent.iType == TPointerEvent::EButton1Down
   638     if ( aPointerEvent.iType == TPointerEvent::EButton1Down
   639             && itemExists  )
   639             && itemExists  )
   640         {
   640         {
   641         SetHighlightL( index );
   641         SetHighlightL( index );///////////--
   642         }
   642         }
   643     else if ( aPointerEvent.iType == TPointerEvent::EDrag
   643     else if ( aPointerEvent.iType == TPointerEvent::EDrag
   644               // the line below is needed to enable edit mode in the list widget
   644               // the line below is needed to enable edit mode in the list widget
   645     		  // because behaviour in the grid and list is different
   645     		  // because behaviour in the grid and list is different
   646     		  || (aPointerEvent.iType == TPointerEvent::EButtonRepeat && WidgetType() == EGridWidget ))
   646     		  || (aPointerEvent.iType == TPointerEvent::EButtonRepeat && WidgetType() == EGridWidget ))
   736 //
   736 //
   737 EXPORT_C void CMmWidgetContainer::SetHighlightVisibilityL( TBool aEnable )
   737 EXPORT_C void CMmWidgetContainer::SetHighlightVisibilityL( TBool aEnable )
   738     {
   738     {
   739     // activate the model
   739     // activate the model
   740     CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel();
   740     CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel();
       
   741 
   741     if ( suiteModel )
   742     if ( suiteModel )
   742         {
   743         {
   743         suiteModel->SetActiveL( aEnable );
   744         suiteModel->SetActiveL( aEnable );
   744         }
   745         }
   745 
   746 
   764         else
   765         else
   765             {
   766             {
   766             iWidget->View()->ItemDrawer()->ClearFlags(
   767             iWidget->View()->ItemDrawer()->ClearFlags(
   767                 CListItemDrawer::ESingleClickDisabledHighlight );
   768                 CListItemDrawer::ESingleClickDisabledHighlight );
   768             }
   769             }
   769     
   770 
   770         if ( IsVisible() )
   771         if ( IsVisible() )
   771             {
   772             {
   772             TInt highlight = GetHighlight();
   773             TInt highlight = GetHighlight();
   773             CListBoxView* view = Widget()->View();
   774             CListBoxView* view = Widget()->View();
   774             Widget()->DrawNow( TRect( view->ItemPos( highlight ),
   775             Widget()->DrawNow( TRect( view->ItemPos( highlight ),
  1188 
  1189 
  1189     TInt numberOfItemsBefore (0);
  1190     TInt numberOfItemsBefore (0);
  1190     numberOfItemsBefore = GetMmModel()->NumberOfItems();
  1191     numberOfItemsBefore = GetMmModel()->NumberOfItems();
  1191 
  1192 
  1192     GetMmModel()->SetSuiteModelL( aModel );
  1193     GetMmModel()->SetSuiteModelL( aModel );
  1193     
  1194 
  1194     TBool highlightVisibleBefore = iWidget->IsVisible() && IsHighlightVisible();
  1195     TBool highlightVisibleBefore = iWidget->IsVisible() && IsHighlightVisible();
  1195 
  1196 
  1196     // This needs to be in place (disabling redraw)
  1197     // This needs to be in place (disabling redraw)
  1197     // to udpate widget internal state, however to wait for
  1198     // to udpate widget internal state, however to wait for
  1198     // drawing until all highlight set matters are solved.
  1199     // drawing until all highlight set matters are solved.
  1208     if ( prevModel && aModel )
  1209     if ( prevModel && aModel )
  1209         {
  1210         {
  1210         SetupWidgetLayoutL();
  1211         SetupWidgetLayoutL();
  1211         }
  1212         }
  1212     iWidget->MakeVisible(ETrue);
  1213     iWidget->MakeVisible(ETrue);
  1213     
  1214 
  1214     if ( highlightVisibleBefore )
  1215     if ( highlightVisibleBefore )
  1215         {
  1216         {
  1216         SetHighlightVisibilityL( ETrue );
  1217         SetHighlightVisibilityL( ETrue );
  1217         }
  1218         }
  1218 
  1219 
  1893     {
  1894     {
  1894 //    handle same behaviour in edit mode and normal mode
  1895 //    handle same behaviour in edit mode and normal mode
  1895     switch ( aEventType )
  1896     switch ( aEventType )
  1896 		{
  1897 		{
  1897 		case MEikListBoxObserver::EEventPenDownOnItem:
  1898 		case MEikListBoxObserver::EEventPenDownOnItem:
  1898 			{
       
  1899 			iDragOccured = EFalse;
       
  1900 			if ( !iLongTapInProgress )
       
  1901 				{
       
  1902 				SetHighlightVisibilityL( ETrue );
       
  1903 				}
       
  1904 			break;
       
  1905 			}
       
  1906 		case MEikListBoxObserver::EEventItemSingleClicked:
  1899 		case MEikListBoxObserver::EEventItemSingleClicked:
  1907 			{
  1900 			{
  1908 			if ( !iDragOccured && !iLongTapInProgress )
       
  1909 				{
       
  1910 				SetHighlightL( Widget()->CurrentItemIndex() );
       
  1911 				SetHighlightVisibilityL( EFalse );
       
  1912 				}
       
  1913 			iDragOccured = EFalse;
  1901 			iDragOccured = EFalse;
  1914 			break;
  1902 			break;
  1915 			}
  1903 			}
  1916 		case MEikListBoxObserver::EEventItemDraggingActioned:
  1904 		case MEikListBoxObserver::EEventItemDraggingActioned:
  1917 			{
  1905 			{
  1918 			SetHighlightVisibilityL( EFalse );
       
  1919 			iDragOccured = ETrue;
  1906 			iDragOccured = ETrue;
  1920 			break;
  1907 			break;
  1921 			}
  1908 			}
  1922 		case MEikListBoxObserver::EEventPanningStarted:
       
  1923 		case MEikListBoxObserver::EEventPanningStopped:
       
  1924 		case MEikListBoxObserver::EEventFlickStarted:
       
  1925 		case MEikListBoxObserver::EEventFlickStopped:
       
  1926 			{
       
  1927 			SetHighlightVisibilityL( EFalse );
       
  1928 			break;
       
  1929 			}
       
  1930 		}
  1909 		}
  1931 
  1910 
  1932 //    handle different behaviour in edit mode and normal mode
  1911 //    handle different behaviour in edit mode and normal mode
  1933 	if ( !IsEditMode() )
  1912 	if ( !IsEditMode() )
  1934 		{
  1913 		{
  1935 		switch ( aEventType )
  1914 		switch ( aEventType )
  1936 			{
  1915 			{
  1937 			case MEikListBoxObserver::EEventFlickStarted:
  1916 			case MEikListBoxObserver::EEventFlickStarted:
       
  1917 			case MEikListBoxObserver::EEventPanningStarted:
  1938 				{
  1918 				{
  1939 				static_cast<CMmListBoxItemDrawer*>(
  1919 				static_cast<CMmListBoxItemDrawer*>(
  1940 						Widget()->View()->ItemDrawer() )->
  1920 						Widget()->View()->ItemDrawer() )->
  1941 						EnableCachedDataUse( ETrue );
  1921 						EnableCachedDataUse( ETrue );
  1942 				break;
  1922 				break;
  1947 						Widget()->View()->ItemDrawer() )->
  1927 						Widget()->View()->ItemDrawer() )->
  1948 						EnableCachedDataUse( EFalse );
  1928 						EnableCachedDataUse( EFalse );
  1949 				DrawView();
  1929 				DrawView();
  1950 				break;
  1930 				break;
  1951 				}
  1931 				}
       
  1932 			case MEikListBoxObserver::EEventPanningStopped:
       
  1933 				{
       
  1934 				static_cast<CMmListBoxItemDrawer*>(
       
  1935 						Widget()->View()->ItemDrawer() )->
       
  1936 						EnableCachedDataUse( EFalse );
       
  1937 				break;
       
  1938 				}
  1952 			}
  1939 			}
  1953 		}
  1940 		}
  1954 	else
  1941 	else
  1955 		{
  1942 		{
  1956 		switch ( aEventType )
  1943 		switch ( aEventType )
  1963 				break;
  1950 				break;
  1964 				}
  1951 				}
  1965 			}
  1952 			}
  1966 		}
  1953 		}
  1967 
  1954 
  1968     if ( iListBoxObserver && !iLongTapInProgress && !iDrawer->IsDraggable() )
  1955     if ( aEventType == MEikListBoxObserver::EEventItemSingleClicked &&
       
  1956         iListBoxObserver && !iLongTapInProgress && !iDrawer->IsDraggable() )
  1969         {
  1957         {
  1970         iListBoxObserver->HandleListBoxEventL( aListBox, aEventType );
  1958         iListBoxObserver->HandleListBoxEventL( aListBox, aEventType );
  1971         }
  1959         }
  1972     }
  1960     }
  1973 
       
  1974 //End of file
  1961 //End of file