uifw/EikStd/coctlsrc/EIKLBX.CPP
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
child 59 978afdc0236f
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
     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.
   475      * Sets the highlight for the first item visible after single click 
   523      * Sets the highlight for the first item visible after single click 
   476      * is disabled
   524      * is disabled
   477      */
   525      */
   478     void DisableSingleClick();
   526     void DisableSingleClick();
   479 
   527 
       
   528     /**
       
   529      * Enables single click
       
   530      */
       
   531     void EnableSingleClickL();    
       
   532     
   480     /**
   533     /**
   481      * Disables item specific menu.
   534      * Disables item specific menu.
   482      */
   535      */
   483     void DisableItemSpecificMenu();
   536     void DisableItemSpecificMenu();
   484 
   537 
   510      * Returns ETrue if list has currently marked items.
   563      * Returns ETrue if list has currently marked items.
   511      * 
   564      * 
   512      * @return ETrue if list has marked items.
   565      * @return ETrue if list has marked items.
   513      */
   566      */
   514     TBool MarkedItems() const;
   567     TBool MarkedItems() const;
       
   568     
       
   569     /**
       
   570      * Ignores pointer events until next up event. 
       
   571      * 
       
   572      * @return ETrue if the pointer event ignore was enabled.
       
   573      */
       
   574     TBool IgnorePointerEventsUntilUp();
   515 
   575 
   516 public:
   576 public:
   517     void InitPhysicsL();
   577     void InitPhysicsL();
   518 	
   578 	
   519     /**
   579     /**
   616     TInt iInterval;
   676     TInt iInterval;
   617     CPeriodic* iHighlightTimer;    
   677     CPeriodic* iHighlightTimer;    
   618     CAknPhysics *iPhysics;
   678     CAknPhysics *iPhysics;
   619     TPoint iDragStartPosition;
   679     TPoint iDragStartPosition;
   620     TPoint iLastPointerPos;
   680     TPoint iLastPointerPos;
   621     TBool iBackgroundDrawingSuppressed;
       
   622     TBool iClickEventsAllowed;
   681     TBool iClickEventsAllowed;
   623     TBool iScrolling;
   682     TBool iScrolling;
   624     TSize iViewSize;
   683     TSize iViewSize;
   625     TSize iWorldSize;
   684     TSize iWorldSize;
   626     TBool iItemDraggingReported;
   685     TBool iItemDraggingReported;
   680 
   739 
   681    /**
   740    /**
   682     * Item that opened the item action menu
   741     * Item that opened the item action menu
   683     */
   742     */
   684     TInt iLongTappedItem;
   743     TInt iLongTappedItem;
       
   744 
       
   745     /**
       
   746      * Marking mode on / off.
       
   747      */
       
   748     TBool iMarkingModeInUse;
       
   749     
       
   750     /**
       
   751      * Marking mode observer.
       
   752      */
       
   753     MAknMarkingModeObserver* iMarkingModeObserver;
       
   754     
   685     /**
   755     /**
   686      * Pointer event to be forwarded to the long tap detector upon
   756      * Pointer event to be forwarded to the long tap detector upon
   687      * highlight timer completion.
   757      * highlight timer completion.
   688      */
   758      */
   689     TPointerEvent iDelayedPointerDownEvent;
   759     TPointerEvent iDelayedPointerDownEvent;
       
   760     
       
   761     /**
       
   762      * Ordinal position of listbox window, before stylus menu is opened.
       
   763      */
       
   764     TInt iOldWinPos;
       
   765 
       
   766     /**
       
   767      * If double click modifier is set on PointerEvent, the event may be ignored
       
   768      * in some situation(To prevent extra dialog launched by AO).
       
   769      */
       
   770     TBool iDoubleClickEventIgnored;
   690     
   771     
   691 private:
   772 private:
   692     CMatchBuffer* iBuffer;
   773     CMatchBuffer* iBuffer;
   693     CEikListBox& iListBox;
   774     CEikListBox& iListBox;
   694     CEikListBox::TReasonForFocusLost iReasonForFocusLost;
   775     CEikListBox::TReasonForFocusLost iReasonForFocusLost;
   718     TBool iPanningOngoing;
   799     TBool iPanningOngoing;
   719 
   800 
   720     /**
   801     /**
   721      * Height of the list in pixels.
   802      * Height of the list in pixels.
   722      */    
   803      */    
   723     TInt iListBottomLimit;
   804     TInt iListBottomLimit;    
   724     };
   805     };
   725     
   806     
   726 // CEikListBoxExt    
   807 // CEikListBoxExt    
   727 
   808 
   728 CListBoxExt* CListBoxExt::NewL( CEikListBox& aListBox )
   809 CListBoxExt* CListBoxExt::NewL( CEikListBox& aListBox )
   749       iLastItemIndex(-1),
   830       iLastItemIndex(-1),
   750       iItemActionMenu( NULL ),
   831       iItemActionMenu( NULL ),
   751       iLongTapDetector( NULL ),
   832       iLongTapDetector( NULL ),
   752       iSingleClickEnabled( iAvkonAppUi->IsSingleClickCompatible() ),
   833       iSingleClickEnabled( iAvkonAppUi->IsSingleClickCompatible() ),
   753       iLongTappedItem( KErrNotFound ),
   834       iLongTappedItem( KErrNotFound ),
   754       iListBox(aListBox)      
   835       iOldWinPos( KErrNotFound ),
       
   836       iListBox(aListBox)
   755     {
   837     {
   756     }
   838     }
   757 
   839 
   758 CListBoxExt::~CListBoxExt()
   840 CListBoxExt::~CListBoxExt()
   759     {
   841     {
   850         iHighlightTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   932         iHighlightTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   851         }
   933         }
   852     iItemsInSingleLine = 1;
   934     iItemsInSingleLine = 1;
   853     iFeedback = MTouchFeedback::Instance();
   935     iFeedback = MTouchFeedback::Instance();
   854 
   936 
   855     iItemActionMenu = CAknItemActionMenu::RegisterCollectionL( *this );
   937     iItemActionMenu = CAknItemActionMenu::RegisterCollectionL( *this, &iListBox );
   856 
   938 
   857     if ( !( iListBox.iListBoxFlags & CEikListBox::EDisableItemSpecificMenu )
   939     if ( !( iListBox.iListBoxFlags & CEikListBox::EDisableItemSpecificMenu )
   858             && iItemActionMenu )
   940             && iItemActionMenu )
   859         {
   941         {
   860         iLongTapDetector = CAknLongTapDetector::NewL( this );
   942         iLongTapDetector = CAknLongTapDetector::NewL( this );
   927         }
  1009         }
   928     if ( iListBox.iListBoxFlags & CEikListBox::EMultipleSelection )
  1010     if ( iListBox.iListBoxFlags & CEikListBox::EMultipleSelection )
   929         {
  1011         {
   930         state |= MAknCollection::EStateMultipleSelection;
  1012         state |= MAknCollection::EStateMultipleSelection;
   931         }
  1013         }
       
  1014     if ( MarkedItems() )
       
  1015         {
       
  1016         state |= MAknCollection::EStateMarkedItems; 
       
  1017         }
   932     _AKNTRACE_FUNC_EXIT;
  1018     _AKNTRACE_FUNC_EXIT;
   933     return state;
  1019     return state;
   934     }
  1020     }
   935 
  1021 
   936 
  1022 
   943     if ( iLongTappedItem != KErrNotFound )
  1029     if ( iLongTappedItem != KErrNotFound )
   944         {
  1030         {
   945         EnableHighlight( EFalse );
  1031         EnableHighlight( EFalse );
   946         iListBox.iView->DrawItem( iLongTappedItem );
  1032         iListBox.iView->DrawItem( iLongTappedItem );
   947         iLongTappedItem = KErrNotFound;
  1033         iLongTappedItem = KErrNotFound;
       
  1034         iOldWinPos = KErrNotFound;
   948         }
  1035         }
   949     }
  1036     }
   950 
  1037 
   951 
  1038 
   952 // -----------------------------------------------------------------------------
  1039 // -----------------------------------------------------------------------------
   953 // CListBoxExt::CollectionExtension
  1040 // CListBoxExt::CollectionExtension
   954 // -----------------------------------------------------------------------------
  1041 // -----------------------------------------------------------------------------
   955 //
  1042 //
   956 TInt CListBoxExt::CollectionExtension(
  1043 TInt CListBoxExt::CollectionExtension(
   957         TUint /*aExtensionId*/, TAny*& /*a0*/, TAny* /*a1*/ )
  1044         TUint aExtensionId, TAny*& a0, TAny* /*a1*/ )
   958     {
  1045     {
   959     return KErrNone;
  1046     if ( aExtensionId == MAknMarkingCollection::TYPE )
       
  1047         {
       
  1048         a0 = static_cast<MAknMarkingCollection*>( this );
       
  1049         return KErrNone;
       
  1050         }
       
  1051 
       
  1052     return KErrNotFound;
       
  1053     }
       
  1054 
       
  1055 
       
  1056 // -----------------------------------------------------------------------------
       
  1057 // CListBoxExt::SetMultipleMarkingState
       
  1058 // -----------------------------------------------------------------------------
       
  1059 //
       
  1060 void CListBoxExt::SetMultipleMarkingState( TBool aActive )
       
  1061     {
       
  1062     _AKNTRACE_FUNC_ENTER;
       
  1063     iListBox.SetMarkingMode( aActive );
       
  1064     _AKNTRACE_FUNC_EXIT;
       
  1065     }
       
  1066 
       
  1067 // -----------------------------------------------------------------------------
       
  1068 // CListBoxExt::ExitMarkingMode
       
  1069 // -----------------------------------------------------------------------------
       
  1070 //
       
  1071 TBool CListBoxExt::ExitMarkingMode()
       
  1072     {
       
  1073     if ( iListBox.MarkingModeObserver() )
       
  1074         {
       
  1075         return iListBox.MarkingModeObserver()->ExitMarkingMode();
       
  1076         }
       
  1077     return ETrue;
       
  1078     }
       
  1079 
       
  1080 // -----------------------------------------------------------------------------
       
  1081 // CListBoxExt::MarkingState
       
  1082 // -----------------------------------------------------------------------------
       
  1083 //
       
  1084 TUint CListBoxExt::MarkingState() const
       
  1085     {
       
  1086     _AKNTRACE_FUNC_ENTER;
       
  1087     TUint state( 0 );
       
  1088     if ( iListBox.MarkingMode() )
       
  1089         {
       
  1090         state |= MAknMarkingCollection::EStateMarkingMode;
       
  1091         if ( MarkedItems() )
       
  1092             {
       
  1093             state |= MAknMarkingCollection::EStateMarkedItems;
       
  1094             }
       
  1095         if ( iListBox.Model()->NumberOfItems() == 0 )
       
  1096             {
       
  1097             state |= MAknMarkingCollection::EStateCollectionEmpty;
       
  1098             }        
       
  1099         }
       
  1100     _AKNTRACE_FUNC_EXIT;
       
  1101     return state;
       
  1102     }
       
  1103 
       
  1104 
       
  1105 // -----------------------------------------------------------------------------
       
  1106 // CListBoxExt::MarkCurrentItemL
       
  1107 // -----------------------------------------------------------------------------
       
  1108 //
       
  1109 void CListBoxExt::MarkCurrentItemL()
       
  1110     {
       
  1111     _AKNTRACE_FUNC_ENTER;
       
  1112 
       
  1113     if ( iListBox.MarkingMode() )
       
  1114         {
       
  1115         TInt index = iListBox.CurrentItemIndex();
       
  1116         if ( index >= 0 && 
       
  1117                 !iListBox.iItemDrawer->Properties( index ).IsSelectionHidden() )
       
  1118             {
       
  1119             iListBox.View()->SelectItemL( index );
       
  1120             }
       
  1121         }
       
  1122     _AKNTRACE_FUNC_EXIT;
       
  1123     }
       
  1124 
       
  1125 
       
  1126 // -----------------------------------------------------------------------------
       
  1127 // CListBoxExt::MarkAllL
       
  1128 // -----------------------------------------------------------------------------
       
  1129 //
       
  1130 void CListBoxExt::MarkAllL()
       
  1131     {
       
  1132     _AKNTRACE_FUNC_ENTER;
       
  1133     
       
  1134     if ( iListBox.MarkingMode() && 
       
  1135             iListBox.Model()->NumberOfItems() > 0 )
       
  1136         {               
       
  1137         iListBox.View()->SelectAllL( ETrue );   
       
  1138         }
       
  1139     _AKNTRACE_FUNC_EXIT;
       
  1140     }
       
  1141 
       
  1142 
       
  1143 // -----------------------------------------------------------------------------
       
  1144 // CListBoxExt::UnmarkAll
       
  1145 // -----------------------------------------------------------------------------
       
  1146 //
       
  1147 void CListBoxExt::UnmarkAll()
       
  1148     {
       
  1149     _AKNTRACE_FUNC_ENTER;
       
  1150 
       
  1151     if ( iListBox.MarkingMode() )
       
  1152         {
       
  1153         iListBox.View()->ClearSelection();
       
  1154         }
       
  1155 
       
  1156     _AKNTRACE_FUNC_EXIT;
       
  1157     }
       
  1158 
       
  1159 // -----------------------------------------------------------------------------
       
  1160 // CListBoxExt::CurrentItemMarkable
       
  1161 // -----------------------------------------------------------------------------
       
  1162 //
       
  1163 TBool CListBoxExt::CurrentItemMarkable()
       
  1164     {
       
  1165     _AKNTRACE_FUNC_ENTER;
       
  1166     TBool itemCanBeMarked = ETrue;
       
  1167      TInt index = iListBox.CurrentItemIndex();
       
  1168      if ( index >= 0 && 
       
  1169              iListBox.iItemDrawer->Properties( index ).IsSelectionHidden() )
       
  1170          {
       
  1171          itemCanBeMarked = EFalse;
       
  1172          }
       
  1173     _AKNTRACE_FUNC_EXIT;
       
  1174     return itemCanBeMarked;
   960     }
  1175     }
   961 
  1176 
   962 
  1177 
   963 // ---------------------------------------------------------------------------
  1178 // ---------------------------------------------------------------------------
   964 // CListBoxExt::HandleLongTapEventL
  1179 // CListBoxExt::HandleLongTapEventL
   969     {
  1184     {
   970     _AKNTRACE_FUNC_ENTER;
  1185     _AKNTRACE_FUNC_ENTER;
   971     iLongTappedItem = iLastDownTappedItem;
  1186     iLongTappedItem = iLastDownTappedItem;
   972     iLastDownTappedItem = KErrNotFound;
  1187     iLastDownTappedItem = KErrNotFound;
   973     iItemActionMenu->ShowMenuL( aPenEventScreenLocation, 0 );
  1188     iItemActionMenu->ShowMenuL( aPenEventScreenLocation, 0 );
       
  1189     iOldWinPos = iListBox.DrawableWindow()->OrdinalPosition();
   974     _AKNTRACE_FUNC_EXIT;
  1190     _AKNTRACE_FUNC_EXIT;
   975     }
  1191     }
   976 
  1192 
   977 
  1193 
   978 // -----------------------------------------------------------------------------
  1194 // -----------------------------------------------------------------------------
  1033     _AKNTRACE_FUNC_ENTER;
  1249     _AKNTRACE_FUNC_ENTER;
  1034     EnableHighlight( ETrue );
  1250     EnableHighlight( ETrue );
  1035 	
  1251 	
  1036     if ( iListBox.iView->ViewRect() != TRect() )
  1252     if ( iListBox.iView->ViewRect() != TRect() )
  1037         {
  1253         {
  1038         TInt topItemIndex = iListBox.iView->TopItemIndex();
  1254         // Set current item index highlighted if it is visible, otherwise
  1039         if ( iListBox.iView->ItemIsPartiallyVisible( topItemIndex) )
  1255         // the first visible index
  1040             {
  1256         TInt index = iListBox.iView->CurrentItemIndex(); 
  1041             topItemIndex++; 
  1257         if ( !iListBox.iView->ItemIsVisible( index ) )
  1042             }    
  1258             {
  1043         TRAP_IGNORE( iListBox.UpdateHighlightL( topItemIndex ) );
  1259             index = iListBox.iView->TopItemIndex();
       
  1260             if ( iListBox.iView->ItemIsPartiallyVisible( index ) )
       
  1261                 {
       
  1262                 index++; 
       
  1263                 }    
       
  1264             }
       
  1265         TRAP_IGNORE( iListBox.UpdateHighlightL( index ) );
  1044         }
  1266         }
  1045     
  1267     
  1046     DisableItemSpecificMenu();
  1268     DisableItemSpecificMenu();
  1047     if ( iItemActionMenu )
  1269     if ( iItemActionMenu )
  1048         {
  1270         {
  1052     iSingleClickEnabled = EFalse;
  1274     iSingleClickEnabled = EFalse;
  1053 
  1275 
  1054     _AKNTRACE_FUNC_EXIT;
  1276     _AKNTRACE_FUNC_EXIT;
  1055     }
  1277     }
  1056 
  1278 
       
  1279 // -----------------------------------------------------------------------------
       
  1280 // CListBoxExt::EnableSingleClickL
       
  1281 // -----------------------------------------------------------------------------
       
  1282 //
       
  1283 void CListBoxExt::EnableSingleClickL()
       
  1284     {
       
  1285     _AKNTRACE_FUNC_ENTER;
       
  1286     if ( !iLongTapDetector )
       
  1287         {
       
  1288         iLongTapDetector = CAknLongTapDetector::NewL( this );
       
  1289         }
       
  1290     if ( !iItemActionMenu )
       
  1291         {
       
  1292         iItemActionMenu = CAknItemActionMenu::RegisterCollectionL( 
       
  1293             *this, &iListBox );
       
  1294         iListBox.iListBoxFlags &= ( ~CEikListBox::EDisableItemSpecificMenu );
       
  1295         }    
       
  1296     iSingleClickEnabled = ETrue;
       
  1297     EnableHighlight( EFalse );
       
  1298     // iListBox.UpdateHighlightL( iListBox.iView->CurrentItemIndex() );
       
  1299     _AKNTRACE_FUNC_EXIT;
       
  1300     }
  1057 
  1301 
  1058 // -----------------------------------------------------------------------------
  1302 // -----------------------------------------------------------------------------
  1059 // CListBoxExt::DisableItemSpecificMenu
  1303 // CListBoxExt::DisableItemSpecificMenu
  1060 // -----------------------------------------------------------------------------
  1304 // -----------------------------------------------------------------------------
  1061 //
  1305 //
  1069     iListBox.iListBoxFlags |= CEikListBox::EDisableItemSpecificMenu;
  1313     iListBox.iListBoxFlags |= CEikListBox::EDisableItemSpecificMenu;
  1070 
  1314 
  1071     _AKNTRACE_FUNC_EXIT;
  1315     _AKNTRACE_FUNC_EXIT;
  1072     }
  1316     }
  1073 
  1317 
       
  1318 
  1074 // -----------------------------------------------------------------------------
  1319 // -----------------------------------------------------------------------------
  1075 // CListBoxExt::LongTapPointerEventL
  1320 // CListBoxExt::LongTapPointerEventL
  1076 // -----------------------------------------------------------------------------
  1321 // -----------------------------------------------------------------------------
  1077 //
  1322 //
  1078 void CListBoxExt::LongTapPointerEventL( const TPointerEvent& aPointerEvent )
  1323 void CListBoxExt::LongTapPointerEventL( const TPointerEvent& aPointerEvent )
  1079     {
  1324     {
  1080     if ( iSingleClickEnabled && iLongTapDetector && iItemActionMenu  )
  1325     if ( iSingleClickEnabled && iLongTapDetector && iItemActionMenu  )
  1081         {
  1326         {
  1082         // Send event on down only if no marked items and item specific items
  1327         // Send event on down only if item specific items were found. 
  1083         // were found
  1328         // Long tap is also disabled if current item is not marked while
  1084         if ( aPointerEvent.iType != TPointerEvent::EButton1Down
  1329         // there are some marked items or marking mode is active.
  1085                 || ( !MarkedItems() && iItemActionMenu->InitMenuL() ) )
  1330         if ( ( !( ( iListBox.MarkingMode() || MarkedItems() )
       
  1331             && !iListBox.View()->ItemIsSelected( iListBox.CurrentItemIndex() ) )
       
  1332             || ( iListBox.iListBoxFlags & CEikListBox::EItemSpecificMenuAlwaysShown ) )
       
  1333             && ( aPointerEvent.iType != TPointerEvent::EButton1Down
       
  1334             || iItemActionMenu->InitMenuL() ) ) 
  1086             {
  1335             {
  1087             iLongTapDetector->PointerEventL ( aPointerEvent );
  1336             iLongTapDetector->PointerEventL ( aPointerEvent );
  1088             }
  1337             }
  1089         }
  1338         }
  1090     }
  1339     }
  1181 //
  1430 //
  1182 TBool CListBoxExt::MarkedItems() const
  1431 TBool CListBoxExt::MarkedItems() const
  1183     {
  1432     {
  1184     return ( iListBox.iListBoxFlags & CEikListBox::ES60StyleMarkable
  1433     return ( iListBox.iListBoxFlags & CEikListBox::ES60StyleMarkable
  1185             || iListBox.iListBoxFlags & CEikListBox::EMultipleSelection )
  1434             || iListBox.iListBoxFlags & CEikListBox::EMultipleSelection )
  1186             && iListBox.SelectionIndexes()->Count() > 0;
  1435             && iListBox.iView && iListBox.SelectionIndexes()->Count() > 0;
       
  1436     }
       
  1437 
       
  1438 
       
  1439 // -----------------------------------------------------------------------------
       
  1440 // CListBoxExt::IgnorePointerEventsUntilUp
       
  1441 // -----------------------------------------------------------------------------
       
  1442 //
       
  1443 TBool CListBoxExt::IgnorePointerEventsUntilUp()
       
  1444     {
       
  1445     _AKNTRACE_FUNC_ENTER;
       
  1446     
       
  1447     // Pointer event ignore must be done for the window-owning
       
  1448     // control or it doesn't have any effect!
       
  1449     CCoeControl* windowOwningControl = &iListBox;
       
  1450         
       
  1451     while ( windowOwningControl && !windowOwningControl->OwnsWindow() )
       
  1452         {
       
  1453         windowOwningControl = windowOwningControl->Parent();
       
  1454         }
       
  1455 
       
  1456     if ( windowOwningControl )
       
  1457         {
       
  1458         windowOwningControl->IgnoreEventsUntilNextPointerUp();   
       
  1459         }
       
  1460     _AKNTRACE_FUNC_EXIT;
       
  1461     return ( windowOwningControl != NULL );
  1187     }
  1462     }
  1188 
  1463 
  1189 
  1464 
  1190 // -----------------------------------------------------------------------------
  1465 // -----------------------------------------------------------------------------
  1191 // CListBoxExt::StartLongPressTimerL
  1466 // CListBoxExt::StartLongPressTimerL
  1557 void CListBoxExt::PhysicEmulationEnded()
  1832 void CListBoxExt::PhysicEmulationEnded()
  1558     {
  1833     {
  1559     _AKNTRACE_FUNC_ENTER;    
  1834     _AKNTRACE_FUNC_ENTER;    
  1560     if ( iScrolling )
  1835     if ( iScrolling )
  1561         {
  1836         {
       
  1837         // currently, this is the only way to fix ou1cimx1#375869
       
  1838         // iViewPosision is changed but we can't provent that
       
  1839         if ( iListBox.iView->TopItemIndex() == 0 
       
  1840              && iListBox.iView->ItemOffsetInPixels() > 0 )
       
  1841             {
       
  1842             iListBox.ScrollView( -iListBox.iView->ItemOffsetInPixels(), ETrue );
       
  1843             }        
  1562 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1844 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1563         iListBox.SuspendEffects( EFalse );
  1845         iListBox.SuspendEffects( EFalse );
  1564 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  1846 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  1565         TRAP_IGNORE( iListBox.ReportListBoxEventL(
  1847         TRAP_IGNORE( iListBox.ReportListBoxEventL(
  1566                          MEikListBoxObserver::EEventFlickStopped ) );
  1848                          MEikListBoxObserver::EEventFlickStopped ) );
  1583         {
  1865         {
  1584         // calculate view center based on CEikListBoxView::iTopItemIndex
  1866         // calculate view center based on CEikListBoxView::iTopItemIndex
  1585         TInt topItemIndex = iListBox.iView->TopItemIndex();
  1867         TInt topItemIndex = iListBox.iView->TopItemIndex();
  1586         TInt itemHeight = iListBox.iView->ItemHeight();
  1868         TInt itemHeight = iListBox.iView->ItemHeight();
  1587         TInt numberOfItems = iListBox.iModel->NumberOfItems();
  1869         TInt numberOfItems = iListBox.iModel->NumberOfItems();
  1588 
  1870         TInt emptySpaceOffset ( 0 );
       
  1871         
  1589         TSize viewSize( iListBox.iView->ViewRect().Size() );
  1872         TSize viewSize( iListBox.iView->ViewRect().Size() );
  1590         TSize worldSize( viewSize.iWidth, itemHeight * numberOfItems );
  1873         TSize worldSize( viewSize.iWidth, itemHeight * numberOfItems );
  1591         
  1874         
  1592         // grid has several items in one line
  1875         // grid has several items in one line
  1593         if ( iItemsInSingleLine > 1 )
  1876         if ( iItemsInSingleLine > 1 )
  1598             // handle non-full grid row
  1881             // handle non-full grid row
  1599             if ( numberOfItems % iItemsInSingleLine )
  1882             if ( numberOfItems % iItemsInSingleLine )
  1600                 {
  1883                 {
  1601                 worldSize.iHeight += itemHeight;
  1884                 worldSize.iHeight += itemHeight;
  1602                 }
  1885                 }
       
  1886             
       
  1887             // Check empty space below the grid
       
  1888             if ( topItemIndex != 0 )
       
  1889                 {
       
  1890                 TInt lastItemBottomY = 
       
  1891                         iListBox.iView->ItemPos( 
       
  1892                                 numberOfItems - 1 ).iY + itemHeight +1;
       
  1893                 emptySpaceOffset = Min( 0, lastItemBottomY - viewSize.iHeight );
       
  1894                 }
  1603             }
  1895             }
  1604             
  1896             
  1605         // Reset offset if view's size has changed - this is needed if e.g.
  1897         // Reset offset if view's size has changed - this is needed if e.g.
  1606         // HandleResourceChange is overridden by a derived implementation.
  1898         // HandleResourceChange is overridden by a derived implementation.
  1607         if ( viewSize != iViewSize && iViewSize != TSize( 0, 0 ) )
  1899         if ( viewSize != iViewSize && iViewSize != TSize( 0, 0 ) )
  1608             {
  1900             {
  1609             iListBox.iView->SetItemOffsetInPixels( 0 );
  1901             iListBox.iView->SetItemOffsetInPixels( 0 );
  1610             }
  1902             }
  1611 
  1903 
  1612         TPoint viewCenter( viewSize.iWidth / 2, ( topItemIndex / iItemsInSingleLine ) * itemHeight - iListBox.iView->ItemOffsetInPixels() + ( viewSize.iHeight / 2 ) );
  1904         TPoint viewCenter( viewSize.iWidth / 2, ( topItemIndex / iItemsInSingleLine ) * itemHeight - iListBox.iView->ItemOffsetInPixels() + ( viewSize.iHeight / 2 ) );
       
  1905         viewCenter.iY += emptySpaceOffset;
  1613 
  1906 
  1614         // Make sure that world's size is always at least view size.
  1907         // Make sure that world's size is always at least view size.
  1615         worldSize.iHeight = Max( worldSize.iHeight, viewSize.iHeight );
  1908         worldSize.iHeight = Max( worldSize.iHeight, viewSize.iHeight );
  1616 
  1909 
  1617         iPhysics->InitPhysicsL( worldSize, viewSize, EFalse );
  1910         iPhysics->InitPhysicsL( worldSize, viewSize, EFalse );
  1713         }
  2006         }
  1714     _AKNTRACE_FUNC_EXIT;
  2007     _AKNTRACE_FUNC_EXIT;
  1715     }
  2008     }
  1716 
  2009 
  1717 // ---------------------------------------------------------------------------
  2010 // ---------------------------------------------------------------------------
  1718 // CListBoxExt::FeedbackEnabledOnUpEvent
  2011 // Checks whether or not tactile feedback should be given on a pointer
       
  2012 // up event.
  1719 // ---------------------------------------------------------------------------
  2013 // ---------------------------------------------------------------------------
  1720 //
  2014 //
  1721 TBool CListBoxExt::FeedbackEnabledOnUpEvent()
  2015 TBool CListBoxExt::FeedbackEnabledOnUpEvent()
  1722     {
  2016     {
  1723     _AKNTRACE_FUNC_ENTER;
  2017     _AKNTRACE_FUNC_ENTER;
  1724     TBool enabled( EFalse );
  2018     TBool enabled( EFalse );
  1725     if ( ( iListBox.iItemDrawer->Flags() & CListItemDrawer::EPressedDownState ) &&
  2019     
  1726          !iFlickStopped )
  2020     // As there's no pressed down highlight in single click enabled lists,
       
  2021     // the iLastDownTappedItem is used to track whether or not the pointer
       
  2022     // up event happened inside the same list item as the pointer down event.
       
  2023     // Feedback should not be given if the pointer up is received outside of
       
  2024     // the item that received the pointer down event, or in cases when the
       
  2025     // list has been dragged or flicked between the pointer down and pointer
       
  2026     // up events.
       
  2027     if ( ( iListBox.iItemDrawer->Flags() & CListItemDrawer::EPressedDownState
       
  2028         || ( iSingleClickEnabled && iLastDownTappedItem != KErrNotFound ) ) &&
       
  2029         !iFlickStopped )
  1727         {
  2030         {
  1728         enabled = ETrue;
  2031         enabled = ETrue;
  1729         }
  2032         }
       
  2033 
  1730     _AKNTRACE_FUNC_EXIT;
  2034     _AKNTRACE_FUNC_EXIT;
  1731     return enabled;
  2035     return enabled;
  1732     }
  2036     }
  1733 
  2037 
  1734 // ---------------------------------------------------------------------------
  2038 // ---------------------------------------------------------------------------
  1808         {
  2112         {
  1809         iListBoxExt->iItemsInSingleLine = aItems;
  2113         iListBoxExt->iItemsInSingleLine = aItems;
  1810         }
  2114         }
  1811     }
  2115     }
  1812 
  2116 
       
  2117 
       
  2118 // -----------------------------------------------------------------------------
       
  2119 // CEikListBox::ItemsInSingleLine
       
  2120 // -----------------------------------------------------------------------------
       
  2121 //
       
  2122 EXPORT_C TInt CEikListBox::ItemsInSingleLine() const
       
  2123     {
       
  2124     if ( iListBoxExt )
       
  2125         {
       
  2126         return iListBoxExt->iItemsInSingleLine;
       
  2127         }
       
  2128     
       
  2129     return 1;
       
  2130     }
       
  2131 
       
  2132     
  1813 EXPORT_C void CEikListBox::UpdateViewColors()
  2133 EXPORT_C void CEikListBox::UpdateViewColors()
  1814     {
  2134     {
  1815     _AKNTRACE_FUNC_ENTER;
  2135     _AKNTRACE_FUNC_ENTER;
  1816     if(!iView)
  2136     if(!iView)
  1817         {
  2137         {
  2069     {
  2389     {
  2070     _AKNTRACE_FUNC_ENTER;
  2390     _AKNTRACE_FUNC_ENTER;
  2071     iView->CalcBottomItemIndex();
  2391     iView->CalcBottomItemIndex();
  2072     iView->CalcDataWidth();
  2392     iView->CalcDataWidth();
  2073     TInt currentItemIndex = iView->CurrentItemIndex();
  2393     TInt currentItemIndex = iView->CurrentItemIndex();
  2074 
  2394     TInt totalItems = iModel->NumberOfItems();
       
  2395     
  2075     if ( ItemExists(currentItemIndex) )
  2396     if ( ItemExists(currentItemIndex) )
  2076         {
  2397         {
  2077         TInt topItemIndex( iView->TopItemIndex() );
  2398         TInt topItemIndex( iView->TopItemIndex() );
  2078         TInt numberOfItems = iView->NumberOfItemsThatFitInRect( iView->ViewRect() );    
  2399         TInt numberOfItems = iView->NumberOfItemsThatFitInRect( iView->ViewRect() );    
  2079         TInt newTopItemIndex( KEikListBoxInvalidIndex ); 
  2400         TInt newTopItemIndex( KEikListBoxInvalidIndex ); 
  2081         // Current item not visible or current item is the last item (not fully visible)
  2402         // Current item not visible or current item is the last item (not fully visible)
  2082         if ( !iView->ItemIsVisible(currentItemIndex)
  2403         if ( !iView->ItemIsVisible(currentItemIndex)
  2083         	|| iListBoxExt && iListBoxExt->iPhysics 
  2404         	|| iListBoxExt && iListBoxExt->iPhysics 
  2084         	&& currentItemIndex == ( topItemIndex + numberOfItems - 1 ) )
  2405         	&& currentItemIndex == ( topItemIndex + numberOfItems - 1 ) )
  2085             {
  2406             {
  2086             newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex );
  2407             if ( iListBoxExt && iListBoxExt->iSingleClickEnabled )
       
  2408                 {
       
  2409                 TInt offset = (iListBoxExt->iWorldSize.iHeight / 2)
       
  2410                         - iListBoxExt->iViewPosition.iY;
       
  2411                 TInt itemsInRect =
       
  2412                         iView->NumberOfItemsThatFitInRect( iView->ViewRect() );
       
  2413 
       
  2414                 if ( ( iListBoxExt->CollectionState()
       
  2415                         & MAknCollection::EStateHighlightVisible )
       
  2416                       || ( ItemsInSingleLine()
       
  2417                               && ( totalItems <= itemsInRect )
       
  2418                               && ( offset != 0 ) ) )
       
  2419                     {
       
  2420                     newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex );
       
  2421                     }
       
  2422                 else
       
  2423                     {
       
  2424                     newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( topItemIndex );
       
  2425                     }
       
  2426                 }
       
  2427             else
       
  2428                 {
       
  2429                 newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex );
       
  2430                 }
  2087             }
  2431             }
  2088         else
  2432         else
  2089             {
  2433             {
  2090             // recalculates top index of list when mode be changed
  2434             // recalculates top index of list when mode be changed            
  2091             TInt totalItems = iModel->NumberOfItems();
       
  2092             if ( (totalItems - topItemIndex) < numberOfItems )
  2435             if ( (totalItems - topItemIndex) < numberOfItems )
  2093                 {
  2436                 {
  2094                 newTopItemIndex = Max( 0, totalItems - numberOfItems );
  2437                 newTopItemIndex = Max( 0, totalItems - numberOfItems );
  2095                 }
  2438                 }
  2096             }
  2439             }
  2097 
  2440 
  2098         if ( newTopItemIndex != KEikListBoxInvalidIndex )
  2441         if ( newTopItemIndex > KEikListBoxInvalidIndex 
       
  2442              && newTopItemIndex < totalItems )
  2099         	{
  2443         	{
  2100         	iView->SetTopItemIndex( newTopItemIndex );
  2444         	iView->SetTopItemIndex( newTopItemIndex );
  2101         	if ( iListBoxExt && iListBoxExt->iPhysics )
  2445             }
  2102         		{
  2446         if ( iListBoxExt && iListBoxExt->iPhysics )
  2103         		iListBoxExt->InitPhysicsL();
  2447             {
  2104         		}
  2448             iListBoxExt->InitPhysicsL();
  2105             }
  2449             }
  2106         }
  2450         }
  2107     UpdateScrollBarsL();
  2451     UpdateScrollBarsL();
  2108     _AKNTRACE_FUNC_EXIT;
  2452     _AKNTRACE_FUNC_EXIT;
  2109     }
  2453     }
  2371     TBool redrawDisabled = iView->RedrawDisabled();
  2715     TBool redrawDisabled = iView->RedrawDisabled();
  2372     iView->SetDisableRedraw(ETrue);
  2716     iView->SetDisableRedraw(ETrue);
  2373     UpdateCurrentItem(aItemIndex);
  2717     UpdateCurrentItem(aItemIndex);
  2374     iView->SetDisableRedraw(redrawDisabled);
  2718     iView->SetDisableRedraw(redrawDisabled);
  2375     
  2719     
  2376     if ( iListBoxExt && iListBoxExt->iPhysics && aItemIndex == 0 )
  2720     if ( iListBoxExt && iListBoxExt->iPhysics && aItemIndex == 0 
  2377         {
  2721              && !iListBoxExt->iScrolling )
       
  2722         {    
  2378         iView->SetItemOffsetInPixels( 0 );        
  2723         iView->SetItemOffsetInPixels( 0 );        
  2379         }
  2724         }
  2380     _AKNTRACE_FUNC_EXIT;
  2725     _AKNTRACE_FUNC_EXIT;
  2381     }
  2726     }
  2382 
  2727 
  2425     CreateViewL();
  2770     CreateViewL();
  2426     
  2771     
  2427     if(iItemDrawer && (iItemDrawer->MinimumCellSize().iHeight != 0))
  2772     if(iItemDrawer && (iItemDrawer->MinimumCellSize().iHeight != 0))
  2428         iItemHeight = iItemDrawer->MinimumCellSize().iHeight;
  2773         iItemHeight = iItemDrawer->MinimumCellSize().iHeight;
  2429 
  2774 
       
  2775     CheckCreateExtensionL();
       
  2776     
  2430     if ( iListBoxExt->iLongTapDetector
  2777     if ( iListBoxExt->iLongTapDetector
  2431             && iListBoxFlags & EDisableItemSpecificMenu )
  2778             && iListBoxFlags & EDisableItemSpecificMenu )
  2432         {
  2779         {
  2433         delete iListBoxExt->iLongTapDetector;
  2780         delete iListBoxExt->iLongTapDetector;
  2434         iListBoxExt->iLongTapDetector = NULL;
  2781         iListBoxExt->iLongTapDetector = NULL;
  2852         RestoreClientRectFromViewRect(clientRect);
  3199         RestoreClientRectFromViewRect(clientRect);
  2853         TRect inclusiveRect=Rect();
  3200         TRect inclusiveRect=Rect();
  2854         TEikScrollBarFrameLayout layout;
  3201         TEikScrollBarFrameLayout layout;
  2855         CreateScrollBarFrameLayout(layout);
  3202         CreateScrollBarFrameLayout(layout);
  2856         TBool sizeChanged=iSBFrame->TileL(&hSbarModel, &vSbarModel, clientRect, inclusiveRect, layout);
  3203         TBool sizeChanged=iSBFrame->TileL(&hSbarModel, &vSbarModel, clientRect, inclusiveRect, layout);
  2857         if (iListBoxExt->UpdateScrollBarsColors())
  3204         if ( iListBoxExt && iListBoxExt->UpdateScrollBarsColors() )
  2858             UpdateScrollBarsColors();
  3205             UpdateScrollBarsColors();
  2859         if (!sizeChanged)
  3206         if (!sizeChanged)
  2860             return;
  3207             return;
  2861         // else size of client/inclusive rect has changed
  3208         // else size of client/inclusive rect has changed
  2862         if (layout.iTilingMode==TEikScrollBarFrameLayout::EClientRectConstant)
  3209         if (layout.iTilingMode==TEikScrollBarFrameLayout::EClientRectConstant)
  2979          && iItemDrawer->Properties(index).IsSelectionHidden() )
  3326          && iItemDrawer->Properties(index).IsSelectionHidden() )
  2980         {
  3327         {
  2981         _AKNTRACE_FUNC_EXIT;
  3328         _AKNTRACE_FUNC_EXIT;
  2982         return;
  3329         return;
  2983         }
  3330         }
  2984     if( !iListBoxExt )
  3331     
  2985         {
       
  2986         _AKNTRACE_FUNC_EXIT;
       
  2987         return;
       
  2988         }
       
  2989     CEikButtonGroupContainer *bgc;
  3332     CEikButtonGroupContainer *bgc;
  2990     CCoeControl* MSK( NULL );
  3333     CCoeControl* MSK( NULL );
  2991     CEikCba* cba( NULL );
  3334     CEikCba* cba( NULL );
  2992     CONST_CAST( CEikListBox*,this )->MopGetObject( bgc );
  3335     CONST_CAST( CEikListBox*,this )->MopGetObject( bgc );
  2993     if ( !bgc )
  3336     if ( !bgc )
  3021         TRAPD( err, bgc->AddCommandToStackL( 3, newResourceId ) );
  3364         TRAPD( err, bgc->AddCommandToStackL( 3, newResourceId ) );
  3022         // in case of error, don't inform observers
  3365         // in case of error, don't inform observers
  3023         // marking still works even MSK isn't changed
  3366         // marking still works even MSK isn't changed
  3024         if ( err )
  3367         if ( err )
  3025             {
  3368             {
  3026             iListBoxExt->iSelectionModeEnabled = EFalse;
  3369             if ( iListBoxExt )
       
  3370                 {
       
  3371                 iListBoxExt->iSelectionModeEnabled = EFalse;
       
  3372                 }
  3027             _AKNTRACE_FUNC_EXIT;
  3373             _AKNTRACE_FUNC_EXIT;
  3028             return;
  3374             return;
  3029             }
  3375             }
  3030         cba->DrawNow();
  3376         cba->DrawNow();
  3031         iListBoxExt->iSelectionModeEnabled = ETrue;
  3377         if ( iListBoxExt )
       
  3378             {
       
  3379             iListBoxExt->iSelectionModeEnabled = ETrue;
       
  3380             }
  3032         }
  3381         }
  3033 
  3382 
  3034     // remove stacked MSK
  3383     // remove stacked MSK
  3035     if( !aEnable && iListBoxExt->iSelectionModeEnabled )
  3384     if( !aEnable && iListBoxExt && iListBoxExt->iSelectionModeEnabled )
  3036         {
  3385         {
  3037         if( ( MSK && cba->ControlId( MSK ) == EAknSoftkeyMark ) ||
  3386         if( ( MSK && cba->ControlId( MSK ) == EAknSoftkeyMark ) ||
  3038             ( MSK && cba->ControlId( MSK ) == EAknSoftkeyUnmark ) )
  3387             ( MSK && cba->ControlId( MSK ) == EAknSoftkeyUnmark ) )
  3039             {
  3388             {
  3040             bgc->RemoveCommandFromStack( 3, cba->ControlId( MSK ) );
  3389             bgc->RemoveCommandFromStack( 3, cba->ControlId( MSK ) );
  3041             }
  3390             }
  3042         iListBoxExt->iSelectionModeEnabled = EFalse; // just in case
  3391         iListBoxExt->iSelectionModeEnabled = EFalse; // just in case
  3043         }
  3392         }
  3044         
  3393     if ( iListBoxExt )
  3045     TInt count = iListBoxExt->iSelectionObservers.Count();
  3394         {
  3046     for ( int i=0; i < count; i++ )
  3395         TInt count = iListBoxExt->iSelectionObservers.Count();
  3047         {
  3396         for ( int i=0; i < count; i++ )
  3048         iListBoxExt->iSelectionObservers[i]->SelectionModeChanged( this, aEnable );
  3397             {
       
  3398             iListBoxExt->iSelectionObservers[i]->SelectionModeChanged( this, aEnable );
       
  3399             }
  3049         }
  3400         }
  3050     _AKNTRACE_FUNC_EXIT;
  3401     _AKNTRACE_FUNC_EXIT;
  3051     }
  3402     }
  3052 
  3403 
  3053 
  3404 
  3062     iView->CalcBottomItemIndex();
  3413     iView->CalcBottomItemIndex();
  3063     UpdateScrollBarsL();
  3414     UpdateScrollBarsL();
  3064     UpdateScrollBarThumbs();
  3415     UpdateScrollBarThumbs();
  3065     iView->ClearFlags(CListBoxView::EItemCountModified);
  3416     iView->ClearFlags(CListBoxView::EItemCountModified);
  3066 
  3417 
       
  3418 
       
  3419     if ( iListBoxExt->iItemActionMenu &&
       
  3420          iListBoxExt->iLongTappedItem != KErrNotFound )
       
  3421         {
       
  3422         // Item action menu is being shown and it needs to be closed when
       
  3423         // items are added or removed to the list array, otherwise the
       
  3424         // item specific commands may be targeted to the wrong item. 
       
  3425         iListBoxExt->iItemActionMenu->HideMenu();
       
  3426         }
       
  3427 
  3067     FireItemChange();
  3428     FireItemChange();
  3068     
  3429     
  3069     if ( iListBoxExt && iListBoxExt->iPhysics )
  3430     if ( iListBoxExt && iListBoxExt->iPhysics )
  3070         {
  3431         {
  3071         iListBoxExt->InitPhysicsL();
  3432         iListBoxExt->InitPhysicsL();
  3143     }
  3504     }
  3144 
  3505 
  3145 EXPORT_C void CEikListBox::HandleItemAdditionL()
  3506 EXPORT_C void CEikListBox::HandleItemAdditionL()
  3146     {
  3507     {
  3147     _AKNTRACE_FUNC_ENTER;
  3508     _AKNTRACE_FUNC_ENTER;
  3148      //fix the bug EGGO-7SQA4S and EVSG-7TD9WZ 
  3509     __ASSERT_DEBUG( iView, Panic( EEikPanicListBoxNoView ) );
       
  3510 
  3149     TInt curItemIndex = iView->CurrentItemIndex();
  3511     TInt curItemIndex = iView->CurrentItemIndex();
  3150     if(curItemIndex >= 0 && curItemIndex < iModel->NumberOfItems() )
  3512     if(curItemIndex >= 0 && curItemIndex < iModel->NumberOfItems() )
  3151       {
  3513       {
  3152       TInt newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( curItemIndex );
  3514       TInt newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( curItemIndex );
  3153       iView->SetTopItemIndex( newTopItemIndex );
  3515       iView->SetTopItemIndex( newTopItemIndex );
  3154       }
  3516       }
  3155     iView->SetFlags(CListBoxView::EItemCountModified);
  3517     iView->SetFlags(CListBoxView::EItemCountModified);
  3156     // following breaks lists in square layout, not needed in SERIES60?
  3518 
  3157     //iView->CalcDataWidth();
       
  3158     iView->CalcBottomItemIndex();
  3519     iView->CalcBottomItemIndex();
  3159     UpdateScrollBarsL();
  3520     UpdateScrollBarsL();
  3160     UpdateScrollBarThumbs();
  3521     UpdateScrollBarThumbs();
  3161     if (IsReadyToDraw()) DrawDeferred();
  3522     if (IsReadyToDraw()) DrawDeferred();
  3162     iView->ClearFlags(CListBoxView::EItemCountModified);
  3523     iView->ClearFlags(CListBoxView::EItemCountModified);
  3163 
  3524 
  3164     FireItemChange();
  3525     FireItemChange();
  3165     
  3526     
  3166     if ( iListBoxExt )
  3527     if ( iListBoxExt )
  3167         {    
  3528         {
  3168         iListBoxExt->CheckScrollBarVisibility();
  3529         iListBoxExt->CheckScrollBarVisibility();
  3169         // Physics engine world size needs to be updated here, otherwise aknphysics 
  3530         // Physics engine world size needs to be updated here, otherwise aknphysics 
  3170         // cone observer may block pointer events on new items. this can happen 
  3531         // cone observer may block pointer events on new items. this can happen 
  3171         // when item addition inserts new row to taskswapper's grid and reuses list in Common Dialog
  3532         // when item addition inserts new row to taskswapper's grid and reuses list in Common Dialog
  3172         if ( iListBoxExt->iPhysics )
  3533         if ( iListBoxExt->iPhysics )
  3173             {
  3534             {
  3174             iListBoxExt->InitPhysicsL();
  3535             iListBoxExt->InitPhysicsL();
  3175             }
  3536             }
  3176         }     
  3537         
       
  3538         if ( iListBoxExt->iItemActionMenu &&
       
  3539              iListBoxExt->iLongTappedItem != KErrNotFound )
       
  3540             {
       
  3541             // Item action menu is being shown and it needs to be closed when
       
  3542             // items are added or removed to the list array, otherwise the
       
  3543             // item specific commands may be targeted to the wrong item. 
       
  3544             iListBoxExt->iItemActionMenu->HideMenu();
       
  3545             }
       
  3546         }
       
  3547 
  3177     _AKNTRACE_FUNC_EXIT;
  3548     _AKNTRACE_FUNC_EXIT;
  3178     }
  3549     }
  3179 
  3550 
  3180 EXPORT_C void CEikListBox::HandleItemRemovalL()
  3551 EXPORT_C void CEikListBox::HandleItemRemovalL()
  3181     {
  3552     {
  3352             }
  3723             }
  3353         else
  3724         else
  3354             {
  3725             {
  3355             selectionMode = CListBoxView::ENoSelection;
  3726             selectionMode = CListBoxView::ENoSelection;
  3356             UpdateMarkUnmarkMSKL();
  3727             UpdateMarkUnmarkMSKL();
  3357             if (IsSelectionMarkKeys(code, aKeyEvent.iScanCode, iListBoxExt->iWesternVariant)) 
  3728             if ( iListBoxExt 
       
  3729                  && IsSelectionMarkKeys( code, aKeyEvent.iScanCode, iListBoxExt->iWesternVariant ) ) 
  3358                 {
  3730                 {
  3359                 __KeyDebug(ETrue, "SelectionMarkKey")
  3731                 __KeyDebug(ETrue, "SelectionMarkKey")
  3360                 View()->ClearSelectionAnchorAndActiveIndex();
  3732                 View()->ClearSelectionAnchorAndActiveIndex();
  3361                 }
  3733                 }
  3362             }
  3734             }
  3363         }
  3735         }
  3364 
  3736 
  3365 
  3737 
  3366     // CAknGrid marking is implemeted in avkon.dll. But we still need to disable short
  3738     // CAknGrid marking is implemeted in avkon.dll. But we still need to disable short
  3367     // hash mark in here.
  3739     // hash mark in here.
  3368     if ( iListBoxFlags & EMultipleSelection && 
  3740     if ( iListBoxExt && iListBoxFlags & EMultipleSelection && 
  3369          iListBoxFlags & EShiftEnterMarks && aType == EEventKeyUp )
  3741          iListBoxFlags & EShiftEnterMarks && aType == EEventKeyUp )
  3370         {
  3742         {
  3371         if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ||
  3743         if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ||
  3372              aKeyEvent.iScanCode == EStdKeyUpArrow ||
  3744              aKeyEvent.iScanCode == EStdKeyUpArrow ||
  3373              aKeyEvent.iScanCode == EStdKeyRightArrow ||
  3745              aKeyEvent.iScanCode == EStdKeyRightArrow ||
  3575                     _AKNTRACE_FUNC_EXIT;
  3947                     _AKNTRACE_FUNC_EXIT;
  3576                     return( EKeyWasConsumed );
  3948                     return( EKeyWasConsumed );
  3577                     }
  3949                     }
  3578                 }
  3950                 }
  3579 		
  3951 		
  3580             if ( ScrollingDisabled() || ( !iListBoxExt->MovePhysicsCursorL( moveto, selectionMode ) ) )
  3952             if ( ScrollingDisabled() 
       
  3953                 || ( iListBoxExt && !iListBoxExt->MovePhysicsCursorL( moveto, selectionMode ) ) )
  3581                 {
  3954                 {
  3582                 iView->MoveCursorL(moveto, selectionMode);
  3955                 iView->MoveCursorL(moveto, selectionMode);
  3583                 }
  3956                 }
  3584             ClearMatchBuffer();
  3957             ClearMatchBuffer();
  3585             if( iListBoxFlags & EMultipleSelection )
  3958             if( iListBoxFlags & EMultipleSelection )
  3624                     _AKNTRACE_FUNC_EXIT;
  3997                     _AKNTRACE_FUNC_EXIT;
  3625                     return(EKeyWasConsumed);    
  3998                     return(EKeyWasConsumed);    
  3626                     }
  3999                     }
  3627                 }
  4000                 }
  3628 
  4001 
  3629             if ( ScrollingDisabled() || ( !iListBoxExt->MovePhysicsCursorL( moveto, selectionMode ) ) )
  4002             if ( ScrollingDisabled() 
       
  4003                 || ( iListBoxExt && !iListBoxExt->MovePhysicsCursorL( moveto, selectionMode ) ) )
  3630                 {
  4004                 {
  3631                 iView->MoveCursorL(moveto, selectionMode);
  4005                 iView->MoveCursorL(moveto, selectionMode);
  3632                 }
  4006                 }
  3633             ClearMatchBuffer();
  4007             ClearMatchBuffer();
  3634             if (iListBoxFlags & EMultipleSelection)
  4008             if (iListBoxFlags & EMultipleSelection)
  3666             
  4040             
  3667                 // Markable list CR JLEO-4VQJ75
  4041                 // Markable list CR JLEO-4VQJ75
  3668                 if (!shiftKeyPressed && iListBoxFlags & EShiftEnterMarks)
  4042                 if (!shiftKeyPressed && iListBoxFlags & EShiftEnterMarks)
  3669                     { 
  4043                     { 
  3670                     // enter key pressed on markable list without shift
  4044                     // enter key pressed on markable list without shift
  3671                     if (SelectionIndexes()->Count() > 0)
  4045                     if ( SelectionIndexes()->Count() > 0 && !MarkingMode() )
  3672                         { 
  4046                         { 
  3673                         // when there's marked items, should open options menu.
  4047                         // when there's marked items, should open options menu.
  3674                         __KeyDebug(ETrue, "ok without shift => ok options menu");
  4048                         __KeyDebug(ETrue, "ok without shift => ok options menu");
  3675 
  4049 
  3676                         CEikMenuBar *bar;
  4050                         CEikMenuBar *bar;
  3709     //
  4083     //
  3710     // Switch/case ends here
  4084     // Switch/case ends here
  3711     //
  4085     //
  3712     if(switchMSK)
  4086     if(switchMSK)
  3713         {
  4087         {
  3714         if( selectionMode == CListBoxView::EDisjointMarkSelection )
  4088         if( iListBoxExt && selectionMode == CListBoxView::EDisjointMarkSelection )
  3715             {
  4089             {
  3716              // if hash and either up or down pressed -> no short marking
  4090              // if hash and either up or down pressed -> no short marking
  3717             iListBoxExt->iShortHashMark = EFalse;
  4091             iListBoxExt->iShortHashMark = EFalse;
  3718             }
  4092             }
  3719         UpdateMarkUnmarkMSKL();
  4093         UpdateMarkUnmarkMSKL();
  3768     // This code block watches for hash key presses, and simulates shift + ok 
  4142     // This code block watches for hash key presses, and simulates shift + ok 
  3769     // if short hash key presses are used for selections. The events are simulated 
  4143     // if short hash key presses are used for selections. The events are simulated 
  3770     // only if a markable list is active, otherwise the simulated event might open 
  4144     // only if a markable list is active, otherwise the simulated event might open 
  3771     // the selected item, which we don't want.    
  4145     // the selected item, which we don't want.    
  3772     if((iListBoxFlags & EMultipleSelection) && (iListBoxFlags & EShiftEnterMarks) &&
  4146     if((iListBoxFlags & EMultipleSelection) && (iListBoxFlags & EShiftEnterMarks) &&
  3773         iListBoxExt->iWesternVariant &&
  4147         iListBoxExt && iListBoxExt->iWesternVariant &&
  3774         iListBoxExt->iAknFepHashKeySelection && 
  4148         iListBoxExt->iAknFepHashKeySelection && 
  3775         iListBoxExt->iQwertyMode == EFalse && 
  4149         iListBoxExt->iQwertyMode == EFalse && 
  3776         aType == EEventKeyUp && aKeyEvent.iScanCode == EStdKeyHash &&
  4150         aType == EEventKeyUp && aKeyEvent.iScanCode == EStdKeyHash &&
  3777         IsFocused() )
  4151         IsFocused() )
  3778         {
  4152         {
  3869     switch ( aEvent )
  4243     switch ( aEvent )
  3870         {
  4244         {
  3871         case MEikListBoxObserver::EEventFlickStarted:
  4245         case MEikListBoxObserver::EEventFlickStarted:
  3872         case MEikListBoxObserver::EEventPanningStarted:
  4246         case MEikListBoxObserver::EEventPanningStarted:
  3873             {
  4247             {
       
  4248             if ( iListBoxExt && ( iListBoxExt->iWorldSize.iHeight 
       
  4249                     <= iListBoxExt->iViewSize.iHeight ) )
       
  4250                 {
       
  4251                 return; 
       
  4252                 }
  3874             iItemDrawer->SetFlags( CListItemDrawer::EDisableMarquee );
  4253             iItemDrawer->SetFlags( CListItemDrawer::EDisableMarquee );
  3875             if ( aEvent == MEikListBoxObserver::EEventFlickStarted )
  4254             if ( iListBoxExt )
  3876                 iListBoxExt->SetFlickOngoing( ETrue );
  4255                 { 
  3877             else            
  4256                 if ( aEvent == MEikListBoxObserver::EEventFlickStarted )
  3878                 iListBoxExt->SetPanningOngoing( ETrue );
  4257                     {
       
  4258                     iListBoxExt->SetFlickOngoing( ETrue );
       
  4259                     }
       
  4260                 else 
       
  4261                     {
       
  4262                     iListBoxExt->SetPanningOngoing( ETrue );
       
  4263                     }
       
  4264                 }
  3879             break;
  4265             break;
  3880             }
  4266             }
  3881             
  4267             
  3882         case MEikListBoxObserver::EEventFlickStopped:
  4268         case MEikListBoxObserver::EEventFlickStopped:
  3883         case MEikListBoxObserver::EEventPanningStopped:
  4269         case MEikListBoxObserver::EEventPanningStopped:
  3884             {
  4270             {
       
  4271             if ( iListBoxExt && ( iListBoxExt->iWorldSize.iHeight 
       
  4272                     <= iListBoxExt->iViewSize.iHeight ) )
       
  4273                 {
       
  4274                 return; 
       
  4275                 }
  3885             iItemDrawer->ClearFlags( CListItemDrawer::EDisableMarquee );
  4276             iItemDrawer->ClearFlags( CListItemDrawer::EDisableMarquee );
  3886             if ( aEvent == MEikListBoxObserver::EEventFlickStopped )
  4277             if ( iListBoxExt )
  3887                 {
  4278                 { 
  3888                 iListBoxExt->SetFlickOngoing( EFalse );
  4279                 if ( aEvent == MEikListBoxObserver::EEventFlickStopped )
  3889                 }
  4280                     {   
  3890             else 
  4281                     iListBoxExt->SetFlickOngoing( EFalse );                    
  3891                 {
  4282                     }
  3892                 iListBoxExt->SetPanningOngoing( EFalse );
  4283                 else 
  3893                 }
  4284                     {
  3894             
  4285                     iListBoxExt->SetPanningOngoing( EFalse );
       
  4286                     }
       
  4287                 }            
  3895             break;
  4288             break;
  3896             }
  4289             }
  3897         }
  4290         }
  3898     
  4291     
  3899     if ( iListBoxObserver )
  4292     if ( iListBoxObserver )
  3900         {
  4293         {
  3901         TBool allowed = ETrue;
  4294         TBool allowed = ETrue;
  3902 
  4295 
  3903         if ( iListBoxExt && iListBoxExt->iPhysics
  4296         if ( iListBoxExt && iListBoxExt->iPhysics
  3904              && aEvent != MEikListBoxObserver::EEventFlickStopped )
  4297              && aEvent != MEikListBoxObserver::EEventFlickStopped 
       
  4298              && aEvent != MEikListBoxObserver::EEventFlickStarted )
  3905             {
  4299             {
  3906             allowed = iListBoxExt->iClickEventsAllowed;
  4300             allowed = iListBoxExt->iClickEventsAllowed;
       
  4301             }
       
  4302 
       
  4303         if ( MarkingMode() && allowed )
       
  4304             {
       
  4305             switch ( aEvent )
       
  4306                 {
       
  4307                 case MEikListBoxObserver::EEventItemSingleClicked:
       
  4308                 case MEikListBoxObserver::EEventEnterKeyPressed:
       
  4309                     {                   
       
  4310                     TInt index = CurrentItemIndex();
       
  4311                     if ( index >= 0 && 
       
  4312                          !iItemDrawer->Properties(index).IsSelectionHidden() )
       
  4313                         {
       
  4314                         iView->ToggleItemL( iView->CurrentItemIndex() );
       
  4315                         }
       
  4316                     
       
  4317                     allowed = EFalse;
       
  4318                     }
       
  4319                     break;
       
  4320                     
       
  4321                 default:
       
  4322                     break;
       
  4323                 }
  3907             }
  4324             }
  3908         
  4325         
  3909         if ( allowed )
  4326         if ( allowed )
  3910             {
  4327             {
  3911             iListBoxObserver->HandleListBoxEventL(this, aEvent);
  4328             iListBoxObserver->HandleListBoxEventL(this, aEvent);
  3938 // ---------------------------------------------------------------------------
  4355 // ---------------------------------------------------------------------------
  3939 //
  4356 //
  3940 EXPORT_C void CEikListBox::HandlePhysicsScrollEventL( TInt aDeltaPixels )
  4357 EXPORT_C void CEikListBox::HandlePhysicsScrollEventL( TInt aDeltaPixels )
  3941     {    
  4358     {    
  3942     _AKNTRACE_FUNC_ENTER;
  4359     _AKNTRACE_FUNC_ENTER;
  3943     if ( iListBoxExt->iPhysics )
  4360     if ( iListBoxExt && iListBoxExt->iPhysics )
  3944         {
  4361         {
  3945         iListBoxExt->InitPhysicsL();
  4362         iListBoxExt->InitPhysicsL();
  3946         
  4363         
  3947         TPoint newPosition( iListBoxExt->iViewPosition.iX,
  4364         TPoint newPosition( iListBoxExt->iViewPosition.iX,
  3948                             aDeltaPixels + iListBoxExt->iViewPosition.iY );
  4365                             aDeltaPixels + iListBoxExt->iViewPosition.iY );
  3953 
  4370 
  3954 
  4371 
  3955 EXPORT_C void CEikListBox::HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType)
  4372 EXPORT_C void CEikListBox::HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType)
  3956     {
  4373     {
  3957     _AKNTRACE_FUNC_ENTER;
  4374     _AKNTRACE_FUNC_ENTER;
  3958     if ( iListBoxExt->iSingleClickEnabled )
  4375     if ( iListBoxExt && iListBoxExt->iSingleClickEnabled )
  3959         {
  4376         {
  3960         iListBoxExt->EnableHighlight( EFalse );
  4377         iListBoxExt->EnableHighlight( EFalse );
  3961         iView->DrawItem( iView->CurrentItemIndex() );
  4378         iView->DrawItem( iView->CurrentItemIndex() );
  3962         }
  4379         }
  3963 
  4380 
  4096                                        MAknListBoxTfxInternal::EListScrollUp :
  4513                                        MAknListBoxTfxInternal::EListScrollUp :
  4097                                        MAknListBoxTfxInternal::EListScrollDown );
  4514                                        MAknListBoxTfxInternal::EListScrollDown );
  4098                 }
  4515                 }
  4099 #endif
  4516 #endif
  4100             
  4517             
  4101         if ( iListBoxExt->iPhysics )
  4518         if ( iListBoxExt && iListBoxExt->iPhysics )
  4102             {
  4519             {
  4103             iListBoxExt->InitPhysicsL();
  4520             iListBoxExt->InitPhysicsL();
  4104             TInt deltaPixels = newThumbPos;
  4521             TInt deltaPixels = newThumbPos;
  4105     
  4522     
  4106 #ifdef _DEBUG
  4523 #ifdef _DEBUG
  4107             RDebug::Print( _L( "CListBox::HandleScrollEventL, deltaPixels = %d" ), deltaPixels );
  4524                 RDebug::Print( _L( "CListBox::HandleScrollEventL, deltaPixels = %d" ), deltaPixels );
  4108 #endif // _DEBUG
  4525 #endif // _DEBUG
  4109             
  4526             
  4110             TPoint newPosition( iListBoxExt->iViewPosition.iX, deltaPixels + iView->ViewRect().Height() / 2 );
  4527             TPoint newPosition( iListBoxExt->iViewPosition.iX, deltaPixels + iView->ViewRect().Height() / 2 );
  4111             iListBoxExt->ViewPositionChanged( newPosition );
  4528             iListBoxExt->ViewPositionChanged( newPosition );            
  4112             }
  4529             }
  4113         else
  4530         else
  4114             {
  4531             {
  4115             iView->VScrollTo(newThumbPos/iView->ItemHeight());
  4532             iView->VScrollTo(newThumbPos/iView->ItemHeight());
  4116             }
  4533             }
  4128             }
  4545             }
  4129         
  4546         
  4130         // If the event has changed thumb position, then update scroll bar
  4547         // If the event has changed thumb position, then update scroll bar
  4131         // unless physics is used. In that case thumb is updated via 
  4548         // unless physics is used. In that case thumb is updated via 
  4132         // CEikListBox::ScrollView.
  4549         // CEikListBox::ScrollView.
  4133         if ( AknLayoutUtils::PenEnabled() && newThumbPos != newThumbPosBeforeCorrecting && !iListBoxExt->iPhysics )
  4550         if ( AknLayoutUtils::PenEnabled() 
       
  4551              && newThumbPos != newThumbPosBeforeCorrecting 
       
  4552              && iListBoxExt && !iListBoxExt->iPhysics )
  4134             {
  4553             {
  4135             UpdateScrollBarThumbs();
  4554             UpdateScrollBarThumbs();
  4136             }
  4555             }
  4137         }
  4556         }
  4138     iItemDrawer->ClearFlags(CListItemDrawer::EDisableMarquee);
  4557     iItemDrawer->ClearFlags(CListItemDrawer::EDisableMarquee);
  4147         {
  4566         {
  4148         _AKNTRACE_FUNC_EXIT;
  4567         _AKNTRACE_FUNC_EXIT;
  4149         return;
  4568         return;
  4150         }
  4569         }
  4151     
  4570     
  4152     CheckCreateExtensionL();
       
  4153     if (!(iListBoxFlags & ELeftDownInViewRect))
  4571     if (!(iListBoxFlags & ELeftDownInViewRect))
  4154         {
  4572         {
  4155         _AKNTRACE_FUNC_EXIT;
  4573         _AKNTRACE_FUNC_EXIT;
  4156         return;
  4574         return;
  4157         }
  4575         }
  4609     TInt oldCurrentItemIndex;    
  5027     TInt oldCurrentItemIndex;    
  4610     TBool listEmpty = !ItemExists( iView->TopItemIndex() );
  5028     TBool listEmpty = !ItemExists( iView->TopItemIndex() );
  4611     
  5029     
  4612     // Handle empty list area events
  5030     // Handle empty list area events
  4613     if ( aPointerEvent.iType == TPointerEvent::EButton1Up &&
  5031     if ( aPointerEvent.iType == TPointerEvent::EButton1Up &&
  4614             !iListBoxExt->iScrolling )
  5032             !iListBoxExt->iScrolling && !iListBoxExt->iIsDownOnItem )
  4615         {
  5033         {
  4616         if ( listEmpty )
  5034         if ( listEmpty )
  4617             {
  5035             {
  4618             // No items, empty list was clicked
  5036             // No items, empty list was clicked
  4619             ReportListBoxEventL( MEikListBoxObserver::EEventEmptyListClicked );
  5037             ReportListBoxEventL( MEikListBoxObserver::EEventEmptyListClicked );
  4633         // Return always if list empty to avoid tactile feedback
  5051         // Return always if list empty to avoid tactile feedback
  4634         _AKNTRACE_FUNC_EXIT;
  5052         _AKNTRACE_FUNC_EXIT;
  4635         return;
  5053         return;
  4636         }
  5054         }
  4637 
  5055 
  4638     
       
  4639     // When in marking mode, pointer events should not be forwarded to 
       
  4640     // long tap detector, this boolean indicates if marking mode is active
       
  4641     TBool markingMode( iListBoxExt->MarkedItems() );
       
  4642     
       
  4643     if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  5056     if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  4644         {
  5057         {
  4645         if ( iListBoxExt->iSingleClickEnabled && 
  5058         if ( iListBoxExt->iSingleClickEnabled && 
  4646              itemIndex != iView->CurrentItemIndex() )
  5059              itemIndex != iView->CurrentItemIndex() )
  4647             {
  5060             {
  4648             iListBoxExt->EnableHighlight( EFalse );
  5061             iListBoxExt->EnableHighlight( EFalse );
  4649             iView->DrawItem( iView->CurrentItemIndex() );
  5062             iView->DrawItem( iView->CurrentItemIndex() );
  4650             }
  5063             }
  4651 
  5064 
  4652         iListBoxExt->iFeedbackType = ETouchFeedbackBasicItem;
  5065         iListBoxExt->iFeedbackType = ETouchFeedbackList;
  4653 
  5066         iListBoxExt->iDoubleClickEventIgnored = EFalse;
  4654         if ( itemIndex != iView->CurrentItemIndex() ||
  5067         
  4655              iListBoxFlags & ES60StyleMultiselection )
  5068         if ( !iListBoxExt->iSingleClickEnabled &&
  4656             {
  5069             itemIndex != iView->CurrentItemIndex() )
  4657             iListBoxExt->iFeedbackType = ETouchFeedbackSensitiveItem;
  5070             {
       
  5071             iListBoxExt->iFeedbackType = ETouchFeedbackSensitiveList;
  4658             }
  5072             }
  4659 
  5073 
  4660         if ( iListBoxExt->iPhysics &&
  5074         if ( iListBoxExt->iPhysics &&
  4661              iListBoxExt->iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionFlicking )
  5075              iListBoxExt->iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionFlicking )
  4662             {
  5076             {
  4663             iListBoxExt->iFeedbackType = ETouchFeedbackBasicItem;
  5077             iListBoxExt->iFeedbackType = ETouchFeedbackList;
  4664             }
       
  4665         
       
  4666         if ( !iListBoxExt->iPhysics || itemIndex == iView->CurrentItemIndex() )
       
  4667             {
       
  4668             iListBoxExt->ImmediateFeedback( iListBoxExt->iFeedbackType,
       
  4669                                             TTouchFeedbackType(ETouchFeedbackVibra | ETouchFeedbackAudio),
       
  4670                                             aPointerEvent );
       
  4671             }
  5078             }
  4672         }
  5079         }
  4673     iListBoxExt->iEventModifiers = aPointerEvent.iModifiers;
  5080     iListBoxExt->iEventModifiers = aPointerEvent.iModifiers;
  4674     CListBoxView::TSelectionMode selectionMode = CListBoxView::ENoSelection;
  5081     CListBoxView::TSelectionMode selectionMode = CListBoxView::ENoSelection;
  4675     TBool shiftKeyPressed = EFalse;
  5082     TBool shiftKeyPressed = EFalse;
  4724         }
  5131         }
  4725     
  5132     
  4726     if(Buffer()->iPressedIndex == itemIndex)
  5133     if(Buffer()->iPressedIndex == itemIndex)
  4727         {
  5134         {
  4728         Buffer()->iPressedIndex = KEikListBoxInvalidIndex;
  5135         Buffer()->iPressedIndex = KEikListBoxInvalidIndex;
       
  5136         iListBoxExt->iDoubleClickEventIgnored = ETrue;
  4729         _AKNTRACE_FUNC_EXIT;
  5137         _AKNTRACE_FUNC_EXIT;
  4730         return;
  5138         return;
  4731         }
  5139         }
  4732     }
  5140     }
  4733     
  5141     
  4755         {
  5163         {
  4756         case TPointerEvent::EButton1Down:
  5164         case TPointerEvent::EButton1Down:
  4757             _AKNTRACE("TPointerEvent::EButton1Down");
  5165             _AKNTRACE("TPointerEvent::EButton1Down");
  4758             // For drag outside listbox
  5166             // For drag outside listbox
  4759             iListBoxExt->iIsDownOnItem = pointerIsOverAnItem;
  5167             iListBoxExt->iIsDownOnItem = pointerIsOverAnItem;
  4760             iListBoxExt->iLastPoint = pointerPos;
  5168             iListBoxExt->iLastPoint = pointerPos;            
       
  5169 			iListBoxExt->iLongTappedItem = KErrNotFound;
  4761 
  5170 
  4762             // update index of the last down tapped item
  5171             // update index of the last down tapped item
  4763             iListBoxExt->iLastDownTappedItem = itemIndex;
  5172             iListBoxExt->iLastDownTappedItem = itemIndex;
       
  5173             iListBoxExt->iMarkableListShiftKeyPressed = EFalse; 
  4764 
  5174 
  4765             if ((! (Rect().Contains(aPointerEvent.iPosition))) && (iListBoxFlags & EPopout)) 
  5175             if ((! (Rect().Contains(aPointerEvent.iPosition))) && (iListBoxFlags & EPopout)) 
  4766                 {
  5176                 {
  4767                 ReportEventL(MCoeControlObserver::EEventRequestCancel);
  5177                 ReportEventL(MCoeControlObserver::EEventRequestCancel);
  4768                 iListBoxExt->iEventModifiers = 0;
  5178                 iListBoxExt->iEventModifiers = 0;
  4801                             {
  5211                             {
  4802                             iListBoxExt->EnableHighlight( ETrue, ETrue );
  5212                             iListBoxExt->EnableHighlight( ETrue, ETrue );
  4803                             UpdateHighlightL( itemIndex );
  5213                             UpdateHighlightL( itemIndex );
  4804                             CCoeEnv::Static()->WsSession().Finish();
  5214                             CCoeEnv::Static()->WsSession().Finish();
  4805                             }
  5215                             }
  4806                         if ( itemIndex != oldCurrentItemIndex )
  5216 
       
  5217                         if ( !( ( iListBoxFlags & EViewerFlag ) && 
       
  5218                                 ( iListBoxFlags & EDisableItemSpecificMenu ) ) )
  4807                             {
  5219                             {
  4808                         	iListBoxExt->ImmediateFeedback( 
  5220                             iListBoxExt->ImmediateFeedback( 
  4809                                 iListBoxExt->iFeedbackType,
  5221                                 iListBoxExt->iFeedbackType,
  4810                                 TTouchFeedbackType( ETouchFeedbackVibra | 
  5222                                 TTouchFeedbackType( ETouchFeedbackVibra | 
  4811                                 ETouchFeedbackAudio ),
  5223                                 ETouchFeedbackAudio ),
  4812                                 aPointerEvent );
  5224                                 aPointerEvent );
  4813                         	}
  5225                             }
       
  5226 
  4814                         if ( !wasFlicking )
  5227                         if ( !wasFlicking )
  4815                             {
  5228                             {
  4816                             ReportListBoxEventL( 
  5229                             ReportListBoxEventL( 
  4817                                     MEikListBoxObserver::EEventPenDownOnItem );
  5230                                     MEikListBoxObserver::EEventPenDownOnItem );
  4818                             iListBoxExt->LongTapPointerEventL( aPointerEvent );
  5231                             iListBoxExt->LongTapPointerEventL( aPointerEvent );
  4819                             }
  5232                             }
  4820                         }
  5233                         }
  4821                     else
  5234                     else
  4822                         {
  5235                         {
       
  5236                         if( itemIndex == oldCurrentItemIndex )
       
  5237                             {
       
  5238                             if( !( ( iListBoxFlags & EViewerFlag ) && 
       
  5239                                     ( iListBoxFlags & EDisableItemSpecificMenu ) ) )
       
  5240                                 {
       
  5241                                 iListBoxExt->ImmediateFeedback( 
       
  5242 							                                   iListBoxExt->iFeedbackType,
       
  5243 														       TTouchFeedbackType( ETouchFeedbackVibra | 
       
  5244 														       ETouchFeedbackAudio ),
       
  5245 														       aPointerEvent );
       
  5246                                }
       
  5247 							}
  4823                         ReportListBoxEventL( 
  5248                         ReportListBoxEventL( 
  4824                                 MEikListBoxObserver::EEventPenDownOnItem );    
  5249                                 MEikListBoxObserver::EEventPenDownOnItem );    
  4825                         }
  5250                         }
  4826                     }
  5251                     }
  4827                 else
  5252                 else
  4839                             {
  5264                             {
  4840                             transApi->SetMoveType( MAknListBoxTfxInternal::EListTap );
  5265                             transApi->SetMoveType( MAknListBoxTfxInternal::EListTap );
  4841                             }
  5266                             }
  4842                         }
  5267                         }
  4843 #endif
  5268 #endif
  4844                 if (!(iListBoxFlags & EMultipleSelection))      // i.e. this is a single selection listbox
  5269                 if ( !( iListBoxFlags & EMultipleSelection ) 
       
  5270                         || MarkingMode() )
  4845                     {
  5271                     {
  4846                     if (itemIndex == oldCurrentItemIndex)
  5272                     if (itemIndex == oldCurrentItemIndex)
  4847                         {
  5273                         {
  4848                         iItemDrawer->SetFlags( CListItemDrawer::EPressedDownState );
  5274                         iItemDrawer->SetFlags( CListItemDrawer::EPressedDownState );
  4849                         iView->DrawItem( itemIndex );
  5275                         iView->DrawItem( itemIndex );
  4906                             {
  5332                             {
  4907                             iListBoxExt->iMarkableListShiftKeyPressed = EFalse;
  5333                             iListBoxExt->iMarkableListShiftKeyPressed = EFalse;
  4908                             }
  5334                             }
  4909                         }
  5335                         }
  4910 
  5336 
  4911                     if ( itemIndex == oldCurrentItemIndex )
  5337                     if ( itemIndex == oldCurrentItemIndex && !iListBoxExt->iSingleClickEnabled )
  4912                         {
  5338                         {
  4913                         if ( shiftKeyPressed )
  5339                         if ( shiftKeyPressed )
  4914                             {
  5340                             {
  4915 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  5341 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  4916                             iListBoxExt->iAnchor = oldCurrentItemIndex;
  5342                             iListBoxExt->iAnchor = oldCurrentItemIndex;
  4985                 }
  5411                 }
  4986             break;
  5412             break;
  4987             
  5413             
  4988         case TPointerEvent::EButton1Up:
  5414         case TPointerEvent::EButton1Up:
  4989             _AKNTRACE("TPointerEvent::EButton1Up");
  5415             _AKNTRACE("TPointerEvent::EButton1Up");
  4990             if ( iListBoxExt->FeedbackEnabledOnUpEvent() && iListBoxExt->iClickEventsAllowed )
  5416             if ( iListBoxExt->FeedbackEnabledOnUpEvent() && 
  4991                 {
  5417 			     iListBoxExt->iClickEventsAllowed && 
  4992                 TTouchLogicalFeedback fbType = ETouchFeedbackBasicItem;
  5418 				 ( !( ( iListBoxFlags & EViewerFlag ) && 
  4993                 if ( iListBoxFlags & ES60StyleMultiselection )
  5419 				 ( iListBoxFlags & EDisableItemSpecificMenu ) ) )&& 
       
  5420 				 ( iListBoxExt->iLastDownTappedItem == itemIndex ) && 
       
  5421 				 ( !iListBoxExt->iDoubleClickEventIgnored ) && 
       
  5422 				 itemIndex == iView->CurrentItemIndex() )
       
  5423                 {
       
  5424                 TTouchLogicalFeedback fbType = ETouchFeedbackList;
       
  5425                 if ( iListBoxFlags & ES60StyleMultiselection 
       
  5426                       || iListBoxFlags & EMultipleSelection )
  4994                     {
  5427                     {
  4995                     fbType = ETouchFeedbackCheckbox;
  5428                     fbType = ETouchFeedbackCheckbox;
  4996                     }
  5429                     }
  4997                 iListBoxExt->ImmediateFeedback( fbType,
  5430                 iListBoxExt->ImmediateFeedback( fbType,
  4998                                                 ETouchFeedbackVibra,
  5431                                                 ETouchFeedbackVibra,
  5044                     {
  5477                     {
  5045                     iListBoxExt->LongTapPointerEventL( aPointerEvent );
  5478                     iListBoxExt->LongTapPointerEventL( aPointerEvent );
  5046                     }
  5479                     }
  5047                 if ( !s60StyleMultiselection )
  5480                 if ( !s60StyleMultiselection )
  5048                     {
  5481                     {
  5049                     if ( !iListBoxExt->iSingleClickEnabled )
  5482                     if ( !iListBoxExt->iSingleClickEnabled &&
       
  5483                          itemIndex == iListBoxExt->iLastDownTappedItem )
  5050                         {
  5484                         {
  5051                         ReportListBoxEventL(MEikListBoxObserver::EEventItemClicked);
  5485                         ReportListBoxEventL(MEikListBoxObserver::EEventItemClicked);
  5052                         }
  5486                         }
  5053                     else if ( itemIndex == iListBoxExt->iLastDownTappedItem )
  5487                     else if ( itemIndex == iListBoxExt->iLastDownTappedItem )
  5054                         {
  5488                         {
  5059                             MEikListBoxObserver::EEventItemSingleClicked );
  5493                             MEikListBoxObserver::EEventItemSingleClicked );
  5060                         _AKNTRACE_FUNC_EXIT;
  5494                         _AKNTRACE_FUNC_EXIT;
  5061                         return;
  5495                         return;
  5062                         }
  5496                         }
  5063                     }
  5497                     }
  5064                 else if ( s60StyleMultiselection && 
  5498                 // Due to the feature of capactior panel, the pointer position
  5065                           iListBoxExt->iLastDownTappedItem == itemIndex &&
  5499                 // may change between pointer down and up during user click 
  5066                           !Buffer()->iDragToAnotherItem )
  5500                 // action. When the click position is between two items 
       
  5501                 // and flick or drag event is not performed, the item index may
       
  5502                 // change unwanted, so we make a threshold for this situation.
       
  5503                 else if ( s60StyleMultiselection && !Buffer()->iDragToAnotherItem
       
  5504                          && ( iListBoxExt->iLastDownTappedItem == itemIndex
       
  5505                          || ( iListBoxExt->iLastDownTappedItem != KErrNotFound 
       
  5506                          && Abs( iListBoxExt->iLastPointerPos.iY - aPointerEvent.iPosition.iY ) < KPointerDownAndUpThreshold ) ) )
  5067                     {
  5507                     {
  5068                     iListBoxFlags |= EStateChanged;
  5508                     iListBoxFlags |= EStateChanged;
  5069                     Buffer()->iPressedIndex = itemIndex;
  5509                     Buffer()->iPressedIndex = itemIndex;
  5070                     iView->SetAnchor(itemIndex-1); // zero indexed
  5510                     iView->SetAnchor(itemIndex-1); // zero indexed
  5071                     iView->UpdateSelectionL(selectionMode);
  5511                     iView->UpdateSelectionL(selectionMode);
  5329     else
  5769     else
  5330         {
  5770         {
  5331         // switch off selection (marking) mode when we lose focus
  5771         // switch off selection (marking) mode when we lose focus
  5332         // this also corrects situation, where FEP-menu is launched
  5772         // this also corrects situation, where FEP-menu is launched
  5333         // and thus listbox doesn't receive shift up event
  5773         // and thus listbox doesn't receive shift up event
  5334         if (NULL != iListBoxExt)
  5774         if ( iListBoxExt )
  5335             {
  5775             {
  5336             if ((iListBoxFlags & EMultipleSelection) && (iListBoxFlags & EShiftEnterMarks))
  5776             if ((iListBoxFlags & EMultipleSelection) && (iListBoxFlags & EShiftEnterMarks))
  5337                 {
  5777                 {
  5338                 iListBoxExt->iShiftKeyPressed = EFalse;
  5778                 iListBoxExt->iShiftKeyPressed = EFalse;
  5339                 if (iListBoxExt->iLongPressTimer && iListBoxExt->iLongPressTimer->IsActive())
  5779                 if (iListBoxExt->iLongPressTimer && iListBoxExt->iLongPressTimer->IsActive())
  5349             }
  5789             }
  5350     
  5790     
  5351         iView->SetEmphasized(EFalse);
  5791         iView->SetEmphasized(EFalse);
  5352         iView->HideMatcherCursor();
  5792         iView->HideMatcherCursor();
  5353         
  5793         
  5354         if (iItemEditor && 
  5794         if ( iItemEditor && 
  5355             (iListBoxFlags & EPaintedSelection) && 
  5795             ( iListBoxFlags & EPaintedSelection ) && 
  5356             (NULL != iListBoxExt && iListBoxExt->ReasonForFocusLost() == EFocusLostToExternalControl))
  5796             ( iListBoxExt && iListBoxExt->ReasonForFocusLost() == EFocusLostToExternalControl ) )
  5357             {
  5797             {
  5358             iView->DeselectItem(CurrentItemIndex());
  5798             iView->DeselectItem(CurrentItemIndex());
  5359             }
  5799             }
  5360         }
  5800         }
  5361 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  5801 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  5419     return rect;
  5859     return rect;
  5420     }
  5860     }
  5421 
  5861 
  5422 EXPORT_C TBool CEikListBox::BackgroundDrawingSuppressed() const
  5862 EXPORT_C TBool CEikListBox::BackgroundDrawingSuppressed() const
  5423     {
  5863     {
  5424     if ( iListBoxExt )
  5864     if ( iItemDrawer )
  5425         {
  5865         {
  5426         return iListBoxExt->iBackgroundDrawingSuppressed;
  5866         TInt flags = iItemDrawer->Flags();
       
  5867         
       
  5868         return ( flags & CListItemDrawer::EDrawWholeBackground ) 
       
  5869                 && ( flags & CListItemDrawer::EBackgroundDrawn );
  5427         }
  5870         }
  5428         
  5871         
  5429     return EFalse;
  5872     return EFalse;
  5430     }
  5873     }
  5431 
  5874 
  5703             iListBoxFlags &= ( ~ELeftDownInViewRect );
  6146             iListBoxFlags &= ( ~ELeftDownInViewRect );
  5704             }
  6147             }
  5705         
  6148         
  5706         if ( iView )
  6149         if ( iView )
  5707             {
  6150             {
  5708             iView->SetItemOffsetInPixels( 0 );
  6151             iView->SetItemOffsetInPixels( 0 );            
  5709             }
  6152             }
  5710         
  6153         
  5711         // make sure that highlight is removed and long tap is canceled 
  6154         // make sure that highlight is removed and long tap is canceled 
  5712         // on layout switch, if single click is enabled and there is 
  6155         // on layout switch, if single click is enabled and there is 
  5713         // pointer down on any item
  6156         // pointer down on any item
  5741             }
  6184             }
  5742         iBackColor=iEikonEnv->ControlColor(IsDimmed() ? 
  6185         iBackColor=iEikonEnv->ControlColor(IsDimmed() ? 
  5743                                     EColorControlDimmedBackground : EColorControlBackground,*this);
  6186                                     EColorControlDimmedBackground : EColorControlBackground,*this);
  5744         UpdateViewColors();
  6187         UpdateViewColors();
  5745         UpdateItemDrawerColors();
  6188         UpdateItemDrawerColors();
  5746         
  6189 
       
  6190         // store the value of virtical offset as it will be 0 in SizeChange,
       
  6191         // that will affect view position in skin changed, which is a bug.
       
  6192         TInt oldOffset = 0; 
       
  6193         if ( iView )
       
  6194             {
       
  6195             oldOffset = iView->ItemOffsetInPixels();
       
  6196             }
       
  6197         // TODO: check if this call is real need here. 
  5747         SizeChanged();
  6198         SizeChanged();
       
  6199         if ( oldOffset !=0 && iView )
       
  6200             {
       
  6201             iView->SetItemOffsetInPixels( oldOffset );
       
  6202             UpdateScrollBarThumbs();
       
  6203             }
       
  6204         // this methord is empty.
  5748         UpdateScrollBarsColors();
  6205         UpdateScrollBarsColors();
  5749         
  6206         
  5750 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  6207 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  5751         if ( transApi )
  6208         if ( transApi )
  5752             {
  6209             {
  5772         case KEikMessageFadeAllWindows:
  6229         case KEikMessageFadeAllWindows:
  5773             {
  6230             {
  5774             // Some client does not let list get button1up, so we do it there...
  6231             // Some client does not let list get button1up, so we do it there...
  5775             iItemDrawer->ClearFlags( CListItemDrawer::EPressedDownState );
  6232             iItemDrawer->ClearFlags( CListItemDrawer::EPressedDownState );
  5776             TInt index = View()->CurrentItemIndex();
  6233             TInt index = View()->CurrentItemIndex();
  5777             if ( index != KErrNotFound )
  6234             TBool enabled( !( iItemDrawer->Flags()
       
  6235                 & CListItemDrawer::ESingleClickDisabledHighlight ) );
       
  6236             if ( index != KErrNotFound && enabled )
  5778             	{
  6237             	{
  5779                 Window().Invalidate( TRect( View()->ItemPos(index), 
  6238                 Window().Invalidate( TRect( View()->ItemPos(index), 
  5780             		                 View()->ItemSize() ) );
  6239                                     iItemDrawer->ItemCellSize() ) );
  5781             	}
  6240             	}
  5782             break;
  6241             break;
  5783             }
  6242             }
  5784         case KEikDynamicLayoutVariantSwitch:
  6243         case KEikDynamicLayoutVariantSwitch:
  5785         case KEikMessageColorSchemeChange:
  6244         case KEikMessageColorSchemeChange:
  5787             DrawDeferred();
  6246             DrawDeferred();
  5788             break;
  6247             break;
  5789 
  6248 
  5790         case KAknMessageFocusLost:
  6249         case KAknMessageFocusLost:
  5791             {
  6250             {
  5792             if ( iListBoxExt && iListBoxExt->iSingleClickEnabled )
  6251             // Do not remove highlight if window ordinal position has changed
       
  6252             // during the time when stylus menu is open
       
  6253             if ( iListBoxExt && iListBoxExt->iSingleClickEnabled &&
       
  6254                  ( iListBoxExt->iOldWinPos == KErrNotFound ||
       
  6255                    iListBoxExt->iOldWinPos == 
       
  6256                    DrawableWindow()->OrdinalPosition() ) )
  5793                 {
  6257                 {
  5794                 TBool enabled( iItemDrawer && !( iItemDrawer->Flags()
  6258                 TBool enabled( iItemDrawer && !( iItemDrawer->Flags()
  5795                     & CListItemDrawer::ESingleClickDisabledHighlight ) );
  6259                     & CListItemDrawer::ESingleClickDisabledHighlight ) );
  5796                            
  6260                            
  5797                 if ( enabled )
  6261                 if ( enabled )
  5950         rect.iTl.iX += LafListBox::InnerGutter();
  6414         rect.iTl.iX += LafListBox::InnerGutter();
  5951         if (iItemDrawer->Flags()&CListItemDrawer::EDrawMarkSelection)
  6415         if (iItemDrawer->Flags()&CListItemDrawer::EDrawMarkSelection)
  5952             {
  6416             {
  5953             rect.iTl.iX += iItemDrawer->MarkColumn() + iItemDrawer->MarkGutter();
  6417             rect.iTl.iX += iItemDrawer->MarkColumn() + iItemDrawer->MarkGutter();
  5954             }
  6418             }
  5955         iListBoxExt->SetReasonForFocusLost(EFocusLostToInternalEditor);
  6419         if ( iListBoxExt )
       
  6420             {
       
  6421             iListBoxExt->SetReasonForFocusLost(EFocusLostToInternalEditor);
       
  6422             }
  5956         itemEditor->StartEditingL(*this,rect,index,aMaxLength);
  6423         itemEditor->StartEditingL(*this,rect,index,aMaxLength);
  5957         iListBoxExt->SetReasonForFocusLost(EFocusLostToExternalControl);
  6424         if ( iListBoxExt )
       
  6425             {
       
  6426             iListBoxExt->SetReasonForFocusLost(EFocusLostToExternalControl);
       
  6427             }
  5958         ReportListBoxEventL( MEikListBoxObserver::EEventEditingStarted );
  6428         ReportListBoxEventL( MEikListBoxObserver::EEventEditingStarted );
  5959         }
  6429         }
  5960     _AKNTRACE_FUNC_EXIT;
  6430     _AKNTRACE_FUNC_EXIT;
  5961     }
  6431     }
  5962 
  6432 
  6080 // ---------------------------------------------------------------------------
  6550 // ---------------------------------------------------------------------------
  6081 //
  6551 //
  6082 EXPORT_C void CEikListBox::DisableScrolling( TBool aDisabled )
  6552 EXPORT_C void CEikListBox::DisableScrolling( TBool aDisabled )
  6083     {
  6553     {
  6084     _AKNTRACE_FUNC_ENTER;
  6554     _AKNTRACE_FUNC_ENTER;
  6085     iListBoxExt->iScrollingDisabled = aDisabled;
  6555     if ( iListBoxExt )
  6086     iView->iExtension->iScrollingDisabled = aDisabled;
  6556         {
  6087     
  6557         iListBoxExt->iScrollingDisabled = aDisabled;
  6088     if ( aDisabled && iListBoxExt->iPhysics )
  6558         iView->iExtension->iScrollingDisabled = aDisabled;
  6089         {
  6559         
  6090         delete iListBoxExt->iPhysics;
  6560         if ( aDisabled && iListBoxExt->iPhysics )
  6091         iListBoxExt->iPhysics = NULL;
  6561             {
  6092         iView->SetItemOffsetInPixels( 0 );
  6562             delete iListBoxExt->iPhysics;
  6093         }
  6563             iListBoxExt->iPhysics = NULL;
  6094     else if ( !aDisabled && !iListBoxExt->iPhysics && CAknPhysics::FeatureEnabled() )
  6564             iView->SetItemOffsetInPixels( 0 );
  6095         {
  6565             }
  6096         iListBoxExt->iPhysics = CAknPhysics::NewL( *iListBoxExt, this);      
  6566         else if ( !aDisabled && !iListBoxExt->iPhysics && CAknPhysics::FeatureEnabled() )
       
  6567             {
       
  6568             iListBoxExt->iPhysics = CAknPhysics::NewL( *iListBoxExt, this);      
       
  6569             }
  6097         }
  6570         }
  6098     _AKNTRACE_FUNC_EXIT;
  6571     _AKNTRACE_FUNC_EXIT;
  6099     }
  6572     }
  6100 
  6573 
  6101 
  6574 
  6103 // Checks if the kinetic scrolling functionality is disabled in the list.
  6576 // Checks if the kinetic scrolling functionality is disabled in the list.
  6104 // ---------------------------------------------------------------------------
  6577 // ---------------------------------------------------------------------------
  6105 //
  6578 //
  6106 EXPORT_C TBool CEikListBox::ScrollingDisabled()
  6579 EXPORT_C TBool CEikListBox::ScrollingDisabled()
  6107     {
  6580     {
  6108     return !iListBoxExt->iPhysics || iListBoxExt->iScrollingDisabled;
  6581     if ( iListBoxExt )
       
  6582         {
       
  6583         return !iListBoxExt->iPhysics || iListBoxExt->iScrollingDisabled;
       
  6584         }
       
  6585     else
       
  6586         {
       
  6587         return ETrue;
       
  6588         }
  6109     }
  6589     }
  6110 
  6590 
  6111 
  6591 
  6112 EXPORT_C void CEikListBox::SetPointerEventFilterDisabledL( const CArrayFix<TInt>& aItemIndexes )
  6592 EXPORT_C void CEikListBox::SetPointerEventFilterDisabledL( const CArrayFix<TInt>& aItemIndexes )
  6113     {
  6593     {
  6114     _AKNTRACE_FUNC_ENTER;
  6594     _AKNTRACE_FUNC_ENTER;
  6115     iListBoxExt->iMutiTappingItems.Reset();
  6595     if ( iListBoxExt )
  6116 
  6596         {
  6117     for(TInt i=0; i<aItemIndexes.Count(); i++ )
  6597         iListBoxExt->iMutiTappingItems.Reset();
  6118         {
  6598     
  6119         iListBoxExt->iMutiTappingItems.InsertInOrderL( aItemIndexes.At(i) ); 
  6599         for(TInt i=0; i<aItemIndexes.Count(); i++ )
  6120         }   
  6600             {
       
  6601             iListBoxExt->iMutiTappingItems.InsertInOrderL( aItemIndexes.At(i) ); 
       
  6602             } 
       
  6603         }
  6121     _AKNTRACE_FUNC_EXIT;
  6604     _AKNTRACE_FUNC_EXIT;
  6122     }
  6605     }
  6123 
  6606 
  6124 
  6607 
  6125 // ---------------------------------------------------------------------------
  6608 // ---------------------------------------------------------------------------
  6171 // Disables the single click functionality in the list.
  6654 // Disables the single click functionality in the list.
  6172 // ---------------------------------------------------------------------------
  6655 // ---------------------------------------------------------------------------
  6173 //
  6656 //
  6174 EXPORT_C void CEikListBox::DisableSingleClick( TBool aDisabled )
  6657 EXPORT_C void CEikListBox::DisableSingleClick( TBool aDisabled )
  6175     {
  6658     {
  6176     _AKNTRACE_FUNC_ENTER;
  6659     _AKNTRACE_FUNC_ENTER;    
  6177     if ( aDisabled && iListBoxExt->iSingleClickEnabled )
  6660     if ( aDisabled && 
       
  6661          iListBoxExt && 
       
  6662     	 iListBoxExt->iSingleClickEnabled && 
       
  6663     	 iItemDrawer )
  6178         {
  6664         {
  6179         iListBoxExt->DisableSingleClick(); 
  6665         iListBoxExt->DisableSingleClick(); 
       
  6666         iItemDrawer->ClearFlags( CListItemDrawer::ESingleClickEnabled);
       
  6667         }
       
  6668     else if ( !aDisabled &&
       
  6669               iListBoxExt &&
       
  6670               !iListBoxExt->iSingleClickEnabled &&
       
  6671               iItemDrawer )
       
  6672         {
       
  6673         TRAP_IGNORE( iListBoxExt->EnableSingleClickL() );
       
  6674         iItemDrawer->SetFlags( CListItemDrawer::ESingleClickEnabled );
  6180         }
  6675         }
  6181     _AKNTRACE_FUNC_EXIT;
  6676     _AKNTRACE_FUNC_EXIT;
  6182     }
  6677     }
  6183 
  6678 
  6184 
  6679 
  6186 // CEikListBox::DisableItemSpecificMenu
  6681 // CEikListBox::DisableItemSpecificMenu
  6187 // ---------------------------------------------------------------------------
  6682 // ---------------------------------------------------------------------------
  6188 //
  6683 //
  6189 EXPORT_C void CEikListBox::DisableItemSpecificMenu()
  6684 EXPORT_C void CEikListBox::DisableItemSpecificMenu()
  6190     {
  6685     {
       
  6686     _AKNTRACE_FUNC_ENTER;
  6191     if ( iListBoxExt )
  6687     if ( iListBoxExt )
  6192         {
  6688         {
  6193         iListBoxExt->DisableItemSpecificMenu();
  6689         iListBoxExt->DisableItemSpecificMenu();
       
  6690         }
       
  6691     _AKNTRACE_FUNC_EXIT;
       
  6692     }
       
  6693 
       
  6694 // ---------------------------------------------------------------------------
       
  6695 // CEikListBox::IsHighlightEnabled
       
  6696 // ---------------------------------------------------------------------------
       
  6697 //
       
  6698 EXPORT_C TBool CEikListBox::IsHighlightEnabled()
       
  6699     {
       
  6700     _AKNTRACE_FUNC_ENTER;	
       
  6701     TBool enabled( EFalse ); 
       
  6702     if ( !( iItemDrawer->Flags() & CListItemDrawer::EDisableHighlight ) )
       
  6703         {
       
  6704         if ( iListBoxExt && iListBoxExt->iSingleClickEnabled )
       
  6705             {
       
  6706             enabled = !( iItemDrawer->Flags()
       
  6707                 & CListItemDrawer::ESingleClickDisabledHighlight ); 
       
  6708             }
       
  6709         else 
       
  6710             {
       
  6711             enabled = ETrue;
       
  6712             }
       
  6713         }
       
  6714     _AKNTRACE_FUNC_EXIT;
       
  6715     return enabled; 
       
  6716     }
       
  6717 
       
  6718 
       
  6719 // ---------------------------------------------------------------------------
       
  6720 // CEikListBox::SetMarkingMode
       
  6721 // ---------------------------------------------------------------------------
       
  6722 //
       
  6723 EXPORT_C void CEikListBox::SetMarkingMode( TBool aEnable )
       
  6724     {
       
  6725     if ( iListBoxExt && iListBoxExt->iSingleClickEnabled && 
       
  6726             ( iListBoxFlags & CEikListBox::ES60StyleMarkable ) )
       
  6727         {
       
  6728         if ( iListBoxExt->iMarkingModeInUse != aEnable ) 
       
  6729             {
       
  6730             if ( aEnable )
       
  6731                 {
       
  6732                 iView->ItemDrawer()->SetFlags( 
       
  6733                         CListItemDrawer::EMarkingModeEnabled );
       
  6734                 }
       
  6735             else
       
  6736                 {
       
  6737                 iView->ItemDrawer()->ClearFlags( 
       
  6738                         CListItemDrawer::EMarkingModeEnabled );
       
  6739             
       
  6740                 if ( iView->SelectionIndexes()->Count() > 0 )
       
  6741                     {
       
  6742                     iView->ClearSelection( EFalse );
       
  6743                     }
       
  6744                 }
       
  6745 
       
  6746             iListBoxExt->iMarkingModeInUse = aEnable;
       
  6747             DrawDeferred();
       
  6748             }
       
  6749 
       
  6750         if ( MarkingModeObserver() )
       
  6751             {
       
  6752             MarkingModeObserver()->MarkingModeStatusChanged( aEnable );
       
  6753             }
       
  6754         }
       
  6755     }
       
  6756 
       
  6757 
       
  6758 // ---------------------------------------------------------------------------
       
  6759 // CEikListBox::SetMarkingModeObserver
       
  6760 // ---------------------------------------------------------------------------
       
  6761 //
       
  6762 EXPORT_C void CEikListBox::SetMarkingModeObserver( 
       
  6763         MAknMarkingModeObserver* aObserver )
       
  6764     {
       
  6765     if ( iListBoxExt )
       
  6766         {
       
  6767         iListBoxExt->iMarkingModeObserver = aObserver;
  6194         }
  6768         }
  6195     }
  6769     }
  6196 
  6770 
  6197 
  6771 
  6198 void CEikListBox::ScrollView( const TInt aOffset, TBool aDrawNow )
  6772 void CEikListBox::ScrollView( const TInt aOffset, TBool aDrawNow )
  6199 	{
  6773 	{
  6200 	_AKNTRACE_FUNC_ENTER;
  6774 	_AKNTRACE_FUNC_ENTER;
  6201 #ifdef _DEBUG
  6775 #ifdef _DEBUG
  6202 	RDebug::Print( _L( "CEikListBox::ScrollView, aOffset = %d, aDrawNow = %d" ), aOffset, aDrawNow );
  6776 	RDebug::Print( _L( "CEikListBox::ScrollView, aOffset = %d, aDrawNow = %d" ), aOffset, aDrawNow );
  6203 #endif // _DEBUG
  6777 #endif // _DEBUG	
  6204 
  6778 	
  6205 	if ( aOffset != 0 )
  6779 	if ( iListBoxExt && aOffset != 0 )
  6206 	    {
  6780 	    {
  6207         TInt itemHeight = iView->ItemHeight();
  6781         TInt itemHeight = iView->ItemHeight();
  6208         TInt viewHeight = iView->ViewRect().Size().iHeight;
  6782         TInt viewHeight = iView->ViewRect().Size().iHeight;
  6209         TInt itemsInSingleLine = iListBoxExt->iItemsInSingleLine;
  6783         TInt itemsInSingleLine = iListBoxExt->iItemsInSingleLine;
  6210         TInt oldListTopPos = ( iView->TopItemIndex() / itemsInSingleLine ) * itemHeight 
  6784         TInt oldListTopPos = ( iView->TopItemIndex() / itemsInSingleLine ) * itemHeight 
  6231                 {
  6805                 {
  6232                 if( ( newListBottomPos < iListBoxExt->ListBottomLimit() && newListTopPos > 0 ) || 
  6806                 if( ( newListBottomPos < iListBoxExt->ListBottomLimit() && newListTopPos > 0 ) || 
  6233                     ( newListBottomPos >= iListBoxExt->ListBottomLimit() ) ||
  6807                     ( newListBottomPos >= iListBoxExt->ListBottomLimit() ) ||
  6234                     ( newListTopPos <= 0 && newListTopPos + viewHeight >= 0 && newListLastItemPos > viewHeight ) )
  6808                     ( newListTopPos <= 0 && newListTopPos + viewHeight >= 0 && newListLastItemPos > viewHeight ) )
  6235                     {
  6809                     {
  6236                     if ( CAknPhysics::EAknPhysicsActionFlicking == iListBoxExt->iPhysics->OngoingPhysicsAction() || 
  6810                     switch(iListBoxExt->iPhysics->OngoingPhysicsAction())
  6237                          CAknPhysics::EAknPhysicsActionBouncing == iListBoxExt->iPhysics->OngoingPhysicsAction() )
       
  6238                         {
  6811                         {
  6239                         iListBoxExt->ImmediateFeedback( ETouchFeedbackSensitiveItem,
  6812                         case CAknPhysics::EAknPhysicsActionBouncing:
  6240                                                         TTouchFeedbackType( ETouchFeedbackVibra ),
  6813                         case CAknPhysics::EAknPhysicsActionDragging:
  6241                                                         TPointerEvent() );
  6814                         case CAknPhysics::EAknPhysicsActionFlicking:
  6242                         }
  6815                             iListBoxExt->ImmediateFeedback( 
  6243                     else if ( CAknPhysics::EAknPhysicsActionDragging == iListBoxExt->iPhysics->OngoingPhysicsAction() )
  6816                                     ETouchFeedbackSensitiveList,
  6244                         {
  6817                                     TTouchFeedbackType( ETouchFeedbackVibra ),
  6245                         iListBoxExt->ImmediateFeedback( iListBoxExt->iFeedbackType,
  6818                                     TPointerEvent() );
  6246                                                         TTouchFeedbackType( ETouchFeedbackVibra | ETouchFeedbackAudio ),
  6819                             break;
  6247                                                         TPointerEvent() );
  6820                         default:
       
  6821                             break;
  6248                         }
  6822                         }
  6249                     }
  6823                     }
  6250                 }
  6824                 }
  6251             }
  6825             }
  6252         newTopItemIndex = newTopItemIndexBck;
  6826         newTopItemIndex = newTopItemIndexBck;
  6269 #ifdef _DEBUG
  6843 #ifdef _DEBUG
  6270         RDebug::Print( _L( "CEikListBox::ScrollView, newTopItemIndex = %d" ), newTopItemIndex );
  6844         RDebug::Print( _L( "CEikListBox::ScrollView, newTopItemIndex = %d" ), newTopItemIndex );
  6271 #endif // _DEBUG
  6845 #endif // _DEBUG
  6272         iView->SetTopItemIndex( newTopItemIndex );
  6846         iView->SetTopItemIndex( newTopItemIndex );
  6273         }
  6847         }
       
  6848 
  6274     if ( aDrawNow )
  6849     if ( aDrawNow )
  6275         {
  6850         {
  6276         TRect rect(Rect());
  6851         TRect rect(Rect());
  6277         
  6852         
  6278         // list position changed
  6853         // list position changed
  6279         iListBoxExt->iBackgroundDrawingSuppressed = ETrue;
  6854         if ( iListBoxExt && iListBoxExt->FlickOrPanningOngoing() )
       
  6855             {
       
  6856             iItemDrawer->SetFlags( CListItemDrawer::EDrawWholeBackground );
       
  6857             }
       
  6858 
  6280         UpdateScrollBarThumbs();
  6859         UpdateScrollBarThumbs();
  6281         DrawNow();
  6860         DrawNow();
       
  6861 
  6282         if (iSBFrame && iSBFrame->VerticalScrollBar() && !iSBFrame->VerticalScrollBar()->OwnsWindow())
  6862         if (iSBFrame && iSBFrame->VerticalScrollBar() && !iSBFrame->VerticalScrollBar()->OwnsWindow())
  6283             {
  6863             {
  6284             TRect srect( iSBFrame->VerticalScrollBar()->Rect() );
  6864             TRect srect( iSBFrame->VerticalScrollBar()->Rect() );
  6285             if ( !srect.Intersects( rect ))
  6865             if ( !srect.Intersects( rect ))
  6286                 {
  6866                 {
  6287                 iSBFrame->DrawScrollBarsNow();                
  6867                 iSBFrame->DrawScrollBarsNow();                
  6288                 }
  6868                 }
  6289             }
  6869             }
  6290         iListBoxExt->iBackgroundDrawingSuppressed = EFalse;
  6870 
       
  6871         if ( iListBoxExt )
       
  6872             {
       
  6873             iItemDrawer->ClearFlags( CListItemDrawer::EDrawWholeBackground 
       
  6874                     | CListItemDrawer::EBackgroundDrawn );
       
  6875             }
  6291         }        
  6876         }        
  6292     _AKNTRACE_FUNC_EXIT;
  6877     _AKNTRACE_FUNC_EXIT;
  6293 	}
  6878 	}
  6294 
  6879 
  6295 
  6880 
  6300 TBool CEikListBox::HandlePhysicsPointerEventL( const TPointerEvent& aPointerEvent )
  6885 TBool CEikListBox::HandlePhysicsPointerEventL( const TPointerEvent& aPointerEvent )
  6301     {
  6886     {
  6302     _AKNTRACE_FUNC_ENTER;
  6887     _AKNTRACE_FUNC_ENTER;
  6303     _AKNTRACE( "aPointerEvent.iType = %d", aPointerEvent.iType );
  6888     _AKNTRACE( "aPointerEvent.iType = %d", aPointerEvent.iType );
  6304     if ( iListBoxExt->iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionBouncing )
  6889     if ( iListBoxExt->iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionBouncing )
  6305         { 
  6890         {  
  6306         // Block scrolling events outside listbox area. Note that pointer
  6891         // Block scrolling events outside listbox area.
  6307         // event ignore must be done for the window-owning control or it
  6892         if ( iListBoxExt->IgnorePointerEventsUntilUp() )
  6308         // doesn't have any effect!
  6893             {
  6309         CCoeControl* windowOwningControl = this;
       
  6310         
       
  6311         while ( windowOwningControl && !windowOwningControl->OwnsWindow() )
       
  6312             {
       
  6313             windowOwningControl = windowOwningControl->Parent();
       
  6314             }
       
  6315 
       
  6316         if ( windowOwningControl )
       
  6317             {
       
  6318             windowOwningControl->IgnoreEventsUntilNextPointerUp();
       
  6319             _AKNTRACE_FUNC_EXIT;
  6894             _AKNTRACE_FUNC_EXIT;
  6320             return ETrue;
  6895             return ETrue;
  6321             }
  6896             }
  6322         }
  6897         }
  6323 
  6898 
  6324     TBool blockEvent = EFalse;
  6899     TBool blockEvent = EFalse;
  6325     
  6900     
  6326     TBool allowDragEvent( ( iListBoxFlags & ELeftDownInViewRect ) && iSBFrame && !iListBoxExt->iScrollingDisabled );
  6901     // If tap down in listbox area, kinetic scrolling is enabled and style popup menu is not shown,
  6327 
  6902     // drag event is sent to listbox.
       
  6903     TBool allowDragEvent( ( iListBoxFlags & ELeftDownInViewRect ) 
       
  6904             && !iListBoxExt->iScrollingDisabled 
       
  6905             && ( iListBoxExt->iSingleClickEnabled 
       
  6906                     && iListBoxExt->iLongTappedItem == KErrNotFound ) );
  6328     
  6907     
  6329     switch ( aPointerEvent.iType )
  6908     switch ( aPointerEvent.iType )
  6330         {
  6909         {
  6331         case TPointerEvent::EButton1Down:
  6910         case TPointerEvent::EButton1Down:
  6332             {
  6911             {
  6352                                                  tappedItemIndex );
  6931                                                  tappedItemIndex );
  6353                     if ( iListBoxExt->iIsDownOnItem )
  6932                     if ( iListBoxExt->iIsDownOnItem )
  6354                         {
  6933                         {
  6355                         iListBoxExt->iLastDownTappedItem = tappedItemIndex;
  6934                         iListBoxExt->iLastDownTappedItem = tappedItemIndex;
  6356                         iListBoxExt->iMarkingDisabled = ETrue;
  6935                         iListBoxExt->iMarkingDisabled = ETrue;
       
  6936                         iListBoxFlags|=ELeftDownInViewRect;                        
  6357                         blockEvent = ETrue;
  6937                         blockEvent = ETrue;
       
  6938                         iListBoxExt->ImmediateFeedback( 
       
  6939                             ETouchFeedbackList,
       
  6940                             TTouchFeedbackType( ETouchFeedbackVibra | 
       
  6941                             ETouchFeedbackAudio ),
       
  6942                             aPointerEvent );
  6358                         }
  6943                         }
  6359                     }
  6944                     }
  6360                 }
  6945                 }
  6361             else
  6946             else
  6362                 {
  6947                 {
  6556 void CEikListBox::UpdateHighlightL( TInt aItemIndex )
  7141 void CEikListBox::UpdateHighlightL( TInt aItemIndex )
  6557     {
  7142     {
  6558     _AKNTRACE_FUNC_ENTER;
  7143     _AKNTRACE_FUNC_ENTER;
  6559     TInt oldCurrentItemIndex = iView->CurrentItemIndex();
  7144     TInt oldCurrentItemIndex = iView->CurrentItemIndex();
  6560 
  7145 
  6561     if ( iListBoxExt->iReportDelayedPenDown && !iListBoxExt->iScrolling )
  7146     if ( iListBoxExt && iListBoxExt->iReportDelayedPenDown 
       
  7147         && !iListBoxExt->iScrolling )
  6562         {
  7148         {
  6563 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  7149 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  6564         if ( aItemIndex != oldCurrentItemIndex )
  7150         if ( aItemIndex != oldCurrentItemIndex )
  6565             {
  7151             {
  6566             MAknListBoxTfxInternal* transApi =
  7152             MAknListBoxTfxInternal* transApi =
  6579         // been made visible.
  7165         // been made visible.
  6580         iListBoxExt->LongTapPointerEventL(
  7166         iListBoxExt->LongTapPointerEventL(
  6581             iListBoxExt->iDelayedPointerDownEvent );
  7167             iListBoxExt->iDelayedPointerDownEvent );
  6582         }
  7168         }
  6583 
  7169 
  6584     if ( iListBoxExt->iDelayedMultiselection )
  7170     if ( iListBoxExt && iListBoxExt->iDelayedMultiselection )
  6585         {
  7171         {
  6586         iItemDrawer->SetFlags( CListItemDrawer::EPressedDownState );
  7172         iItemDrawer->SetFlags( CListItemDrawer::EPressedDownState );
  6587         }
  7173         }
  6588     
  7174     
  6589     iView->SetItemIndex( aItemIndex );
  7175     iView->SetItemIndex( aItemIndex );
  6590 
  7176 
  6591     if ( iListBoxExt->iMarkableListMarking )
  7177     if ( iListBoxExt && iListBoxExt->iMarkableListMarking )
  6592         {
  7178         {
  6593         if ( iListBoxExt->iMarkableListShiftKeyPressed )
  7179         if ( iListBoxExt->iSingleClickEnabled )
       
  7180             {
       
  7181             if ( iListBoxExt->iMarkableListShiftKeyPressed )
       
  7182                 {
       
  7183                 iView->ToggleItemL( iView->CurrentItemIndex() );
       
  7184                 iListBoxExt->iClickEventsAllowed = EFalse;
       
  7185                 }
       
  7186             }
       
  7187         else if ( iListBoxExt->iMarkableListShiftKeyPressed )
  6594            {
  7188            {
  6595 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  7189 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  6596            iListBoxExt->iAnchor = oldCurrentItemIndex;
  7190            iListBoxExt->iAnchor = oldCurrentItemIndex;
  6597            iListBoxExt->iSelect =
  7191            iListBoxExt->iSelect =
  6598                !iView->ItemIsSelected( iView->CurrentItemIndex() );
  7192                !iView->ItemIsSelected( iView->CurrentItemIndex() );
  6616         }
  7210         }
  6617 
  7211 
  6618     iView->DrawItem( oldCurrentItemIndex );
  7212     iView->DrawItem( oldCurrentItemIndex );
  6619     iView->DrawItem( aItemIndex );
  7213     iView->DrawItem( aItemIndex );
  6620     
  7214     
  6621     if ( iListBoxExt->iDelayedMultiselection )
  7215     if ( iListBoxExt && iListBoxExt->iDelayedMultiselection )
  6622         {
  7216         {
  6623         iListBoxFlags |= EStateChanged;
  7217         iListBoxFlags |= EStateChanged;
  6624         Buffer()->iPressedIndex = aItemIndex;
  7218         Buffer()->iPressedIndex = aItemIndex;
  6625         }
  7219         }
  6626 
  7220 
  6627     ReportEventL( MCoeControlObserver::EEventStateChanged );
  7221     ReportEventL( MCoeControlObserver::EEventStateChanged );
  6628     _AKNTRACE_FUNC_EXIT;
  7222     _AKNTRACE_FUNC_EXIT;
       
  7223     }
       
  7224 
       
  7225 
       
  7226 // ---------------------------------------------------------------------------
       
  7227 // CEikListBox::MarkingMode
       
  7228 // ---------------------------------------------------------------------------
       
  7229 //
       
  7230 TBool CEikListBox::MarkingMode() const
       
  7231     {
       
  7232     TBool markingModeInUse = EFalse;
       
  7233     
       
  7234     if ( iListBoxExt )
       
  7235         {
       
  7236         markingModeInUse = iListBoxExt->iMarkingModeInUse;
       
  7237         }
       
  7238     
       
  7239     return markingModeInUse;
       
  7240     }
       
  7241 
       
  7242 
       
  7243 // ---------------------------------------------------------------------------
       
  7244 // CEikListBox::MarkingModeObserver
       
  7245 // ---------------------------------------------------------------------------
       
  7246 //
       
  7247 MAknMarkingModeObserver* CEikListBox::MarkingModeObserver()
       
  7248     {
       
  7249     MAknMarkingModeObserver* observer = NULL;
       
  7250     
       
  7251     if ( iListBoxExt )
       
  7252         {
       
  7253         observer = iListBoxExt->iMarkingModeObserver;
       
  7254         }
       
  7255     
       
  7256     return observer;
  6629     }
  7257     }
  6630 
  7258 
  6631 
  7259 
  6632 // ---------------------------------------------------------------------------
  7260 // ---------------------------------------------------------------------------
  6633 // Sets this control as visible or invisible.
  7261 // Sets this control as visible or invisible.