uifw/EikStd/coctlsrc/EIKLBX.CPP
branchRCL_3
changeset 51 fcdfafb36fe7
parent 50 a1caeb42b3a3
child 55 aecbbf00d063
equal deleted inserted replaced
50:a1caeb42b3a3 51:fcdfafb36fe7
  1044         TUint aExtensionId, TAny*& a0, TAny* /*a1*/ )
  1044         TUint aExtensionId, TAny*& a0, TAny* /*a1*/ )
  1045     {
  1045     {
  1046     if ( aExtensionId == MAknMarkingCollection::TYPE )
  1046     if ( aExtensionId == MAknMarkingCollection::TYPE )
  1047         {
  1047         {
  1048         a0 = static_cast<MAknMarkingCollection*>( this );
  1048         a0 = static_cast<MAknMarkingCollection*>( this );
  1049         }
  1049         return KErrNone;
  1050 
  1050         }
  1051     return KErrNone;
  1051 
       
  1052     return KErrNotFound;
  1052     }
  1053     }
  1053 
  1054 
  1054 
  1055 
  1055 // -----------------------------------------------------------------------------
  1056 // -----------------------------------------------------------------------------
  1056 // CListBoxExt::SetMultipleMarkingState
  1057 // CListBoxExt::SetMultipleMarkingState
  1113         {
  1114         {
  1114         TInt index = iListBox.CurrentItemIndex();
  1115         TInt index = iListBox.CurrentItemIndex();
  1115         if ( index >= 0 && 
  1116         if ( index >= 0 && 
  1116                 !iListBox.iItemDrawer->Properties( index ).IsSelectionHidden() )
  1117                 !iListBox.iItemDrawer->Properties( index ).IsSelectionHidden() )
  1117             {
  1118             {
  1118             iListBox.View()->SelectItemL( iListBox.CurrentItemIndex() );
  1119             iListBox.View()->SelectItemL( index );
  1119             }
  1120             }
  1120         }
  1121         }
  1121     _AKNTRACE_FUNC_EXIT;
  1122     _AKNTRACE_FUNC_EXIT;
  1122     }
  1123     }
  1123 
  1124 
  1127 // -----------------------------------------------------------------------------
  1128 // -----------------------------------------------------------------------------
  1128 //
  1129 //
  1129 void CListBoxExt::MarkAllL()
  1130 void CListBoxExt::MarkAllL()
  1130     {
  1131     {
  1131     _AKNTRACE_FUNC_ENTER;
  1132     _AKNTRACE_FUNC_ENTER;
  1132 
  1133     
  1133     if ( iListBox.MarkingMode() )
  1134     if ( iListBox.MarkingMode() && 
  1134         {       
  1135             iListBox.Model()->NumberOfItems() > 0 )
  1135         for ( TInt i = 0; i < iListBox.Model()->NumberOfItems(); ++i )
  1136         {               
  1136             {
  1137         iListBox.View()->SelectAllL( ETrue );   
  1137             if ( !iListBox.iItemDrawer->Properties( i ).IsSelectionHidden() )
       
  1138                 {
       
  1139                 iListBox.View()->SelectItemL( i );
       
  1140                 }
       
  1141             }
       
  1142         }
  1138         }
  1143     _AKNTRACE_FUNC_EXIT;
  1139     _AKNTRACE_FUNC_EXIT;
  1144     }
  1140     }
  1145 
  1141 
  1146 
  1142 
  1188     {
  1184     {
  1189     _AKNTRACE_FUNC_ENTER;
  1185     _AKNTRACE_FUNC_ENTER;
  1190     iLongTappedItem = iLastDownTappedItem;
  1186     iLongTappedItem = iLastDownTappedItem;
  1191     iLastDownTappedItem = KErrNotFound;
  1187     iLastDownTappedItem = KErrNotFound;
  1192     iItemActionMenu->ShowMenuL( aPenEventScreenLocation, 0 );
  1188     iItemActionMenu->ShowMenuL( aPenEventScreenLocation, 0 );
  1193     IgnorePointerEventsUntilUp();
       
  1194     iOldWinPos = iListBox.DrawableWindow()->OrdinalPosition();
  1189     iOldWinPos = iListBox.DrawableWindow()->OrdinalPosition();
  1195     _AKNTRACE_FUNC_EXIT;
  1190     _AKNTRACE_FUNC_EXIT;
  1196     }
  1191     }
  1197 
  1192 
  1198 
  1193 
  3419     UpdateScrollBarsL();
  3414     UpdateScrollBarsL();
  3420     UpdateScrollBarThumbs();
  3415     UpdateScrollBarThumbs();
  3421     iView->ClearFlags(CListBoxView::EItemCountModified);
  3416     iView->ClearFlags(CListBoxView::EItemCountModified);
  3422 
  3417 
  3423 
  3418 
  3424     if ( iListBoxExt && iListBoxExt->iLongTappedItem != KErrNotFound )
  3419     if ( iListBoxExt->iItemActionMenu &&
  3425         {
  3420          iListBoxExt->iLongTappedItem != KErrNotFound )
  3426         iListBoxExt->EnableHighlight( EFalse );
  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();
  3427         }
  3426         }
  3428 
  3427 
  3429     FireItemChange();
  3428     FireItemChange();
  3430     
  3429     
  3431     if ( iListBoxExt && iListBoxExt->iPhysics )
  3430     if ( iListBoxExt && iListBoxExt->iPhysics )
  3506 
  3505 
  3507 EXPORT_C void CEikListBox::HandleItemAdditionL()
  3506 EXPORT_C void CEikListBox::HandleItemAdditionL()
  3508     {
  3507     {
  3509     _AKNTRACE_FUNC_ENTER;
  3508     _AKNTRACE_FUNC_ENTER;
  3510     __ASSERT_DEBUG( iView, Panic( EEikPanicListBoxNoView ) );
  3509     __ASSERT_DEBUG( iView, Panic( EEikPanicListBoxNoView ) );
  3511     //fix the bug EGGO-7SQA4S and EVSG-7TD9WZ     
  3510 
  3512     TInt curItemIndex = iView->CurrentItemIndex();
  3511     TInt curItemIndex = iView->CurrentItemIndex();
  3513     if(curItemIndex >= 0 && curItemIndex < iModel->NumberOfItems() )
  3512     if(curItemIndex >= 0 && curItemIndex < iModel->NumberOfItems() )
  3514       {
  3513       {
  3515       TInt newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( curItemIndex );
  3514       TInt newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( curItemIndex );
  3516       iView->SetTopItemIndex( newTopItemIndex );
  3515       iView->SetTopItemIndex( newTopItemIndex );
  3517       }
  3516       }
  3518     iView->SetFlags(CListBoxView::EItemCountModified);
  3517     iView->SetFlags(CListBoxView::EItemCountModified);
  3519     // following breaks lists in square layout, not needed in SERIES60?
  3518 
  3520     //iView->CalcDataWidth();
       
  3521     iView->CalcBottomItemIndex();
  3519     iView->CalcBottomItemIndex();
  3522     UpdateScrollBarsL();
  3520     UpdateScrollBarsL();
  3523     UpdateScrollBarThumbs();
  3521     UpdateScrollBarThumbs();
  3524     if (IsReadyToDraw()) DrawDeferred();
  3522     if (IsReadyToDraw()) DrawDeferred();
  3525     iView->ClearFlags(CListBoxView::EItemCountModified);
  3523     iView->ClearFlags(CListBoxView::EItemCountModified);
  3526 
  3524 
  3527     FireItemChange();
  3525     FireItemChange();
  3528     
  3526     
  3529     if ( iListBoxExt )
  3527     if ( iListBoxExt )
  3530         {    
  3528         {
  3531         iListBoxExt->CheckScrollBarVisibility();
  3529         iListBoxExt->CheckScrollBarVisibility();
  3532         // Physics engine world size needs to be updated here, otherwise aknphysics 
  3530         // Physics engine world size needs to be updated here, otherwise aknphysics 
  3533         // 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 
  3534         // 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
  3535         if ( iListBoxExt->iPhysics )
  3533         if ( iListBoxExt->iPhysics )
  3536             {
  3534             {
  3537             iListBoxExt->InitPhysicsL();
  3535             iListBoxExt->InitPhysicsL();
  3538             }
  3536             }
  3539         }     
  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 
  3540     _AKNTRACE_FUNC_EXIT;
  3548     _AKNTRACE_FUNC_EXIT;
  3541     }
  3549     }
  3542 
  3550 
  3543 EXPORT_C void CEikListBox::HandleItemRemovalL()
  3551 EXPORT_C void CEikListBox::HandleItemRemovalL()
  3544     {
  3552     {
  5155         {
  5163         {
  5156         case TPointerEvent::EButton1Down:
  5164         case TPointerEvent::EButton1Down:
  5157             _AKNTRACE("TPointerEvent::EButton1Down");
  5165             _AKNTRACE("TPointerEvent::EButton1Down");
  5158             // For drag outside listbox
  5166             // For drag outside listbox
  5159             iListBoxExt->iIsDownOnItem = pointerIsOverAnItem;
  5167             iListBoxExt->iIsDownOnItem = pointerIsOverAnItem;
  5160             iListBoxExt->iLastPoint = pointerPos;
  5168             iListBoxExt->iLastPoint = pointerPos;            
       
  5169 			iListBoxExt->iLongTappedItem = KErrNotFound;
  5161 
  5170 
  5162             // update index of the last down tapped item
  5171             // update index of the last down tapped item
  5163             iListBoxExt->iLastDownTappedItem = itemIndex;
  5172             iListBoxExt->iLastDownTappedItem = itemIndex;
  5164             iListBoxExt->iMarkableListShiftKeyPressed = EFalse; 
  5173             iListBoxExt->iMarkableListShiftKeyPressed = EFalse; 
  5165 
  5174 
  6887             }
  6896             }
  6888         }
  6897         }
  6889 
  6898 
  6890     TBool blockEvent = EFalse;
  6899     TBool blockEvent = EFalse;
  6891     
  6900     
  6892     TBool allowDragEvent( ( iListBoxFlags & ELeftDownInViewRect ) && !iListBoxExt->iScrollingDisabled );
  6901     // If tap down in listbox area, kinetic scrolling is enabled and style popup menu is not shown,
  6893 
  6902     // drag event is sent to listbox.
       
  6903     TBool allowDragEvent( ( iListBoxFlags & ELeftDownInViewRect ) 
       
  6904             && !iListBoxExt->iScrollingDisabled 
       
  6905             && ( iListBoxExt->iSingleClickEnabled 
       
  6906                     && iListBoxExt->iLongTappedItem == KErrNotFound ) );
  6894     
  6907     
  6895     switch ( aPointerEvent.iType )
  6908     switch ( aPointerEvent.iType )
  6896         {
  6909         {
  6897         case TPointerEvent::EButton1Down:
  6910         case TPointerEvent::EButton1Down:
  6898             {
  6911             {