uifw/EikStd/coctlsrc/EIKLBX.CPP
branchRCL_3
changeset 23 3d340a0166ff
parent 18 0aa5fbdfbc30
child 25 941195f2d488
equal deleted inserted replaced
18:0aa5fbdfbc30 23:3d340a0166ff
     1 /*
     1 /*
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    72 #include <touchfeedback.h>
    72 #include <touchfeedback.h>
    73 #include <akncollection.h>
    73 #include <akncollection.h>
    74 #include <aknitemactionmenu.h>
    74 #include <aknitemactionmenu.h>
    75 #include <aknlongtapdetector.h>
    75 #include <aknlongtapdetector.h>
    76 #include <AknPriv.hrh>
    76 #include <AknPriv.hrh>
       
    77 #include <aknmarkingmodeobserver.h>
    77 #include "akntrace.h"
    78 #include "akntrace.h"
    78 
    79 
    79 // timeout for long keypress used in markable lists
    80 // timeout for long keypress used in markable lists
    80 const TInt KLongPressInterval = 600000; // 0,6 seconds
    81 const TInt KLongPressInterval = 600000; // 0,6 seconds
    81 const TInt KEikListBoxPointerRepeatInterval = 100000;  // in micro conds (= 0.1 secod)
    82 const TInt KEikListBoxPointerRepeatInterval = 100000;  // in micro conds (= 0.1 secod)
    83 // Maximum scroll speed ( max amount of items moved one time )
    84 // Maximum scroll speed ( max amount of items moved one time )
    84 const TInt KDefaultMaxSpeed = 30;
    85 const TInt KDefaultMaxSpeed = 30;
    85 const TInt KDefaultStepSpeed = 5;
    86 const TInt KDefaultStepSpeed = 5;
    86 const TInt KEikListBoxInvalidIndex=-1;
    87 const TInt KEikListBoxInvalidIndex=-1;
    87 //interval time for disable second point event
    88 //interval time for disable second point event
    88 const TInt KTwoPointerUpEventInterval = 120;    //  120 millisecond ( = 0.12 second ) 
    89 const TInt KTwoPointerUpEventInterval = 120;    //  120 millisecond ( = 0.12 second )
       
    90 const TInt KPointerDownAndUpThreshold = 5;
    89 // -----------------------------------------------------------------------------
    91 // -----------------------------------------------------------------------------
    90 // If a parent to the supplied control has its Gc set, this function will find 
    92 // If a parent to the supplied control has its Gc set, this function will find 
    91 // it and return it.
    93 // it and return it.
    92 // -----------------------------------------------------------------------------
    94 // -----------------------------------------------------------------------------
    93 //
    95 //
   375 
   377 
   376 NONSHARABLE_CLASS(CListBoxExt) : public CBase, public MListVisibilityObserver,
   378 NONSHARABLE_CLASS(CListBoxExt) : public CBase, public MListVisibilityObserver,
   377     public MCenRepNotifyHandlerCallback,
   379     public MCenRepNotifyHandlerCallback,
   378     public MAknPhysicsObserver,
   380     public MAknPhysicsObserver,
   379     public MAknCollection,
   381     public MAknCollection,
       
   382     public MAknMarkingCollection,
   380     public MAknLongTapDetectorCallBack
   383     public MAknLongTapDetectorCallBack
   381     {
   384     {
   382 public:
   385 public:
   383     static CListBoxExt* NewL(CEikListBox& aListBox);
   386     static CListBoxExt* NewL(CEikListBox& aListBox);
   384     ~CListBoxExt();
   387     ~CListBoxExt();
   446      * @param  a0            First extension method parameter.
   449      * @param  a0            First extension method parameter.
   447      * @param  a1            Second extension method parameter.
   450      * @param  a1            Second extension method parameter.
   448      */    
   451      */    
   449     TInt CollectionExtension( TUint aExtensionId, TAny*& a0, TAny* a1 );
   452     TInt CollectionExtension( TUint aExtensionId, TAny*& a0, TAny* a1 );
   450 
   453 
       
   454 // From MAknMarkingCollection
       
   455     /**
       
   456      * Sets multiple marking state.
       
   457      *
       
   458      * @param aActive ETrue if multiple marking should be active.
       
   459      */
       
   460     void SetMultipleMarkingState( TBool aActive );
       
   461     
       
   462     /**
       
   463      * Returns whether the observer accepts ending of marking mode
       
   464      * 
       
   465      * @return ETrue if observer accepts exiting marking mode
       
   466      */
       
   467     TBool ExitMarkingMode();
       
   468     
       
   469     /**
       
   470      * Returns the collection marking state. The state is combination of
       
   471      * flags defined in @c TStateFlag. 
       
   472      *
       
   473      * @return  Collection state.
       
   474      */
       
   475     TUint MarkingState() const;
       
   476 
       
   477     /**
       
   478      * Marks the currently selected item.
       
   479      */
       
   480     void MarkCurrentItemL();
       
   481      
       
   482     /**
       
   483      * Marks all items in the collection.
       
   484      */
       
   485     void MarkAllL(); 
       
   486 
       
   487     /**
       
   488      * Unmarks all items in the collection.
       
   489      */
       
   490     void UnmarkAll();
       
   491     
       
   492     /*
       
   493      * Can current item be marked
       
   494      * 
       
   495      * @return ETrue if item can be marked
       
   496      */
       
   497     TBool CurrentItemMarkable();
       
   498     
   451 // From MAknLongTapDetectorCallBack
   499 // From MAknLongTapDetectorCallBack
   452     /**
   500     /**
   453      * Long tap detector callback 
   501      * Long tap detector callback 
   454      *
   502      *
   455      * @param aPenEventLocation Long tap event location relative to parent control.
   503      * @param aPenEventLocation Long tap event location relative to parent control.
   510      * Returns ETrue if list has currently marked items.
   558      * Returns ETrue if list has currently marked items.
   511      * 
   559      * 
   512      * @return ETrue if list has marked items.
   560      * @return ETrue if list has marked items.
   513      */
   561      */
   514     TBool MarkedItems() const;
   562     TBool MarkedItems() const;
       
   563     
       
   564     /**
       
   565      * Ignores pointer events until next up event. 
       
   566      * 
       
   567      * @return ETrue if the pointer event ignore was enabled.
       
   568      */
       
   569     TBool IgnorePointerEventsUntilUp();
   515 
   570 
   516 public:
   571 public:
   517     void InitPhysicsL();
   572     void InitPhysicsL();
   518 	
   573 	
   519     /**
   574     /**
   616     TInt iInterval;
   671     TInt iInterval;
   617     CPeriodic* iHighlightTimer;    
   672     CPeriodic* iHighlightTimer;    
   618     CAknPhysics *iPhysics;
   673     CAknPhysics *iPhysics;
   619     TPoint iDragStartPosition;
   674     TPoint iDragStartPosition;
   620     TPoint iLastPointerPos;
   675     TPoint iLastPointerPos;
   621     TBool iBackgroundDrawingSuppressed;
       
   622     TBool iClickEventsAllowed;
   676     TBool iClickEventsAllowed;
   623     TBool iScrolling;
   677     TBool iScrolling;
   624     TSize iViewSize;
   678     TSize iViewSize;
   625     TSize iWorldSize;
   679     TSize iWorldSize;
   626     TBool iItemDraggingReported;
   680     TBool iItemDraggingReported;
   680 
   734 
   681    /**
   735    /**
   682     * Item that opened the item action menu
   736     * Item that opened the item action menu
   683     */
   737     */
   684     TInt iLongTappedItem;
   738     TInt iLongTappedItem;
       
   739 
       
   740     /**
       
   741      * Marking mode on / off.
       
   742      */
       
   743     TBool iMarkingModeInUse;
       
   744     
       
   745     /**
       
   746      * Marking mode observer.
       
   747      */
       
   748     MAknMarkingModeObserver* iMarkingModeObserver;
       
   749     
   685     /**
   750     /**
   686      * Pointer event to be forwarded to the long tap detector upon
   751      * Pointer event to be forwarded to the long tap detector upon
   687      * highlight timer completion.
   752      * highlight timer completion.
   688      */
   753      */
   689     TPointerEvent iDelayedPointerDownEvent;
   754     TPointerEvent iDelayedPointerDownEvent;
       
   755     
       
   756     /**
       
   757      * Ordinal position of listbox window, before stylus menu is opened.
       
   758      */
       
   759     TInt iOldWinPos;
   690     
   760     
   691 private:
   761 private:
   692     CMatchBuffer* iBuffer;
   762     CMatchBuffer* iBuffer;
   693     CEikListBox& iListBox;
   763     CEikListBox& iListBox;
   694     CEikListBox::TReasonForFocusLost iReasonForFocusLost;
   764     CEikListBox::TReasonForFocusLost iReasonForFocusLost;
   749       iLastItemIndex(-1),
   819       iLastItemIndex(-1),
   750       iItemActionMenu( NULL ),
   820       iItemActionMenu( NULL ),
   751       iLongTapDetector( NULL ),
   821       iLongTapDetector( NULL ),
   752       iSingleClickEnabled( iAvkonAppUi->IsSingleClickCompatible() ),
   822       iSingleClickEnabled( iAvkonAppUi->IsSingleClickCompatible() ),
   753       iLongTappedItem( KErrNotFound ),
   823       iLongTappedItem( KErrNotFound ),
   754       iListBox(aListBox)      
   824       iOldWinPos( KErrNotFound ),
       
   825       iListBox(aListBox)
   755     {
   826     {
   756     }
   827     }
   757 
   828 
   758 CListBoxExt::~CListBoxExt()
   829 CListBoxExt::~CListBoxExt()
   759     {
   830     {
   943     if ( iLongTappedItem != KErrNotFound )
  1014     if ( iLongTappedItem != KErrNotFound )
   944         {
  1015         {
   945         EnableHighlight( EFalse );
  1016         EnableHighlight( EFalse );
   946         iListBox.iView->DrawItem( iLongTappedItem );
  1017         iListBox.iView->DrawItem( iLongTappedItem );
   947         iLongTappedItem = KErrNotFound;
  1018         iLongTappedItem = KErrNotFound;
       
  1019         iOldWinPos = KErrNotFound;
   948         }
  1020         }
   949     }
  1021     }
   950 
  1022 
   951 
  1023 
   952 // -----------------------------------------------------------------------------
  1024 // -----------------------------------------------------------------------------
   953 // CListBoxExt::CollectionExtension
  1025 // CListBoxExt::CollectionExtension
   954 // -----------------------------------------------------------------------------
  1026 // -----------------------------------------------------------------------------
   955 //
  1027 //
   956 TInt CListBoxExt::CollectionExtension(
  1028 TInt CListBoxExt::CollectionExtension(
   957         TUint /*aExtensionId*/, TAny*& /*a0*/, TAny* /*a1*/ )
  1029         TUint aExtensionId, TAny*& a0, TAny* /*a1*/ )
   958     {
  1030     {
       
  1031     if ( aExtensionId == MAknMarkingCollection::TYPE )
       
  1032         {
       
  1033         a0 = static_cast<MAknMarkingCollection*>( this );
       
  1034         }
       
  1035 
   959     return KErrNone;
  1036     return KErrNone;
       
  1037     }
       
  1038 
       
  1039 
       
  1040 // -----------------------------------------------------------------------------
       
  1041 // CListBoxExt::SetMultipleMarkingState
       
  1042 // -----------------------------------------------------------------------------
       
  1043 //
       
  1044 void CListBoxExt::SetMultipleMarkingState( TBool aActive )
       
  1045     {
       
  1046     _AKNTRACE_FUNC_ENTER;
       
  1047     iListBox.SetMarkingMode( aActive );
       
  1048     _AKNTRACE_FUNC_EXIT;
       
  1049     }
       
  1050 
       
  1051 // -----------------------------------------------------------------------------
       
  1052 // CListBoxExt::ExitMarkingMode
       
  1053 // -----------------------------------------------------------------------------
       
  1054 //
       
  1055 TBool CListBoxExt::ExitMarkingMode()
       
  1056     {
       
  1057     if ( iListBox.MarkingModeObserver() )
       
  1058         {
       
  1059         return iListBox.MarkingModeObserver()->ExitMarkingMode();
       
  1060         }
       
  1061     return ETrue;
       
  1062     }
       
  1063 
       
  1064 // -----------------------------------------------------------------------------
       
  1065 // CListBoxExt::MarkingState
       
  1066 // -----------------------------------------------------------------------------
       
  1067 //
       
  1068 TUint CListBoxExt::MarkingState() const
       
  1069     {
       
  1070     _AKNTRACE_FUNC_ENTER;
       
  1071     TUint state( 0 );
       
  1072     if ( iListBox.MarkingMode() )
       
  1073         {
       
  1074         state |= MAknMarkingCollection::EStateMarkingMode;
       
  1075         if ( MarkedItems() )
       
  1076             {
       
  1077             state |= MAknMarkingCollection::EStateMarkedItems;
       
  1078             }
       
  1079         if ( iListBox.Model()->NumberOfItems() == 0 )
       
  1080             {
       
  1081             state |= MAknMarkingCollection::EStateCollectionEmpty;
       
  1082             }        
       
  1083         }
       
  1084     _AKNTRACE_FUNC_EXIT;
       
  1085     return state;
       
  1086     }
       
  1087 
       
  1088 
       
  1089 // -----------------------------------------------------------------------------
       
  1090 // CListBoxExt::MarkCurrentItemL
       
  1091 // -----------------------------------------------------------------------------
       
  1092 //
       
  1093 void CListBoxExt::MarkCurrentItemL()
       
  1094     {
       
  1095     _AKNTRACE_FUNC_ENTER;
       
  1096 
       
  1097     if ( iListBox.MarkingMode() )
       
  1098         {
       
  1099         TInt index = iListBox.CurrentItemIndex();
       
  1100         if ( index >= 0 && 
       
  1101                 !iListBox.iItemDrawer->Properties( index ).IsSelectionHidden() )
       
  1102             {
       
  1103             iListBox.View()->SelectItemL( iListBox.CurrentItemIndex() );
       
  1104             }
       
  1105         }
       
  1106     _AKNTRACE_FUNC_EXIT;
       
  1107     }
       
  1108 
       
  1109 
       
  1110 // -----------------------------------------------------------------------------
       
  1111 // CListBoxExt::MarkAllL
       
  1112 // -----------------------------------------------------------------------------
       
  1113 //
       
  1114 void CListBoxExt::MarkAllL()
       
  1115     {
       
  1116     _AKNTRACE_FUNC_ENTER;
       
  1117 
       
  1118     if ( iListBox.MarkingMode() )
       
  1119         {       
       
  1120         for ( TInt i = 0; i < iListBox.Model()->NumberOfItems(); ++i )
       
  1121             {
       
  1122             if ( !iListBox.iItemDrawer->Properties( i ).IsSelectionHidden() )
       
  1123                 {
       
  1124                 iListBox.View()->SelectItemL( i );
       
  1125                 }
       
  1126             }
       
  1127         }
       
  1128     _AKNTRACE_FUNC_EXIT;
       
  1129     }
       
  1130 
       
  1131 
       
  1132 // -----------------------------------------------------------------------------
       
  1133 // CListBoxExt::UnmarkAll
       
  1134 // -----------------------------------------------------------------------------
       
  1135 //
       
  1136 void CListBoxExt::UnmarkAll()
       
  1137     {
       
  1138     _AKNTRACE_FUNC_ENTER;
       
  1139 
       
  1140     if ( iListBox.MarkingMode() )
       
  1141         {
       
  1142         iListBox.View()->ClearSelection();
       
  1143         }
       
  1144 
       
  1145     _AKNTRACE_FUNC_EXIT;
       
  1146     }
       
  1147 
       
  1148 // -----------------------------------------------------------------------------
       
  1149 // CListBoxExt::CurrentItemMarkable
       
  1150 // -----------------------------------------------------------------------------
       
  1151 //
       
  1152 TBool CListBoxExt::CurrentItemMarkable()
       
  1153     {
       
  1154     _AKNTRACE_FUNC_ENTER;
       
  1155     TBool itemCanBeMarked = ETrue;
       
  1156      TInt index = iListBox.CurrentItemIndex();
       
  1157      if ( index >= 0 && 
       
  1158              iListBox.iItemDrawer->Properties( index ).IsSelectionHidden() )
       
  1159          {
       
  1160          itemCanBeMarked = EFalse;
       
  1161          }
       
  1162     _AKNTRACE_FUNC_EXIT;
       
  1163     return itemCanBeMarked;
   960     }
  1164     }
   961 
  1165 
   962 
  1166 
   963 // ---------------------------------------------------------------------------
  1167 // ---------------------------------------------------------------------------
   964 // CListBoxExt::HandleLongTapEventL
  1168 // CListBoxExt::HandleLongTapEventL
   969     {
  1173     {
   970     _AKNTRACE_FUNC_ENTER;
  1174     _AKNTRACE_FUNC_ENTER;
   971     iLongTappedItem = iLastDownTappedItem;
  1175     iLongTappedItem = iLastDownTappedItem;
   972     iLastDownTappedItem = KErrNotFound;
  1176     iLastDownTappedItem = KErrNotFound;
   973     iItemActionMenu->ShowMenuL( aPenEventScreenLocation, 0 );
  1177     iItemActionMenu->ShowMenuL( aPenEventScreenLocation, 0 );
       
  1178     IgnorePointerEventsUntilUp();
       
  1179     iOldWinPos = iListBox.DrawableWindow()->OrdinalPosition();
   974     _AKNTRACE_FUNC_EXIT;
  1180     _AKNTRACE_FUNC_EXIT;
   975     }
  1181     }
   976 
  1182 
   977 
  1183 
   978 // -----------------------------------------------------------------------------
  1184 // -----------------------------------------------------------------------------
  1033     _AKNTRACE_FUNC_ENTER;
  1239     _AKNTRACE_FUNC_ENTER;
  1034     EnableHighlight( ETrue );
  1240     EnableHighlight( ETrue );
  1035 	
  1241 	
  1036     if ( iListBox.iView->ViewRect() != TRect() )
  1242     if ( iListBox.iView->ViewRect() != TRect() )
  1037         {
  1243         {
  1038         TInt topItemIndex = iListBox.iView->TopItemIndex();
  1244         // Set current item index highlighted if it is visible, otherwise
  1039         if ( iListBox.iView->ItemIsPartiallyVisible( topItemIndex) )
  1245         // the first visible index
  1040             {
  1246         TInt index = iListBox.iView->CurrentItemIndex(); 
  1041             topItemIndex++; 
  1247         if ( !iListBox.iView->ItemIsVisible( index ) )
  1042             }    
  1248             {
  1043         TRAP_IGNORE( iListBox.UpdateHighlightL( topItemIndex ) );
  1249             index = iListBox.iView->TopItemIndex();
       
  1250             if ( iListBox.iView->ItemIsPartiallyVisible( index ) )
       
  1251                 {
       
  1252                 index++; 
       
  1253                 }    
       
  1254             }
       
  1255         TRAP_IGNORE( iListBox.UpdateHighlightL( index ) );
  1044         }
  1256         }
  1045     
  1257     
  1046     DisableItemSpecificMenu();
  1258     DisableItemSpecificMenu();
  1047     if ( iItemActionMenu )
  1259     if ( iItemActionMenu )
  1048         {
  1260         {
  1069     iListBox.iListBoxFlags |= CEikListBox::EDisableItemSpecificMenu;
  1281     iListBox.iListBoxFlags |= CEikListBox::EDisableItemSpecificMenu;
  1070 
  1282 
  1071     _AKNTRACE_FUNC_EXIT;
  1283     _AKNTRACE_FUNC_EXIT;
  1072     }
  1284     }
  1073 
  1285 
       
  1286 
  1074 // -----------------------------------------------------------------------------
  1287 // -----------------------------------------------------------------------------
  1075 // CListBoxExt::LongTapPointerEventL
  1288 // CListBoxExt::LongTapPointerEventL
  1076 // -----------------------------------------------------------------------------
  1289 // -----------------------------------------------------------------------------
  1077 //
  1290 //
  1078 void CListBoxExt::LongTapPointerEventL( const TPointerEvent& aPointerEvent )
  1291 void CListBoxExt::LongTapPointerEventL( const TPointerEvent& aPointerEvent )
  1079     {
  1292     {
  1080     if ( iSingleClickEnabled && iLongTapDetector && iItemActionMenu  )
  1293     if ( iSingleClickEnabled && iLongTapDetector && iItemActionMenu  )
  1081         {
  1294         {
  1082         // Send event on down only if item specific items were found and current
  1295         // Send event on down only if item specific items were found. 
  1083         // item is marked if there are marked items
  1296         // Long tap is also disabled if current item is not marked while
  1084         if ( !( MarkedItems() && 
  1297         // there are some marked items or marking mode is active.
  1085                 !iListBox.View()->ItemIsSelected( iListBox.CurrentItemIndex() ) )
  1298         if ( !( ( iListBox.MarkingMode() || MarkedItems() )
  1086                 && ( aPointerEvent.iType != TPointerEvent::EButton1Down
  1299             && !iListBox.View()->ItemIsSelected( iListBox.CurrentItemIndex() ) )
  1087                 || iItemActionMenu->InitMenuL() ) )
  1300             && ( aPointerEvent.iType != TPointerEvent::EButton1Down
       
  1301             || iItemActionMenu->InitMenuL() ) ) 
  1088             {
  1302             {
  1089             iLongTapDetector->PointerEventL ( aPointerEvent );
  1303             iLongTapDetector->PointerEventL ( aPointerEvent );
  1090             }
  1304             }
  1091         }
  1305         }
  1092     }
  1306     }
  1188             && iListBox.SelectionIndexes()->Count() > 0;
  1402             && iListBox.SelectionIndexes()->Count() > 0;
  1189     }
  1403     }
  1190 
  1404 
  1191 
  1405 
  1192 // -----------------------------------------------------------------------------
  1406 // -----------------------------------------------------------------------------
       
  1407 // CListBoxExt::IgnorePointerEventsUntilUp
       
  1408 // -----------------------------------------------------------------------------
       
  1409 //
       
  1410 TBool CListBoxExt::IgnorePointerEventsUntilUp()
       
  1411     {
       
  1412     _AKNTRACE_FUNC_ENTER;
       
  1413     
       
  1414     // Pointer event ignore must be done for the window-owning
       
  1415     // control or it doesn't have any effect!
       
  1416     CCoeControl* windowOwningControl = &iListBox;
       
  1417         
       
  1418     while ( windowOwningControl && !windowOwningControl->OwnsWindow() )
       
  1419         {
       
  1420         windowOwningControl = windowOwningControl->Parent();
       
  1421         }
       
  1422 
       
  1423     if ( windowOwningControl )
       
  1424         {
       
  1425         windowOwningControl->IgnoreEventsUntilNextPointerUp();   
       
  1426         _AKNTRACE_FUNC_EXIT;
       
  1427         return ETrue;
       
  1428         }
       
  1429     _AKNTRACE_FUNC_EXIT;
       
  1430     return EFalse; 
       
  1431     }
       
  1432 
       
  1433 
       
  1434 // -----------------------------------------------------------------------------
  1193 // CListBoxExt::StartLongPressTimerL
  1435 // CListBoxExt::StartLongPressTimerL
  1194 // -----------------------------------------------------------------------------
  1436 // -----------------------------------------------------------------------------
  1195 //
  1437 //
  1196 void CListBoxExt::StartLongPressTimerL()
  1438 void CListBoxExt::StartLongPressTimerL()
  1197     {
  1439     {
  1715         }
  1957         }
  1716     _AKNTRACE_FUNC_EXIT;
  1958     _AKNTRACE_FUNC_EXIT;
  1717     }
  1959     }
  1718 
  1960 
  1719 // ---------------------------------------------------------------------------
  1961 // ---------------------------------------------------------------------------
  1720 // CListBoxExt::FeedbackEnabledOnUpEvent
  1962 // Checks whether or not tactile feedback should be given on a pointer
       
  1963 // up event.
  1721 // ---------------------------------------------------------------------------
  1964 // ---------------------------------------------------------------------------
  1722 //
  1965 //
  1723 TBool CListBoxExt::FeedbackEnabledOnUpEvent()
  1966 TBool CListBoxExt::FeedbackEnabledOnUpEvent()
  1724     {
  1967     {
  1725     _AKNTRACE_FUNC_ENTER;
  1968     _AKNTRACE_FUNC_ENTER;
  1726     TBool enabled( EFalse );
  1969     TBool enabled( EFalse );
  1727     
  1970     
       
  1971     // As there's no pressed down highlight in single click enabled lists,
       
  1972     // the iLastDownTappedItem is used to track whether or not the pointer
       
  1973     // up event happened inside the same list item as the pointer down event.
       
  1974     // Feedback should not be given if the pointer up is received outside of
       
  1975     // the item that received the pointer down event, or in cases when the
       
  1976     // list has been dragged or flicked between the pointer down and pointer
       
  1977     // up events.
  1728     if ( ( iListBox.iItemDrawer->Flags() & CListItemDrawer::EPressedDownState
  1978     if ( ( iListBox.iItemDrawer->Flags() & CListItemDrawer::EPressedDownState
  1729         || iSingleClickEnabled ) && !iFlickStopped )
  1979         || ( iSingleClickEnabled && iLastDownTappedItem != KErrNotFound ) ) &&
       
  1980         !iFlickStopped )
  1730         {
  1981         {
  1731         enabled = ETrue;
  1982         enabled = ETrue;
  1732         }
  1983         }
       
  1984 
  1733     _AKNTRACE_FUNC_EXIT;
  1985     _AKNTRACE_FUNC_EXIT;
  1734     return enabled;
  1986     return enabled;
  1735     }
  1987     }
  1736 
  1988 
  1737 // ---------------------------------------------------------------------------
  1989 // ---------------------------------------------------------------------------
  2102         	|| iListBoxExt && iListBoxExt->iPhysics 
  2354         	|| iListBoxExt && iListBoxExt->iPhysics 
  2103         	&& currentItemIndex == ( topItemIndex + numberOfItems - 1 ) )
  2355         	&& currentItemIndex == ( topItemIndex + numberOfItems - 1 ) )
  2104             {
  2356             {
  2105             if ( iListBoxExt && iListBoxExt->iSingleClickEnabled )
  2357             if ( iListBoxExt && iListBoxExt->iSingleClickEnabled )
  2106                 {
  2358                 {
  2107                 // If single click is enabled, highlight must also be visible
  2359                 TInt offset = (iListBoxExt->iWorldSize.iHeight / 2)
  2108                 if ( iListBoxExt->CollectionState()
  2360                         - iListBoxExt->iViewPosition.iY;
       
  2361                 TInt totalItems = iModel->NumberOfItems();
       
  2362                 TInt itemsInRect =
       
  2363                         iView->NumberOfItemsThatFitInRect( iView->ViewRect() );
       
  2364 
       
  2365                 if ( ( iListBoxExt->CollectionState()
  2109                         & MAknCollection::EStateHighlightVisible )
  2366                         & MAknCollection::EStateHighlightVisible )
       
  2367                       || ( ItemsInSingleLine()
       
  2368                               && ( totalItems <= itemsInRect )
       
  2369                               && ( offset != 0 ) ) )
  2110                     {
  2370                     {
  2111                     newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex );
  2371                     newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex );
  2112                     }
  2372                     }
       
  2373                 else
       
  2374                     {
       
  2375                     newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( topItemIndex );
       
  2376                     }
  2113                 }
  2377                 }
  2114             else
  2378             else
  2115                 {
  2379                 {
  2116                 newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex );
  2380                 newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex );
  2117                 }
  2381                 }
  2127             }
  2391             }
  2128 
  2392 
  2129         if ( newTopItemIndex != KEikListBoxInvalidIndex )
  2393         if ( newTopItemIndex != KEikListBoxInvalidIndex )
  2130         	{
  2394         	{
  2131         	iView->SetTopItemIndex( newTopItemIndex );
  2395         	iView->SetTopItemIndex( newTopItemIndex );
  2132         	if ( iListBoxExt && iListBoxExt->iPhysics )
  2396             }
  2133         		{
  2397         if ( iListBoxExt && iListBoxExt->iPhysics )
  2134         		iListBoxExt->InitPhysicsL();
  2398             {
  2135         		}
  2399             iListBoxExt->InitPhysicsL();
  2136             }
  2400             }
  2137         }
  2401         }
  2138     UpdateScrollBarsL();
  2402     UpdateScrollBarsL();
  2139     _AKNTRACE_FUNC_EXIT;
  2403     _AKNTRACE_FUNC_EXIT;
  2140     }
  2404     }
  2402     TBool redrawDisabled = iView->RedrawDisabled();
  2666     TBool redrawDisabled = iView->RedrawDisabled();
  2403     iView->SetDisableRedraw(ETrue);
  2667     iView->SetDisableRedraw(ETrue);
  2404     UpdateCurrentItem(aItemIndex);
  2668     UpdateCurrentItem(aItemIndex);
  2405     iView->SetDisableRedraw(redrawDisabled);
  2669     iView->SetDisableRedraw(redrawDisabled);
  2406     
  2670     
  2407     if ( iListBoxExt && iListBoxExt->iPhysics && aItemIndex == 0 )
  2671     if ( iListBoxExt && iListBoxExt->iPhysics && aItemIndex == 0 
       
  2672              && !iListBoxExt->iScrolling )
  2408         {    
  2673         {    
  2409         iView->SetItemOffsetInPixels( 0 );        
  2674         iView->SetItemOffsetInPixels( 0 );        
  2410         }
  2675         }
  2411     _AKNTRACE_FUNC_EXIT;
  2676     _AKNTRACE_FUNC_EXIT;
  2412     }
  2677     }
  3713             
  3978             
  3714                 // Markable list CR JLEO-4VQJ75
  3979                 // Markable list CR JLEO-4VQJ75
  3715                 if (!shiftKeyPressed && iListBoxFlags & EShiftEnterMarks)
  3980                 if (!shiftKeyPressed && iListBoxFlags & EShiftEnterMarks)
  3716                     { 
  3981                     { 
  3717                     // enter key pressed on markable list without shift
  3982                     // enter key pressed on markable list without shift
  3718                     if (SelectionIndexes()->Count() > 0)
  3983                     if ( SelectionIndexes()->Count() > 0 && !MarkingMode() )
  3719                         { 
  3984                         { 
  3720                         // when there's marked items, should open options menu.
  3985                         // when there's marked items, should open options menu.
  3721                         __KeyDebug(ETrue, "ok without shift => ok options menu");
  3986                         __KeyDebug(ETrue, "ok without shift => ok options menu");
  3722 
  3987 
  3723                         CEikMenuBar *bar;
  3988                         CEikMenuBar *bar;
  3958 
  4223 
  3959         if ( iListBoxExt && iListBoxExt->iPhysics
  4224         if ( iListBoxExt && iListBoxExt->iPhysics
  3960              && aEvent != MEikListBoxObserver::EEventFlickStopped )
  4225              && aEvent != MEikListBoxObserver::EEventFlickStopped )
  3961             {
  4226             {
  3962             allowed = iListBoxExt->iClickEventsAllowed;
  4227             allowed = iListBoxExt->iClickEventsAllowed;
       
  4228             }
       
  4229 
       
  4230         if ( MarkingMode() && allowed )
       
  4231             {
       
  4232             switch ( aEvent )
       
  4233                 {
       
  4234                 case MEikListBoxObserver::EEventItemSingleClicked:
       
  4235                 case MEikListBoxObserver::EEventEnterKeyPressed:
       
  4236                     {                   
       
  4237                     TInt index = CurrentItemIndex();
       
  4238                     if ( index >= 0 && 
       
  4239                          !iItemDrawer->Properties(index).IsSelectionHidden() )
       
  4240                         {
       
  4241                         iView->ToggleItemL( iView->CurrentItemIndex() );
       
  4242                         }
       
  4243                     
       
  4244                     allowed = EFalse;
       
  4245                     }
       
  4246                     break;
       
  4247                     
       
  4248                 default:
       
  4249                     break;
       
  4250                 }
  3963             }
  4251             }
  3964         
  4252         
  3965         if ( allowed )
  4253         if ( allowed )
  3966             {
  4254             {
  3967             iListBoxObserver->HandleListBoxEventL(this, aEvent);
  4255             iListBoxObserver->HandleListBoxEventL(this, aEvent);
  4690         // Return always if list empty to avoid tactile feedback
  4978         // Return always if list empty to avoid tactile feedback
  4691         _AKNTRACE_FUNC_EXIT;
  4979         _AKNTRACE_FUNC_EXIT;
  4692         return;
  4980         return;
  4693         }
  4981         }
  4694 
  4982 
  4695     
       
  4696     // When in marking mode, pointer events should not be forwarded to 
       
  4697     // long tap detector, this boolean indicates if marking mode is active
       
  4698     TBool markingMode( iListBoxExt->MarkedItems() );
       
  4699     
       
  4700     if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  4983     if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  4701         {
  4984         {
  4702         if ( iListBoxExt->iSingleClickEnabled && 
  4985         if ( iListBoxExt->iSingleClickEnabled && 
  4703              itemIndex != iView->CurrentItemIndex() )
  4986              itemIndex != iView->CurrentItemIndex() )
  4704             {
  4987             {
  4706             iView->DrawItem( iView->CurrentItemIndex() );
  4989             iView->DrawItem( iView->CurrentItemIndex() );
  4707             }
  4990             }
  4708 
  4991 
  4709         iListBoxExt->iFeedbackType = ETouchFeedbackList;
  4992         iListBoxExt->iFeedbackType = ETouchFeedbackList;
  4710         
  4993         
  4711         if ( iListBoxFlags & ES60StyleMultiselection ||
  4994         if ( !iListBoxExt->iSingleClickEnabled &&
  4712             ( !iListBoxExt->iSingleClickEnabled &&
  4995             itemIndex != iView->CurrentItemIndex() )
  4713             itemIndex != iView->CurrentItemIndex() ) )
       
  4714             {
  4996             {
  4715             iListBoxExt->iFeedbackType = ETouchFeedbackSensitiveList;
  4997             iListBoxExt->iFeedbackType = ETouchFeedbackSensitiveList;
  4716             }
  4998             }
  4717 
  4999 
  4718         if ( iListBoxExt->iPhysics &&
  5000         if ( iListBoxExt->iPhysics &&
  4853                             iListBoxExt->EnableHighlight( ETrue, ETrue );
  5135                             iListBoxExt->EnableHighlight( ETrue, ETrue );
  4854                             UpdateHighlightL( itemIndex );
  5136                             UpdateHighlightL( itemIndex );
  4855                             CCoeEnv::Static()->WsSession().Finish();
  5137                             CCoeEnv::Static()->WsSession().Finish();
  4856                             }
  5138                             }
  4857 
  5139 
  4858                         iListBoxExt->ImmediateFeedback( 
  5140                         if ( !( ( iListBoxFlags & EViewerFlag ) && 
  4859                             iListBoxExt->iFeedbackType,
  5141                                 ( iListBoxFlags & EDisableItemSpecificMenu ) ) )
  4860                             TTouchFeedbackType( ETouchFeedbackVibra | 
  5142                             {
  4861                             ETouchFeedbackAudio ),
  5143                             iListBoxExt->ImmediateFeedback( 
  4862                             aPointerEvent );
  5144                                 iListBoxExt->iFeedbackType,
       
  5145                                 TTouchFeedbackType( ETouchFeedbackVibra | 
       
  5146                                 ETouchFeedbackAudio ),
       
  5147                                 aPointerEvent );
       
  5148                             }
  4863 
  5149 
  4864                         if ( !wasFlicking )
  5150                         if ( !wasFlicking )
  4865                             {
  5151                             {
  4866                             ReportListBoxEventL( 
  5152                             ReportListBoxEventL( 
  4867                                     MEikListBoxObserver::EEventPenDownOnItem );
  5153                                     MEikListBoxObserver::EEventPenDownOnItem );
  4889                             {
  5175                             {
  4890                             transApi->SetMoveType( MAknListBoxTfxInternal::EListTap );
  5176                             transApi->SetMoveType( MAknListBoxTfxInternal::EListTap );
  4891                             }
  5177                             }
  4892                         }
  5178                         }
  4893 #endif
  5179 #endif
  4894                 if (!(iListBoxFlags & EMultipleSelection))      // i.e. this is a single selection listbox
  5180                 if ( !( iListBoxFlags & EMultipleSelection ) 
       
  5181                         || MarkingMode() )
  4895                     {
  5182                     {
  4896                     if (itemIndex == oldCurrentItemIndex)
  5183                     if (itemIndex == oldCurrentItemIndex)
  4897                         {
  5184                         {
  4898                         iItemDrawer->SetFlags( CListItemDrawer::EPressedDownState );
  5185                         iItemDrawer->SetFlags( CListItemDrawer::EPressedDownState );
  4899                         iView->DrawItem( itemIndex );
  5186                         iView->DrawItem( itemIndex );
  5035                 }
  5322                 }
  5036             break;
  5323             break;
  5037             
  5324             
  5038         case TPointerEvent::EButton1Up:
  5325         case TPointerEvent::EButton1Up:
  5039             _AKNTRACE("TPointerEvent::EButton1Up");
  5326             _AKNTRACE("TPointerEvent::EButton1Up");
  5040             if ( iListBoxExt->FeedbackEnabledOnUpEvent() && iListBoxExt->iClickEventsAllowed )
  5327             if ( iListBoxExt->FeedbackEnabledOnUpEvent() && iListBoxExt->iClickEventsAllowed 
       
  5328             	                    && ( !( ( iListBoxFlags & EViewerFlag ) && 
       
  5329                             ( iListBoxFlags & EDisableItemSpecificMenu ) ) ) )
  5041                 {
  5330                 {
  5042                 TTouchLogicalFeedback fbType = ETouchFeedbackList;
  5331                 TTouchLogicalFeedback fbType = ETouchFeedbackList;
  5043                 if ( iListBoxFlags & ES60StyleMultiselection )
  5332                 if ( iListBoxFlags & ES60StyleMultiselection 
       
  5333                       || iListBoxFlags & EMultipleSelection )
  5044                     {
  5334                     {
  5045                     fbType = ETouchFeedbackCheckbox;
  5335                     fbType = ETouchFeedbackCheckbox;
  5046                     }
  5336                     }
  5047                 iListBoxExt->ImmediateFeedback( fbType,
  5337                 iListBoxExt->ImmediateFeedback( fbType,
  5048                                                 ETouchFeedbackVibra,
  5338                                                 ETouchFeedbackVibra,
  5109                             MEikListBoxObserver::EEventItemSingleClicked );
  5399                             MEikListBoxObserver::EEventItemSingleClicked );
  5110                         _AKNTRACE_FUNC_EXIT;
  5400                         _AKNTRACE_FUNC_EXIT;
  5111                         return;
  5401                         return;
  5112                         }
  5402                         }
  5113                     }
  5403                     }
  5114                 else if ( s60StyleMultiselection && 
  5404                 // Due to the feature of capactior panel, the pointer position
  5115                           iListBoxExt->iLastDownTappedItem == itemIndex &&
  5405                 // may change between pointer down and up during user click 
  5116                           !Buffer()->iDragToAnotherItem )
  5406                 // action. When the click position is between two items, the
       
  5407                 // item index may change unwanted, so we make a threshold 
       
  5408                 // for this situation.                
       
  5409                 else if ( s60StyleMultiselection
       
  5410                          && ( iListBoxExt->iLastDownTappedItem == itemIndex
       
  5411                          || Abs( iListBoxExt->iLastPointerPos.iY 
       
  5412                          - aPointerEvent.iPosition.iY ) < KPointerDownAndUpThreshold )
       
  5413                          && !Buffer()->iDragToAnotherItem )
  5117                     {
  5414                     {
  5118                     iListBoxFlags |= EStateChanged;
  5415                     iListBoxFlags |= EStateChanged;
  5119                     Buffer()->iPressedIndex = itemIndex;
  5416                     Buffer()->iPressedIndex = itemIndex;
  5120                     iView->SetAnchor(itemIndex-1); // zero indexed
  5417                     iView->SetAnchor(itemIndex-1); // zero indexed
  5121                     iView->UpdateSelectionL(selectionMode);
  5418                     iView->UpdateSelectionL(selectionMode);
  5469     return rect;
  5766     return rect;
  5470     }
  5767     }
  5471 
  5768 
  5472 EXPORT_C TBool CEikListBox::BackgroundDrawingSuppressed() const
  5769 EXPORT_C TBool CEikListBox::BackgroundDrawingSuppressed() const
  5473     {
  5770     {
  5474     if ( iListBoxExt )
  5771     if ( iItemDrawer )
  5475         {
  5772         {
  5476         return iListBoxExt->iBackgroundDrawingSuppressed;
  5773         TInt flags = iItemDrawer->Flags();
       
  5774         
       
  5775         return ( flags & CListItemDrawer::EDrawWholeBackground ) 
       
  5776                 && ( flags & CListItemDrawer::EBackgroundDrawn );
  5477         }
  5777         }
  5478         
  5778         
  5479     return EFalse;
  5779     return EFalse;
  5480     }
  5780     }
  5481 
  5781 
  5791             }
  6091             }
  5792         iBackColor=iEikonEnv->ControlColor(IsDimmed() ? 
  6092         iBackColor=iEikonEnv->ControlColor(IsDimmed() ? 
  5793                                     EColorControlDimmedBackground : EColorControlBackground,*this);
  6093                                     EColorControlDimmedBackground : EColorControlBackground,*this);
  5794         UpdateViewColors();
  6094         UpdateViewColors();
  5795         UpdateItemDrawerColors();
  6095         UpdateItemDrawerColors();
  5796         
  6096 
       
  6097         // store the value of virtical offset as it will be 0 in SizeChange,
       
  6098         // that will affect view position in skin changed, which is a bug.
       
  6099         TInt oldOffset = 0; 
       
  6100         if ( iView )
       
  6101             {
       
  6102             oldOffset = iView->ItemOffsetInPixels();
       
  6103             }
       
  6104         // TODO: check if this call is real need here. 
  5797         SizeChanged();
  6105         SizeChanged();
       
  6106         if ( oldOffset !=0 && iView )
       
  6107             {
       
  6108             iView->SetItemOffsetInPixels( oldOffset );
       
  6109             UpdateScrollBarThumbs();
       
  6110             }
       
  6111         // this methord is empty.
  5798         UpdateScrollBarsColors();
  6112         UpdateScrollBarsColors();
  5799         
  6113         
  5800 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  6114 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  5801         if ( transApi )
  6115         if ( transApi )
  5802             {
  6116             {
  5837             DrawDeferred();
  6151             DrawDeferred();
  5838             break;
  6152             break;
  5839 
  6153 
  5840         case KAknMessageFocusLost:
  6154         case KAknMessageFocusLost:
  5841             {
  6155             {
  5842             if ( iListBoxExt && iListBoxExt->iSingleClickEnabled )
  6156             TInt oldWinPos = iListBoxExt->iOldWinPos;
       
  6157             TInt winPos = DrawableWindow()->OrdinalPosition();
       
  6158             
       
  6159             // Do not remove higlight if window ordinal position has changed
       
  6160             // during the time when stylus menu is open
       
  6161             if ( iListBoxExt && iListBoxExt->iSingleClickEnabled
       
  6162                  && ( oldWinPos == KErrNotFound || oldWinPos == winPos ) )
  5843                 {
  6163                 {
  5844                 TBool enabled( iItemDrawer && !( iItemDrawer->Flags()
  6164                 TBool enabled( iItemDrawer && !( iItemDrawer->Flags()
  5845                     & CListItemDrawer::ESingleClickDisabledHighlight ) );
  6165                     & CListItemDrawer::ESingleClickDisabledHighlight ) );
  5846                            
  6166                            
  5847                 if ( enabled )
  6167                 if ( enabled )
  6286             }
  6606             }
  6287         }
  6607         }
  6288     _AKNTRACE_FUNC_EXIT;
  6608     _AKNTRACE_FUNC_EXIT;
  6289     return enabled; 
  6609     return enabled; 
  6290     }
  6610     }
       
  6611 
       
  6612 
       
  6613 // ---------------------------------------------------------------------------
       
  6614 // CEikListBox::SetMarkingMode
       
  6615 // ---------------------------------------------------------------------------
       
  6616 //
       
  6617 EXPORT_C void CEikListBox::SetMarkingMode( TBool aEnable )
       
  6618     {
       
  6619     if ( iListBoxExt && iListBoxExt->iSingleClickEnabled && 
       
  6620             ( iListBoxFlags & CEikListBox::ES60StyleMarkable ) )
       
  6621         {
       
  6622         if ( iListBoxExt->iMarkingModeInUse != aEnable ) 
       
  6623             {
       
  6624             if ( aEnable )
       
  6625                 {
       
  6626                 iView->ItemDrawer()->SetFlags( 
       
  6627                         CListItemDrawer::EMarkingModeEnabled );
       
  6628                 }
       
  6629             else
       
  6630                 {
       
  6631                 iView->ItemDrawer()->ClearFlags( 
       
  6632                         CListItemDrawer::EMarkingModeEnabled );
       
  6633             
       
  6634                 if ( iView->SelectionIndexes()->Count() > 0 )
       
  6635                     {
       
  6636                     iView->ClearSelection( EFalse );
       
  6637                     }
       
  6638                 }
       
  6639 
       
  6640             iListBoxExt->iMarkingModeInUse = aEnable;
       
  6641             DrawDeferred();
       
  6642             }
       
  6643 
       
  6644         if ( MarkingModeObserver() )
       
  6645             {
       
  6646             MarkingModeObserver()->MarkingModeStatusChanged( aEnable );
       
  6647             }
       
  6648         }
       
  6649     }
       
  6650 
       
  6651 
       
  6652 // ---------------------------------------------------------------------------
       
  6653 // CEikListBox::SetMarkingModeObserver
       
  6654 // ---------------------------------------------------------------------------
       
  6655 //
       
  6656 EXPORT_C void CEikListBox::SetMarkingModeObserver( 
       
  6657         MAknMarkingModeObserver* aObserver )
       
  6658     {
       
  6659     if ( iListBoxExt )
       
  6660         {
       
  6661         iListBoxExt->iMarkingModeObserver = aObserver;
       
  6662         }
       
  6663     }
       
  6664 
  6291 
  6665 
  6292 void CEikListBox::ScrollView( const TInt aOffset, TBool aDrawNow )
  6666 void CEikListBox::ScrollView( const TInt aOffset, TBool aDrawNow )
  6293 	{
  6667 	{
  6294 	_AKNTRACE_FUNC_ENTER;
  6668 	_AKNTRACE_FUNC_ENTER;
  6295 #ifdef _DEBUG
  6669 #ifdef _DEBUG
  6334                                                         TTouchFeedbackType( ETouchFeedbackVibra ),
  6708                                                         TTouchFeedbackType( ETouchFeedbackVibra ),
  6335                                                         TPointerEvent() );
  6709                                                         TPointerEvent() );
  6336                         }
  6710                         }
  6337                     else if ( CAknPhysics::EAknPhysicsActionDragging == iListBoxExt->iPhysics->OngoingPhysicsAction() )
  6711                     else if ( CAknPhysics::EAknPhysicsActionDragging == iListBoxExt->iPhysics->OngoingPhysicsAction() )
  6338                         {
  6712                         {
  6339                         iListBoxExt->ImmediateFeedback( iListBoxExt->iFeedbackType,
  6713                         iListBoxExt->ImmediateFeedback( ETouchFeedbackSensitiveList,
  6340                                                         TTouchFeedbackType( ETouchFeedbackVibra | ETouchFeedbackAudio ),
  6714                                                         TTouchFeedbackType( ETouchFeedbackVibra | ETouchFeedbackAudio ),
  6341                                                         TPointerEvent() );
  6715                                                         TPointerEvent() );
  6342                         }
  6716                         }
  6343                     }
  6717                     }
  6344                 }
  6718                 }
  6363 #ifdef _DEBUG
  6737 #ifdef _DEBUG
  6364         RDebug::Print( _L( "CEikListBox::ScrollView, newTopItemIndex = %d" ), newTopItemIndex );
  6738         RDebug::Print( _L( "CEikListBox::ScrollView, newTopItemIndex = %d" ), newTopItemIndex );
  6365 #endif // _DEBUG
  6739 #endif // _DEBUG
  6366         iView->SetTopItemIndex( newTopItemIndex );
  6740         iView->SetTopItemIndex( newTopItemIndex );
  6367         }
  6741         }
       
  6742 
  6368     if ( aDrawNow )
  6743     if ( aDrawNow )
  6369         {
  6744         {
  6370         TRect rect(Rect());
  6745         TRect rect(Rect());
  6371         
  6746         
  6372         // list position changed
  6747         // list position changed
  6373         if ( iListBoxExt )
  6748         if ( iListBoxExt && iListBoxExt->FlickOrPanningOngoing() )
  6374             {
  6749             {
  6375             iListBoxExt->iBackgroundDrawingSuppressed = ETrue;
  6750             iItemDrawer->SetFlags( CListItemDrawer::EDrawWholeBackground );
  6376             }
  6751             }
       
  6752 
  6377         UpdateScrollBarThumbs();
  6753         UpdateScrollBarThumbs();
  6378         DrawNow();
  6754         DrawNow();
       
  6755 
  6379         if (iSBFrame && iSBFrame->VerticalScrollBar() && !iSBFrame->VerticalScrollBar()->OwnsWindow())
  6756         if (iSBFrame && iSBFrame->VerticalScrollBar() && !iSBFrame->VerticalScrollBar()->OwnsWindow())
  6380             {
  6757             {
  6381             TRect srect( iSBFrame->VerticalScrollBar()->Rect() );
  6758             TRect srect( iSBFrame->VerticalScrollBar()->Rect() );
  6382             if ( !srect.Intersects( rect ))
  6759             if ( !srect.Intersects( rect ))
  6383                 {
  6760                 {
  6384                 iSBFrame->DrawScrollBarsNow();                
  6761                 iSBFrame->DrawScrollBarsNow();                
  6385                 }
  6762                 }
  6386             }
  6763             }
       
  6764 
  6387         if ( iListBoxExt )
  6765         if ( iListBoxExt )
  6388             {
  6766             {
  6389             iListBoxExt->iBackgroundDrawingSuppressed = EFalse;
  6767             iItemDrawer->ClearFlags( CListItemDrawer::EDrawWholeBackground 
       
  6768                     | CListItemDrawer::EBackgroundDrawn );
  6390             }
  6769             }
  6391         }        
  6770         }        
  6392     _AKNTRACE_FUNC_EXIT;
  6771     _AKNTRACE_FUNC_EXIT;
  6393 	}
  6772 	}
  6394 
  6773 
  6400 TBool CEikListBox::HandlePhysicsPointerEventL( const TPointerEvent& aPointerEvent )
  6779 TBool CEikListBox::HandlePhysicsPointerEventL( const TPointerEvent& aPointerEvent )
  6401     {
  6780     {
  6402     _AKNTRACE_FUNC_ENTER;
  6781     _AKNTRACE_FUNC_ENTER;
  6403     _AKNTRACE( "aPointerEvent.iType = %d", aPointerEvent.iType );
  6782     _AKNTRACE( "aPointerEvent.iType = %d", aPointerEvent.iType );
  6404     if ( iListBoxExt->iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionBouncing )
  6783     if ( iListBoxExt->iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionBouncing )
  6405         { 
  6784         {  
  6406         // Block scrolling events outside listbox area. Note that pointer
  6785         // Block scrolling events outside listbox area.
  6407         // event ignore must be done for the window-owning control or it
  6786         if ( iListBoxExt->IgnorePointerEventsUntilUp() )
  6408         // doesn't have any effect!
  6787             {
  6409         CCoeControl* windowOwningControl = this;
       
  6410         
       
  6411         while ( windowOwningControl && !windowOwningControl->OwnsWindow() )
       
  6412             {
       
  6413             windowOwningControl = windowOwningControl->Parent();
       
  6414             }
       
  6415 
       
  6416         if ( windowOwningControl )
       
  6417             {
       
  6418             windowOwningControl->IgnoreEventsUntilNextPointerUp();
       
  6419             _AKNTRACE_FUNC_EXIT;
  6788             _AKNTRACE_FUNC_EXIT;
  6420             return ETrue;
  6789             return ETrue;
  6421             }
  6790             }
  6422         }
  6791         }
  6423 
  6792 
  6454                         {
  6823                         {
  6455                         iListBoxExt->iLastDownTappedItem = tappedItemIndex;
  6824                         iListBoxExt->iLastDownTappedItem = tappedItemIndex;
  6456                         iListBoxExt->iMarkingDisabled = ETrue;
  6825                         iListBoxExt->iMarkingDisabled = ETrue;
  6457                         iListBoxFlags|=ELeftDownInViewRect;                        
  6826                         iListBoxFlags|=ELeftDownInViewRect;                        
  6458                         blockEvent = ETrue;
  6827                         blockEvent = ETrue;
       
  6828                         iListBoxExt->ImmediateFeedback( 
       
  6829                             ETouchFeedbackList,
       
  6830                             TTouchFeedbackType( ETouchFeedbackVibra | 
       
  6831                             ETouchFeedbackAudio ),
       
  6832                             aPointerEvent );
  6459                         }
  6833                         }
  6460                     }
  6834                     }
  6461                 }
  6835                 }
  6462             else
  6836             else
  6463                 {
  6837                 {
  6730     _AKNTRACE_FUNC_EXIT;
  7104     _AKNTRACE_FUNC_EXIT;
  6731     }
  7105     }
  6732 
  7106 
  6733 
  7107 
  6734 // ---------------------------------------------------------------------------
  7108 // ---------------------------------------------------------------------------
       
  7109 // CEikListBox::MarkingMode
       
  7110 // ---------------------------------------------------------------------------
       
  7111 //
       
  7112 TBool CEikListBox::MarkingMode() const
       
  7113     {
       
  7114     TBool markingModeInUse = EFalse;
       
  7115     
       
  7116     if ( iListBoxExt )
       
  7117         {
       
  7118         markingModeInUse = iListBoxExt->iMarkingModeInUse;
       
  7119         }
       
  7120     
       
  7121     return markingModeInUse;
       
  7122     }
       
  7123 
       
  7124 
       
  7125 // ---------------------------------------------------------------------------
       
  7126 // CEikListBox::MarkingModeObserver
       
  7127 // ---------------------------------------------------------------------------
       
  7128 //
       
  7129 MAknMarkingModeObserver* CEikListBox::MarkingModeObserver()
       
  7130     {
       
  7131     MAknMarkingModeObserver* observer = NULL;
       
  7132     
       
  7133     if ( iListBoxExt )
       
  7134         {
       
  7135         observer = iListBoxExt->iMarkingModeObserver;
       
  7136         }
       
  7137     
       
  7138     return observer;
       
  7139     }
       
  7140 
       
  7141 
       
  7142 // ---------------------------------------------------------------------------
  6735 // Sets this control as visible or invisible.
  7143 // Sets this control as visible or invisible.
  6736 // ---------------------------------------------------------------------------
  7144 // ---------------------------------------------------------------------------
  6737 //
  7145 //
  6738 EXPORT_C void CEikListBox::MakeVisible( TBool aVisible )
  7146 EXPORT_C void CEikListBox::MakeVisible( TBool aVisible )
  6739     {
  7147     {