uifw/EikStd/coctlsrc/EIKLBX.CPP
branchRCL_3
changeset 29 a8834a2e9a96
parent 25 941195f2d488
child 38 c52421ed5f07
equal deleted inserted replaced
25:941195f2d488 29:a8834a2e9a96
   523      * Sets the highlight for the first item visible after single click 
   523      * Sets the highlight for the first item visible after single click 
   524      * is disabled
   524      * is disabled
   525      */
   525      */
   526     void DisableSingleClick();
   526     void DisableSingleClick();
   527 
   527 
       
   528     /**
       
   529      * Enables single click
       
   530      */
       
   531     void EnableSingleClickL();    
       
   532     
   528     /**
   533     /**
   529      * Disables item specific menu.
   534      * Disables item specific menu.
   530      */
   535      */
   531     void DisableItemSpecificMenu();
   536     void DisableItemSpecificMenu();
   532 
   537 
   755     
   760     
   756     /**
   761     /**
   757      * Ordinal position of listbox window, before stylus menu is opened.
   762      * Ordinal position of listbox window, before stylus menu is opened.
   758      */
   763      */
   759     TInt iOldWinPos;
   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;
   760     
   771     
   761 private:
   772 private:
   762     CMatchBuffer* iBuffer;
   773     CMatchBuffer* iBuffer;
   763     CEikListBox& iListBox;
   774     CEikListBox& iListBox;
   764     CEikListBox::TReasonForFocusLost iReasonForFocusLost;
   775     CEikListBox::TReasonForFocusLost iReasonForFocusLost;
   788     TBool iPanningOngoing;
   799     TBool iPanningOngoing;
   789 
   800 
   790     /**
   801     /**
   791      * Height of the list in pixels.
   802      * Height of the list in pixels.
   792      */    
   803      */    
   793     TInt iListBottomLimit;
   804     TInt iListBottomLimit;    
   794     };
   805     };
   795     
   806     
   796 // CEikListBoxExt    
   807 // CEikListBoxExt    
   797 
   808 
   798 CListBoxExt* CListBoxExt::NewL( CEikListBox& aListBox )
   809 CListBoxExt* CListBoxExt::NewL( CEikListBox& aListBox )
  1268     iSingleClickEnabled = EFalse;
  1279     iSingleClickEnabled = EFalse;
  1269 
  1280 
  1270     _AKNTRACE_FUNC_EXIT;
  1281     _AKNTRACE_FUNC_EXIT;
  1271     }
  1282     }
  1272 
  1283 
       
  1284 // -----------------------------------------------------------------------------
       
  1285 // CListBoxExt::EnableSingleClickL
       
  1286 // -----------------------------------------------------------------------------
       
  1287 //
       
  1288 void CListBoxExt::EnableSingleClickL()
       
  1289     {
       
  1290     _AKNTRACE_FUNC_ENTER;
       
  1291     if ( !iLongTapDetector )
       
  1292         {
       
  1293         iLongTapDetector = CAknLongTapDetector::NewL( this );
       
  1294         }
       
  1295     if ( !iItemActionMenu )
       
  1296         {
       
  1297         iItemActionMenu = CAknItemActionMenu::RegisterCollectionL( 
       
  1298             *this, &iListBox );
       
  1299         iListBox.iListBoxFlags &= ( ~CEikListBox::EDisableItemSpecificMenu );
       
  1300         }    
       
  1301     iSingleClickEnabled = ETrue;
       
  1302     EnableHighlight( EFalse );
       
  1303     // iListBox.UpdateHighlightL( iListBox.iView->CurrentItemIndex() );
       
  1304     _AKNTRACE_FUNC_EXIT;
       
  1305     }
  1273 
  1306 
  1274 // -----------------------------------------------------------------------------
  1307 // -----------------------------------------------------------------------------
  1275 // CListBoxExt::DisableItemSpecificMenu
  1308 // CListBoxExt::DisableItemSpecificMenu
  1276 // -----------------------------------------------------------------------------
  1309 // -----------------------------------------------------------------------------
  1277 //
  1310 //
  1297     if ( iSingleClickEnabled && iLongTapDetector && iItemActionMenu  )
  1330     if ( iSingleClickEnabled && iLongTapDetector && iItemActionMenu  )
  1298         {
  1331         {
  1299         // Send event on down only if item specific items were found. 
  1332         // Send event on down only if item specific items were found. 
  1300         // Long tap is also disabled if current item is not marked while
  1333         // Long tap is also disabled if current item is not marked while
  1301         // there are some marked items or marking mode is active.
  1334         // there are some marked items or marking mode is active.
  1302         if ( !( ( iListBox.MarkingMode() || MarkedItems() )
  1335         if ( ( !( ( iListBox.MarkingMode() || MarkedItems() )
  1303             && !iListBox.View()->ItemIsSelected( iListBox.CurrentItemIndex() ) )
  1336             && !iListBox.View()->ItemIsSelected( iListBox.CurrentItemIndex() ) )
       
  1337             || ( iListBox.iListBoxFlags & CEikListBox::EItemSpecificMenuAlwaysShown ) )
  1304             && ( aPointerEvent.iType != TPointerEvent::EButton1Down
  1338             && ( aPointerEvent.iType != TPointerEvent::EButton1Down
  1305             || iItemActionMenu->InitMenuL() ) ) 
  1339             || iItemActionMenu->InitMenuL() ) ) 
  1306             {
  1340             {
  1307             iLongTapDetector->PointerEventL ( aPointerEvent );
  1341             iLongTapDetector->PointerEventL ( aPointerEvent );
  1308             }
  1342             }
  4190     switch ( aEvent )
  4224     switch ( aEvent )
  4191         {
  4225         {
  4192         case MEikListBoxObserver::EEventFlickStarted:
  4226         case MEikListBoxObserver::EEventFlickStarted:
  4193         case MEikListBoxObserver::EEventPanningStarted:
  4227         case MEikListBoxObserver::EEventPanningStarted:
  4194             {
  4228             {
       
  4229             if ( iListBoxExt && ( iListBoxExt->iWorldSize.iHeight 
       
  4230                     <= iListBoxExt->iViewSize.iHeight ) )
       
  4231                 {
       
  4232                 return; 
       
  4233                 }
  4195             iItemDrawer->SetFlags( CListItemDrawer::EDisableMarquee );
  4234             iItemDrawer->SetFlags( CListItemDrawer::EDisableMarquee );
  4196             if ( iListBoxExt )
  4235             if ( iListBoxExt )
  4197                 { 
  4236                 { 
  4198                 if ( aEvent == MEikListBoxObserver::EEventFlickStarted )
  4237                 if ( aEvent == MEikListBoxObserver::EEventFlickStarted )
  4199                     {
  4238                     {
  4208             }
  4247             }
  4209             
  4248             
  4210         case MEikListBoxObserver::EEventFlickStopped:
  4249         case MEikListBoxObserver::EEventFlickStopped:
  4211         case MEikListBoxObserver::EEventPanningStopped:
  4250         case MEikListBoxObserver::EEventPanningStopped:
  4212             {
  4251             {
       
  4252             if ( iListBoxExt && ( iListBoxExt->iWorldSize.iHeight 
       
  4253                     <= iListBoxExt->iViewSize.iHeight ) )
       
  4254                 {
       
  4255                 return; 
       
  4256                 }
  4213             iItemDrawer->ClearFlags( CListItemDrawer::EDisableMarquee );
  4257             iItemDrawer->ClearFlags( CListItemDrawer::EDisableMarquee );
  4214             if ( iListBoxExt )
  4258             if ( iListBoxExt )
  4215                 { 
  4259                 { 
  4216                 if ( aEvent == MEikListBoxObserver::EEventFlickStopped )
  4260                 if ( aEvent == MEikListBoxObserver::EEventFlickStopped )
  4217                     {   
  4261                     {   
  4997             iListBoxExt->EnableHighlight( EFalse );
  5041             iListBoxExt->EnableHighlight( EFalse );
  4998             iView->DrawItem( iView->CurrentItemIndex() );
  5042             iView->DrawItem( iView->CurrentItemIndex() );
  4999             }
  5043             }
  5000 
  5044 
  5001         iListBoxExt->iFeedbackType = ETouchFeedbackList;
  5045         iListBoxExt->iFeedbackType = ETouchFeedbackList;
       
  5046         iListBoxExt->iDoubleClickEventIgnored = EFalse;
  5002         
  5047         
  5003         if ( !iListBoxExt->iSingleClickEnabled &&
  5048         if ( !iListBoxExt->iSingleClickEnabled &&
  5004             itemIndex != iView->CurrentItemIndex() )
  5049             itemIndex != iView->CurrentItemIndex() )
  5005             {
  5050             {
  5006             iListBoxExt->iFeedbackType = ETouchFeedbackSensitiveList;
  5051             iListBoxExt->iFeedbackType = ETouchFeedbackSensitiveList;
  5066         }
  5111         }
  5067     
  5112     
  5068     if(Buffer()->iPressedIndex == itemIndex)
  5113     if(Buffer()->iPressedIndex == itemIndex)
  5069         {
  5114         {
  5070         Buffer()->iPressedIndex = KEikListBoxInvalidIndex;
  5115         Buffer()->iPressedIndex = KEikListBoxInvalidIndex;
       
  5116         iListBoxExt->iDoubleClickEventIgnored = ETrue;
  5071         _AKNTRACE_FUNC_EXIT;
  5117         _AKNTRACE_FUNC_EXIT;
  5072         return;
  5118         return;
  5073         }
  5119         }
  5074     }
  5120     }
  5075     
  5121     
  5348             if ( iListBoxExt->FeedbackEnabledOnUpEvent() && 
  5394             if ( iListBoxExt->FeedbackEnabledOnUpEvent() && 
  5349 			     iListBoxExt->iClickEventsAllowed && 
  5395 			     iListBoxExt->iClickEventsAllowed && 
  5350 				 ( !( ( iListBoxFlags & EViewerFlag ) && 
  5396 				 ( !( ( iListBoxFlags & EViewerFlag ) && 
  5351 				 ( iListBoxFlags & EDisableItemSpecificMenu ) ) )&& 
  5397 				 ( iListBoxFlags & EDisableItemSpecificMenu ) ) )&& 
  5352 				 ( iListBoxExt->iLastDownTappedItem == itemIndex ) && 
  5398 				 ( iListBoxExt->iLastDownTappedItem == itemIndex ) && 
  5353 				 (Buffer()->iPressedIndex != KEikListBoxInvalidIndex) && 
  5399 				 ( !iListBoxExt->iDoubleClickEventIgnored ) && 
  5354 				 itemIndex == iView->CurrentItemIndex() )
  5400 				 itemIndex == iView->CurrentItemIndex() )
  5355                 {
  5401                 {
  5356                 TTouchLogicalFeedback fbType = ETouchFeedbackList;
  5402                 TTouchLogicalFeedback fbType = ETouchFeedbackList;
  5357                 if ( iListBoxFlags & ES60StyleMultiselection 
  5403                 if ( iListBoxFlags & ES60StyleMultiselection 
  5358                       || iListBoxFlags & EMultipleSelection )
  5404                       || iListBoxFlags & EMultipleSelection )
  5409                     {
  5455                     {
  5410                     iListBoxExt->LongTapPointerEventL( aPointerEvent );
  5456                     iListBoxExt->LongTapPointerEventL( aPointerEvent );
  5411                     }
  5457                     }
  5412                 if ( !s60StyleMultiselection )
  5458                 if ( !s60StyleMultiselection )
  5413                     {
  5459                     {
  5414                     if ( !iListBoxExt->iSingleClickEnabled )
  5460                     if ( !iListBoxExt->iSingleClickEnabled &&
       
  5461                          itemIndex == iListBoxExt->iLastDownTappedItem )
  5415                         {
  5462                         {
  5416                         ReportListBoxEventL(MEikListBoxObserver::EEventItemClicked);
  5463                         ReportListBoxEventL(MEikListBoxObserver::EEventItemClicked);
  5417                         }
  5464                         }
  5418                     else if ( itemIndex == iListBoxExt->iLastDownTappedItem )
  5465                     else if ( itemIndex == iListBoxExt->iLastDownTappedItem )
  5419                         {
  5466                         {
  6593     	 iListBoxExt->iSingleClickEnabled && 
  6640     	 iListBoxExt->iSingleClickEnabled && 
  6594     	 iItemDrawer )
  6641     	 iItemDrawer )
  6595         {
  6642         {
  6596         iListBoxExt->DisableSingleClick(); 
  6643         iListBoxExt->DisableSingleClick(); 
  6597         iItemDrawer->ClearFlags( CListItemDrawer::ESingleClickEnabled);
  6644         iItemDrawer->ClearFlags( CListItemDrawer::ESingleClickEnabled);
       
  6645         }
       
  6646     else if ( !aDisabled &&
       
  6647               iListBoxExt &&
       
  6648               !iListBoxExt->iSingleClickEnabled &&
       
  6649               iItemDrawer )
       
  6650         {
       
  6651         TRAP_IGNORE( iListBoxExt->EnableSingleClickL() );
       
  6652         iItemDrawer->SetFlags( CListItemDrawer::ESingleClickEnabled );
  6598         }
  6653         }
  6599     _AKNTRACE_FUNC_EXIT;
  6654     _AKNTRACE_FUNC_EXIT;
  6600     }
  6655     }
  6601 
  6656 
  6602 
  6657