1397 // |
1401 // |
1398 TBool CListBoxExt::MarkedItems() const |
1402 TBool CListBoxExt::MarkedItems() const |
1399 { |
1403 { |
1400 return ( iListBox.iListBoxFlags & CEikListBox::ES60StyleMarkable |
1404 return ( iListBox.iListBoxFlags & CEikListBox::ES60StyleMarkable |
1401 || iListBox.iListBoxFlags & CEikListBox::EMultipleSelection ) |
1405 || iListBox.iListBoxFlags & CEikListBox::EMultipleSelection ) |
1402 && iListBox.SelectionIndexes()->Count() > 0; |
1406 && iListBox.iView && iListBox.SelectionIndexes()->Count() > 0; |
1403 } |
1407 } |
1404 |
1408 |
1405 |
1409 |
1406 // ----------------------------------------------------------------------------- |
1410 // ----------------------------------------------------------------------------- |
1407 // CListBoxExt::IgnorePointerEventsUntilUp |
1411 // CListBoxExt::IgnorePointerEventsUntilUp |
1421 } |
1425 } |
1422 |
1426 |
1423 if ( windowOwningControl ) |
1427 if ( windowOwningControl ) |
1424 { |
1428 { |
1425 windowOwningControl->IgnoreEventsUntilNextPointerUp(); |
1429 windowOwningControl->IgnoreEventsUntilNextPointerUp(); |
1426 _AKNTRACE_FUNC_EXIT; |
1430 } |
1427 return ETrue; |
1431 _AKNTRACE_FUNC_EXIT; |
1428 } |
1432 return ( windowOwningControl != NULL ); |
1429 _AKNTRACE_FUNC_EXIT; |
|
1430 return EFalse; |
|
1431 } |
1433 } |
1432 |
1434 |
1433 |
1435 |
1434 // ----------------------------------------------------------------------------- |
1436 // ----------------------------------------------------------------------------- |
1435 // CListBoxExt::StartLongPressTimerL |
1437 // CListBoxExt::StartLongPressTimerL |
1801 void CListBoxExt::PhysicEmulationEnded() |
1803 void CListBoxExt::PhysicEmulationEnded() |
1802 { |
1804 { |
1803 _AKNTRACE_FUNC_ENTER; |
1805 _AKNTRACE_FUNC_ENTER; |
1804 if ( iScrolling ) |
1806 if ( iScrolling ) |
1805 { |
1807 { |
|
1808 // currently, this is the only way to fix ou1cimx1#375869 |
|
1809 // iViewPosision is changed but we can't provent that |
|
1810 if ( iListBox.iView->TopItemIndex() == 0 |
|
1811 && iListBox.iView->ItemOffsetInPixels() > 0 ) |
|
1812 { |
|
1813 iListBox.ScrollView( -iListBox.iView->ItemOffsetInPixels(), ETrue ); |
|
1814 } |
1806 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
1815 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
1807 iListBox.SuspendEffects( EFalse ); |
1816 iListBox.SuspendEffects( EFalse ); |
1808 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
1817 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
1809 TRAP_IGNORE( iListBox.ReportListBoxEventL( |
1818 TRAP_IGNORE( iListBox.ReportListBoxEventL( |
1810 MEikListBoxObserver::EEventFlickStopped ) ); |
1819 MEikListBoxObserver::EEventFlickStopped ) ); |
2340 { |
2349 { |
2341 _AKNTRACE_FUNC_ENTER; |
2350 _AKNTRACE_FUNC_ENTER; |
2342 iView->CalcBottomItemIndex(); |
2351 iView->CalcBottomItemIndex(); |
2343 iView->CalcDataWidth(); |
2352 iView->CalcDataWidth(); |
2344 TInt currentItemIndex = iView->CurrentItemIndex(); |
2353 TInt currentItemIndex = iView->CurrentItemIndex(); |
2345 |
2354 TInt totalItems = iModel->NumberOfItems(); |
|
2355 |
2346 if ( ItemExists(currentItemIndex) ) |
2356 if ( ItemExists(currentItemIndex) ) |
2347 { |
2357 { |
2348 TInt topItemIndex( iView->TopItemIndex() ); |
2358 TInt topItemIndex( iView->TopItemIndex() ); |
2349 TInt numberOfItems = iView->NumberOfItemsThatFitInRect( iView->ViewRect() ); |
2359 TInt numberOfItems = iView->NumberOfItemsThatFitInRect( iView->ViewRect() ); |
2350 TInt newTopItemIndex( KEikListBoxInvalidIndex ); |
2360 TInt newTopItemIndex( KEikListBoxInvalidIndex ); |
2356 { |
2366 { |
2357 if ( iListBoxExt && iListBoxExt->iSingleClickEnabled ) |
2367 if ( iListBoxExt && iListBoxExt->iSingleClickEnabled ) |
2358 { |
2368 { |
2359 TInt offset = (iListBoxExt->iWorldSize.iHeight / 2) |
2369 TInt offset = (iListBoxExt->iWorldSize.iHeight / 2) |
2360 - iListBoxExt->iViewPosition.iY; |
2370 - iListBoxExt->iViewPosition.iY; |
2361 TInt totalItems = iModel->NumberOfItems(); |
|
2362 TInt itemsInRect = |
2371 TInt itemsInRect = |
2363 iView->NumberOfItemsThatFitInRect( iView->ViewRect() ); |
2372 iView->NumberOfItemsThatFitInRect( iView->ViewRect() ); |
2364 |
2373 |
2365 if ( ( iListBoxExt->CollectionState() |
2374 if ( ( iListBoxExt->CollectionState() |
2366 & MAknCollection::EStateHighlightVisible ) |
2375 & MAknCollection::EStateHighlightVisible ) |
2380 newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex ); |
2389 newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex ); |
2381 } |
2390 } |
2382 } |
2391 } |
2383 else |
2392 else |
2384 { |
2393 { |
2385 // recalculates top index of list when mode be changed |
2394 // recalculates top index of list when mode be changed |
2386 TInt totalItems = iModel->NumberOfItems(); |
|
2387 if ( (totalItems - topItemIndex) < numberOfItems ) |
2395 if ( (totalItems - topItemIndex) < numberOfItems ) |
2388 { |
2396 { |
2389 newTopItemIndex = Max( 0, totalItems - numberOfItems ); |
2397 newTopItemIndex = Max( 0, totalItems - numberOfItems ); |
2390 } |
2398 } |
2391 } |
2399 } |
2392 |
2400 |
2393 if ( newTopItemIndex != KEikListBoxInvalidIndex ) |
2401 if ( newTopItemIndex > KEikListBoxInvalidIndex |
|
2402 && newTopItemIndex < totalItems ) |
2394 { |
2403 { |
2395 iView->SetTopItemIndex( newTopItemIndex ); |
2404 iView->SetTopItemIndex( newTopItemIndex ); |
2396 } |
2405 } |
2397 if ( iListBoxExt && iListBoxExt->iPhysics ) |
2406 if ( iListBoxExt && iListBoxExt->iPhysics ) |
2398 { |
2407 { |
5154 iListBoxExt->LongTapPointerEventL( aPointerEvent ); |
5163 iListBoxExt->LongTapPointerEventL( aPointerEvent ); |
5155 } |
5164 } |
5156 } |
5165 } |
5157 else |
5166 else |
5158 { |
5167 { |
|
5168 if( itemIndex == oldCurrentItemIndex ) |
|
5169 { |
|
5170 if( !( ( iListBoxFlags & EViewerFlag ) && |
|
5171 ( iListBoxFlags & EDisableItemSpecificMenu ) ) ) |
|
5172 { |
|
5173 iListBoxExt->ImmediateFeedback( |
|
5174 iListBoxExt->iFeedbackType, |
|
5175 TTouchFeedbackType( ETouchFeedbackVibra | |
|
5176 ETouchFeedbackAudio ), |
|
5177 aPointerEvent ); |
|
5178 } |
|
5179 } |
5159 ReportListBoxEventL( |
5180 ReportListBoxEventL( |
5160 MEikListBoxObserver::EEventPenDownOnItem ); |
5181 MEikListBoxObserver::EEventPenDownOnItem ); |
5161 } |
5182 } |
5162 } |
5183 } |
5163 else |
5184 else |
5322 } |
5343 } |
5323 break; |
5344 break; |
5324 |
5345 |
5325 case TPointerEvent::EButton1Up: |
5346 case TPointerEvent::EButton1Up: |
5326 _AKNTRACE("TPointerEvent::EButton1Up"); |
5347 _AKNTRACE("TPointerEvent::EButton1Up"); |
5327 if ( iListBoxExt->FeedbackEnabledOnUpEvent() && iListBoxExt->iClickEventsAllowed |
5348 if ( iListBoxExt->FeedbackEnabledOnUpEvent() && |
5328 && ( !( ( iListBoxFlags & EViewerFlag ) && |
5349 iListBoxExt->iClickEventsAllowed && |
5329 ( iListBoxFlags & EDisableItemSpecificMenu ) ) ) ) |
5350 ( !( ( iListBoxFlags & EViewerFlag ) && |
|
5351 ( iListBoxFlags & EDisableItemSpecificMenu ) ) )&& |
|
5352 ( iListBoxExt->iLastDownTappedItem == itemIndex ) && |
|
5353 (Buffer()->iPressedIndex != KEikListBoxInvalidIndex) && |
|
5354 itemIndex == iView->CurrentItemIndex() ) |
5330 { |
5355 { |
5331 TTouchLogicalFeedback fbType = ETouchFeedbackList; |
5356 TTouchLogicalFeedback fbType = ETouchFeedbackList; |
5332 if ( iListBoxFlags & ES60StyleMultiselection |
5357 if ( iListBoxFlags & ES60StyleMultiselection |
5333 || iListBoxFlags & EMultipleSelection ) |
5358 || iListBoxFlags & EMultipleSelection ) |
5334 { |
5359 { |
5401 return; |
5426 return; |
5402 } |
5427 } |
5403 } |
5428 } |
5404 // Due to the feature of capactior panel, the pointer position |
5429 // Due to the feature of capactior panel, the pointer position |
5405 // may change between pointer down and up during user click |
5430 // may change between pointer down and up during user click |
5406 // action. When the click position is between two items, the |
5431 // action. When the click position is between two items |
5407 // item index may change unwanted, so we make a threshold |
5432 // and flick or drag event is not performed, the item index may |
5408 // for this situation. |
5433 // change unwanted, so we make a threshold for this situation. |
5409 else if ( s60StyleMultiselection |
5434 else if ( s60StyleMultiselection && !Buffer()->iDragToAnotherItem |
5410 && ( iListBoxExt->iLastDownTappedItem == itemIndex |
5435 && ( iListBoxExt->iLastDownTappedItem == itemIndex |
5411 || Abs( iListBoxExt->iLastPointerPos.iY |
5436 || ( iListBoxExt->iLastDownTappedItem != KErrNotFound |
5412 - aPointerEvent.iPosition.iY ) < KPointerDownAndUpThreshold ) |
5437 && Abs( iListBoxExt->iLastPointerPos.iY - aPointerEvent.iPosition.iY ) < KPointerDownAndUpThreshold ) ) ) |
5413 && !Buffer()->iDragToAnotherItem ) |
|
5414 { |
5438 { |
5415 iListBoxFlags |= EStateChanged; |
5439 iListBoxFlags |= EStateChanged; |
5416 Buffer()->iPressedIndex = itemIndex; |
5440 Buffer()->iPressedIndex = itemIndex; |
5417 iView->SetAnchor(itemIndex-1); // zero indexed |
5441 iView->SetAnchor(itemIndex-1); // zero indexed |
5418 iView->UpdateSelectionL(selectionMode); |
5442 iView->UpdateSelectionL(selectionMode); |
6136 case KEikMessageFadeAllWindows: |
6160 case KEikMessageFadeAllWindows: |
6137 { |
6161 { |
6138 // Some client does not let list get button1up, so we do it there... |
6162 // Some client does not let list get button1up, so we do it there... |
6139 iItemDrawer->ClearFlags( CListItemDrawer::EPressedDownState ); |
6163 iItemDrawer->ClearFlags( CListItemDrawer::EPressedDownState ); |
6140 TInt index = View()->CurrentItemIndex(); |
6164 TInt index = View()->CurrentItemIndex(); |
6141 if ( index != KErrNotFound ) |
6165 TBool enabled( !( iItemDrawer->Flags() |
|
6166 & CListItemDrawer::ESingleClickDisabledHighlight ) ); |
|
6167 if ( index != KErrNotFound && enabled ) |
6142 { |
6168 { |
6143 Window().Invalidate( TRect( View()->ItemPos(index), |
6169 Window().Invalidate( TRect( View()->ItemPos(index), |
6144 View()->ItemSize() ) ); |
6170 iItemDrawer->ItemCellSize() ) ); |
6145 } |
6171 } |
6146 break; |
6172 break; |
6147 } |
6173 } |
6148 case KEikDynamicLayoutVariantSwitch: |
6174 case KEikDynamicLayoutVariantSwitch: |
6149 case KEikMessageColorSchemeChange: |
6175 case KEikMessageColorSchemeChange: |
6151 DrawDeferred(); |
6177 DrawDeferred(); |
6152 break; |
6178 break; |
6153 |
6179 |
6154 case KAknMessageFocusLost: |
6180 case KAknMessageFocusLost: |
6155 { |
6181 { |
6156 TInt oldWinPos = iListBoxExt->iOldWinPos; |
6182 // Do not remove highlight if window ordinal position has changed |
6157 TInt winPos = DrawableWindow()->OrdinalPosition(); |
|
6158 |
|
6159 // Do not remove higlight if window ordinal position has changed |
|
6160 // during the time when stylus menu is open |
6183 // during the time when stylus menu is open |
6161 if ( iListBoxExt && iListBoxExt->iSingleClickEnabled |
6184 if ( iListBoxExt && iListBoxExt->iSingleClickEnabled && |
6162 && ( oldWinPos == KErrNotFound || oldWinPos == winPos ) ) |
6185 ( iListBoxExt->iOldWinPos == KErrNotFound || |
|
6186 iListBoxExt->iOldWinPos == |
|
6187 DrawableWindow()->OrdinalPosition() ) ) |
6163 { |
6188 { |
6164 TBool enabled( iItemDrawer && !( iItemDrawer->Flags() |
6189 TBool enabled( iItemDrawer && !( iItemDrawer->Flags() |
6165 & CListItemDrawer::ESingleClickDisabledHighlight ) ); |
6190 & CListItemDrawer::ESingleClickDisabledHighlight ) ); |
6166 |
6191 |
6167 if ( enabled ) |
6192 if ( enabled ) |
6561 // --------------------------------------------------------------------------- |
6586 // --------------------------------------------------------------------------- |
6562 // |
6587 // |
6563 EXPORT_C void CEikListBox::DisableSingleClick( TBool aDisabled ) |
6588 EXPORT_C void CEikListBox::DisableSingleClick( TBool aDisabled ) |
6564 { |
6589 { |
6565 _AKNTRACE_FUNC_ENTER; |
6590 _AKNTRACE_FUNC_ENTER; |
6566 if ( aDisabled && iListBoxExt && iListBoxExt->iSingleClickEnabled ) |
6591 if ( aDisabled && |
|
6592 iListBoxExt && |
|
6593 iListBoxExt->iSingleClickEnabled && |
|
6594 iItemDrawer ) |
6567 { |
6595 { |
6568 iListBoxExt->DisableSingleClick(); |
6596 iListBoxExt->DisableSingleClick(); |
|
6597 iItemDrawer->ClearFlags( CListItemDrawer::ESingleClickEnabled); |
6569 } |
6598 } |
6570 _AKNTRACE_FUNC_EXIT; |
6599 _AKNTRACE_FUNC_EXIT; |
6571 } |
6600 } |
6572 |
6601 |
6573 |
6602 |