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 // |
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. |
680 |
734 |
681 /** |
735 /** |
682 * Item that opened the item action menu |
736 * Item that opened the item action menu |
683 */ |
737 */ |
684 TInt iLongTappedItem; |
738 TInt iLongTappedItem; |
|
739 |
|
740 /** |
|
741 * Marking mode on / off. |
|
742 */ |
|
743 TBool iMarkingModeInUse; |
|
744 |
|
745 /** |
|
746 * Marking mode observer. |
|
747 */ |
|
748 MAknMarkingModeObserver* iMarkingModeObserver; |
|
749 |
685 /** |
750 /** |
686 * Pointer event to be forwarded to the long tap detector upon |
751 * Pointer event to be forwarded to the long tap detector upon |
687 * highlight timer completion. |
752 * highlight timer completion. |
688 */ |
753 */ |
689 TPointerEvent iDelayedPointerDownEvent; |
754 TPointerEvent iDelayedPointerDownEvent; |
|
755 |
|
756 /** |
|
757 * Ordinal position of listbox window, before stylus menu is opened. |
|
758 */ |
|
759 TInt iOldWinPos; |
690 |
760 |
691 private: |
761 private: |
692 CMatchBuffer* iBuffer; |
762 CMatchBuffer* iBuffer; |
693 CEikListBox& iListBox; |
763 CEikListBox& iListBox; |
694 CEikListBox::TReasonForFocusLost iReasonForFocusLost; |
764 CEikListBox::TReasonForFocusLost iReasonForFocusLost; |
943 if ( iLongTappedItem != KErrNotFound ) |
1014 if ( iLongTappedItem != KErrNotFound ) |
944 { |
1015 { |
945 EnableHighlight( EFalse ); |
1016 EnableHighlight( EFalse ); |
946 iListBox.iView->DrawItem( iLongTappedItem ); |
1017 iListBox.iView->DrawItem( iLongTappedItem ); |
947 iLongTappedItem = KErrNotFound; |
1018 iLongTappedItem = KErrNotFound; |
|
1019 iOldWinPos = KErrNotFound; |
948 } |
1020 } |
949 } |
1021 } |
950 |
1022 |
951 |
1023 |
952 // ----------------------------------------------------------------------------- |
1024 // ----------------------------------------------------------------------------- |
953 // CListBoxExt::CollectionExtension |
1025 // CListBoxExt::CollectionExtension |
954 // ----------------------------------------------------------------------------- |
1026 // ----------------------------------------------------------------------------- |
955 // |
1027 // |
956 TInt CListBoxExt::CollectionExtension( |
1028 TInt CListBoxExt::CollectionExtension( |
957 TUint /*aExtensionId*/, TAny*& /*a0*/, TAny* /*a1*/ ) |
1029 TUint aExtensionId, TAny*& a0, TAny* /*a1*/ ) |
958 { |
1030 { |
|
1031 if ( aExtensionId == MAknMarkingCollection::TYPE ) |
|
1032 { |
|
1033 a0 = static_cast<MAknMarkingCollection*>( this ); |
|
1034 } |
|
1035 |
959 return KErrNone; |
1036 return KErrNone; |
|
1037 } |
|
1038 |
|
1039 |
|
1040 // ----------------------------------------------------------------------------- |
|
1041 // CListBoxExt::SetMultipleMarkingState |
|
1042 // ----------------------------------------------------------------------------- |
|
1043 // |
|
1044 void CListBoxExt::SetMultipleMarkingState( TBool aActive ) |
|
1045 { |
|
1046 _AKNTRACE_FUNC_ENTER; |
|
1047 iListBox.SetMarkingMode( aActive ); |
|
1048 _AKNTRACE_FUNC_EXIT; |
|
1049 } |
|
1050 |
|
1051 // ----------------------------------------------------------------------------- |
|
1052 // CListBoxExt::ExitMarkingMode |
|
1053 // ----------------------------------------------------------------------------- |
|
1054 // |
|
1055 TBool CListBoxExt::ExitMarkingMode() |
|
1056 { |
|
1057 if ( iListBox.MarkingModeObserver() ) |
|
1058 { |
|
1059 return iListBox.MarkingModeObserver()->ExitMarkingMode(); |
|
1060 } |
|
1061 return ETrue; |
|
1062 } |
|
1063 |
|
1064 // ----------------------------------------------------------------------------- |
|
1065 // CListBoxExt::MarkingState |
|
1066 // ----------------------------------------------------------------------------- |
|
1067 // |
|
1068 TUint CListBoxExt::MarkingState() const |
|
1069 { |
|
1070 _AKNTRACE_FUNC_ENTER; |
|
1071 TUint state( 0 ); |
|
1072 if ( iListBox.MarkingMode() ) |
|
1073 { |
|
1074 state |= MAknMarkingCollection::EStateMarkingMode; |
|
1075 if ( MarkedItems() ) |
|
1076 { |
|
1077 state |= MAknMarkingCollection::EStateMarkedItems; |
|
1078 } |
|
1079 if ( iListBox.Model()->NumberOfItems() == 0 ) |
|
1080 { |
|
1081 state |= MAknMarkingCollection::EStateCollectionEmpty; |
|
1082 } |
|
1083 } |
|
1084 _AKNTRACE_FUNC_EXIT; |
|
1085 return state; |
|
1086 } |
|
1087 |
|
1088 |
|
1089 // ----------------------------------------------------------------------------- |
|
1090 // CListBoxExt::MarkCurrentItemL |
|
1091 // ----------------------------------------------------------------------------- |
|
1092 // |
|
1093 void CListBoxExt::MarkCurrentItemL() |
|
1094 { |
|
1095 _AKNTRACE_FUNC_ENTER; |
|
1096 |
|
1097 if ( iListBox.MarkingMode() ) |
|
1098 { |
|
1099 TInt index = iListBox.CurrentItemIndex(); |
|
1100 if ( index >= 0 && |
|
1101 !iListBox.iItemDrawer->Properties( index ).IsSelectionHidden() ) |
|
1102 { |
|
1103 iListBox.View()->SelectItemL( iListBox.CurrentItemIndex() ); |
|
1104 } |
|
1105 } |
|
1106 _AKNTRACE_FUNC_EXIT; |
|
1107 } |
|
1108 |
|
1109 |
|
1110 // ----------------------------------------------------------------------------- |
|
1111 // CListBoxExt::MarkAllL |
|
1112 // ----------------------------------------------------------------------------- |
|
1113 // |
|
1114 void CListBoxExt::MarkAllL() |
|
1115 { |
|
1116 _AKNTRACE_FUNC_ENTER; |
|
1117 |
|
1118 if ( iListBox.MarkingMode() ) |
|
1119 { |
|
1120 for ( TInt i = 0; i < iListBox.Model()->NumberOfItems(); ++i ) |
|
1121 { |
|
1122 if ( !iListBox.iItemDrawer->Properties( i ).IsSelectionHidden() ) |
|
1123 { |
|
1124 iListBox.View()->SelectItemL( i ); |
|
1125 } |
|
1126 } |
|
1127 } |
|
1128 _AKNTRACE_FUNC_EXIT; |
|
1129 } |
|
1130 |
|
1131 |
|
1132 // ----------------------------------------------------------------------------- |
|
1133 // CListBoxExt::UnmarkAll |
|
1134 // ----------------------------------------------------------------------------- |
|
1135 // |
|
1136 void CListBoxExt::UnmarkAll() |
|
1137 { |
|
1138 _AKNTRACE_FUNC_ENTER; |
|
1139 |
|
1140 if ( iListBox.MarkingMode() ) |
|
1141 { |
|
1142 iListBox.View()->ClearSelection(); |
|
1143 } |
|
1144 |
|
1145 _AKNTRACE_FUNC_EXIT; |
|
1146 } |
|
1147 |
|
1148 // ----------------------------------------------------------------------------- |
|
1149 // CListBoxExt::CurrentItemMarkable |
|
1150 // ----------------------------------------------------------------------------- |
|
1151 // |
|
1152 TBool CListBoxExt::CurrentItemMarkable() |
|
1153 { |
|
1154 _AKNTRACE_FUNC_ENTER; |
|
1155 TBool itemCanBeMarked = ETrue; |
|
1156 TInt index = iListBox.CurrentItemIndex(); |
|
1157 if ( index >= 0 && |
|
1158 iListBox.iItemDrawer->Properties( index ).IsSelectionHidden() ) |
|
1159 { |
|
1160 itemCanBeMarked = EFalse; |
|
1161 } |
|
1162 _AKNTRACE_FUNC_EXIT; |
|
1163 return itemCanBeMarked; |
960 } |
1164 } |
961 |
1165 |
962 |
1166 |
963 // --------------------------------------------------------------------------- |
1167 // --------------------------------------------------------------------------- |
964 // CListBoxExt::HandleLongTapEventL |
1168 // CListBoxExt::HandleLongTapEventL |
1033 _AKNTRACE_FUNC_ENTER; |
1239 _AKNTRACE_FUNC_ENTER; |
1034 EnableHighlight( ETrue ); |
1240 EnableHighlight( ETrue ); |
1035 |
1241 |
1036 if ( iListBox.iView->ViewRect() != TRect() ) |
1242 if ( iListBox.iView->ViewRect() != TRect() ) |
1037 { |
1243 { |
1038 TInt topItemIndex = iListBox.iView->TopItemIndex(); |
1244 // Set current item index highlighted if it is visible, otherwise |
1039 if ( iListBox.iView->ItemIsPartiallyVisible( topItemIndex) ) |
1245 // the first visible index |
1040 { |
1246 TInt index = iListBox.iView->CurrentItemIndex(); |
1041 topItemIndex++; |
1247 if ( !iListBox.iView->ItemIsVisible( index ) ) |
1042 } |
1248 { |
1043 TRAP_IGNORE( iListBox.UpdateHighlightL( topItemIndex ) ); |
1249 index = iListBox.iView->TopItemIndex(); |
|
1250 if ( iListBox.iView->ItemIsPartiallyVisible( index ) ) |
|
1251 { |
|
1252 index++; |
|
1253 } |
|
1254 } |
|
1255 TRAP_IGNORE( iListBox.UpdateHighlightL( index ) ); |
1044 } |
1256 } |
1045 |
1257 |
1046 DisableItemSpecificMenu(); |
1258 DisableItemSpecificMenu(); |
1047 if ( iItemActionMenu ) |
1259 if ( iItemActionMenu ) |
1048 { |
1260 { |
1069 iListBox.iListBoxFlags |= CEikListBox::EDisableItemSpecificMenu; |
1281 iListBox.iListBoxFlags |= CEikListBox::EDisableItemSpecificMenu; |
1070 |
1282 |
1071 _AKNTRACE_FUNC_EXIT; |
1283 _AKNTRACE_FUNC_EXIT; |
1072 } |
1284 } |
1073 |
1285 |
|
1286 |
1074 // ----------------------------------------------------------------------------- |
1287 // ----------------------------------------------------------------------------- |
1075 // CListBoxExt::LongTapPointerEventL |
1288 // CListBoxExt::LongTapPointerEventL |
1076 // ----------------------------------------------------------------------------- |
1289 // ----------------------------------------------------------------------------- |
1077 // |
1290 // |
1078 void CListBoxExt::LongTapPointerEventL( const TPointerEvent& aPointerEvent ) |
1291 void CListBoxExt::LongTapPointerEventL( const TPointerEvent& aPointerEvent ) |
1079 { |
1292 { |
1080 if ( iSingleClickEnabled && iLongTapDetector && iItemActionMenu ) |
1293 if ( iSingleClickEnabled && iLongTapDetector && iItemActionMenu ) |
1081 { |
1294 { |
1082 // Send event on down only if item specific items were found and current |
1295 // Send event on down only if item specific items were found. |
1083 // item is marked if there are marked items |
1296 // Long tap is also disabled if current item is not marked while |
1084 if ( !( MarkedItems() && |
1297 // there are some marked items or marking mode is active. |
1085 !iListBox.View()->ItemIsSelected( iListBox.CurrentItemIndex() ) ) |
1298 if ( !( ( iListBox.MarkingMode() || MarkedItems() ) |
1086 && ( aPointerEvent.iType != TPointerEvent::EButton1Down |
1299 && !iListBox.View()->ItemIsSelected( iListBox.CurrentItemIndex() ) ) |
1087 || iItemActionMenu->InitMenuL() ) ) |
1300 && ( aPointerEvent.iType != TPointerEvent::EButton1Down |
|
1301 || iItemActionMenu->InitMenuL() ) ) |
1088 { |
1302 { |
1089 iLongTapDetector->PointerEventL ( aPointerEvent ); |
1303 iLongTapDetector->PointerEventL ( aPointerEvent ); |
1090 } |
1304 } |
1091 } |
1305 } |
1092 } |
1306 } |
1188 && iListBox.SelectionIndexes()->Count() > 0; |
1402 && iListBox.SelectionIndexes()->Count() > 0; |
1189 } |
1403 } |
1190 |
1404 |
1191 |
1405 |
1192 // ----------------------------------------------------------------------------- |
1406 // ----------------------------------------------------------------------------- |
|
1407 // CListBoxExt::IgnorePointerEventsUntilUp |
|
1408 // ----------------------------------------------------------------------------- |
|
1409 // |
|
1410 TBool CListBoxExt::IgnorePointerEventsUntilUp() |
|
1411 { |
|
1412 _AKNTRACE_FUNC_ENTER; |
|
1413 |
|
1414 // Pointer event ignore must be done for the window-owning |
|
1415 // control or it doesn't have any effect! |
|
1416 CCoeControl* windowOwningControl = &iListBox; |
|
1417 |
|
1418 while ( windowOwningControl && !windowOwningControl->OwnsWindow() ) |
|
1419 { |
|
1420 windowOwningControl = windowOwningControl->Parent(); |
|
1421 } |
|
1422 |
|
1423 if ( windowOwningControl ) |
|
1424 { |
|
1425 windowOwningControl->IgnoreEventsUntilNextPointerUp(); |
|
1426 _AKNTRACE_FUNC_EXIT; |
|
1427 return ETrue; |
|
1428 } |
|
1429 _AKNTRACE_FUNC_EXIT; |
|
1430 return EFalse; |
|
1431 } |
|
1432 |
|
1433 |
|
1434 // ----------------------------------------------------------------------------- |
1193 // CListBoxExt::StartLongPressTimerL |
1435 // CListBoxExt::StartLongPressTimerL |
1194 // ----------------------------------------------------------------------------- |
1436 // ----------------------------------------------------------------------------- |
1195 // |
1437 // |
1196 void CListBoxExt::StartLongPressTimerL() |
1438 void CListBoxExt::StartLongPressTimerL() |
1197 { |
1439 { |
1715 } |
1957 } |
1716 _AKNTRACE_FUNC_EXIT; |
1958 _AKNTRACE_FUNC_EXIT; |
1717 } |
1959 } |
1718 |
1960 |
1719 // --------------------------------------------------------------------------- |
1961 // --------------------------------------------------------------------------- |
1720 // CListBoxExt::FeedbackEnabledOnUpEvent |
1962 // Checks whether or not tactile feedback should be given on a pointer |
|
1963 // up event. |
1721 // --------------------------------------------------------------------------- |
1964 // --------------------------------------------------------------------------- |
1722 // |
1965 // |
1723 TBool CListBoxExt::FeedbackEnabledOnUpEvent() |
1966 TBool CListBoxExt::FeedbackEnabledOnUpEvent() |
1724 { |
1967 { |
1725 _AKNTRACE_FUNC_ENTER; |
1968 _AKNTRACE_FUNC_ENTER; |
1726 TBool enabled( EFalse ); |
1969 TBool enabled( EFalse ); |
1727 |
1970 |
|
1971 // As there's no pressed down highlight in single click enabled lists, |
|
1972 // the iLastDownTappedItem is used to track whether or not the pointer |
|
1973 // up event happened inside the same list item as the pointer down event. |
|
1974 // Feedback should not be given if the pointer up is received outside of |
|
1975 // the item that received the pointer down event, or in cases when the |
|
1976 // list has been dragged or flicked between the pointer down and pointer |
|
1977 // up events. |
1728 if ( ( iListBox.iItemDrawer->Flags() & CListItemDrawer::EPressedDownState |
1978 if ( ( iListBox.iItemDrawer->Flags() & CListItemDrawer::EPressedDownState |
1729 || iSingleClickEnabled ) && !iFlickStopped ) |
1979 || ( iSingleClickEnabled && iLastDownTappedItem != KErrNotFound ) ) && |
|
1980 !iFlickStopped ) |
1730 { |
1981 { |
1731 enabled = ETrue; |
1982 enabled = ETrue; |
1732 } |
1983 } |
|
1984 |
1733 _AKNTRACE_FUNC_EXIT; |
1985 _AKNTRACE_FUNC_EXIT; |
1734 return enabled; |
1986 return enabled; |
1735 } |
1987 } |
1736 |
1988 |
1737 // --------------------------------------------------------------------------- |
1989 // --------------------------------------------------------------------------- |
2102 || iListBoxExt && iListBoxExt->iPhysics |
2354 || iListBoxExt && iListBoxExt->iPhysics |
2103 && currentItemIndex == ( topItemIndex + numberOfItems - 1 ) ) |
2355 && currentItemIndex == ( topItemIndex + numberOfItems - 1 ) ) |
2104 { |
2356 { |
2105 if ( iListBoxExt && iListBoxExt->iSingleClickEnabled ) |
2357 if ( iListBoxExt && iListBoxExt->iSingleClickEnabled ) |
2106 { |
2358 { |
2107 // If single click is enabled, highlight must also be visible |
2359 TInt offset = (iListBoxExt->iWorldSize.iHeight / 2) |
2108 if ( iListBoxExt->CollectionState() |
2360 - iListBoxExt->iViewPosition.iY; |
|
2361 TInt totalItems = iModel->NumberOfItems(); |
|
2362 TInt itemsInRect = |
|
2363 iView->NumberOfItemsThatFitInRect( iView->ViewRect() ); |
|
2364 |
|
2365 if ( ( iListBoxExt->CollectionState() |
2109 & MAknCollection::EStateHighlightVisible ) |
2366 & MAknCollection::EStateHighlightVisible ) |
|
2367 || ( ItemsInSingleLine() |
|
2368 && ( totalItems <= itemsInRect ) |
|
2369 && ( offset != 0 ) ) ) |
2110 { |
2370 { |
2111 newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex ); |
2371 newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex ); |
2112 } |
2372 } |
|
2373 else |
|
2374 { |
|
2375 newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( topItemIndex ); |
|
2376 } |
2113 } |
2377 } |
2114 else |
2378 else |
2115 { |
2379 { |
2116 newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex ); |
2380 newTopItemIndex = iView->CalcNewTopItemIndexSoItemIsVisible( currentItemIndex ); |
2117 } |
2381 } |
4853 iListBoxExt->EnableHighlight( ETrue, ETrue ); |
5135 iListBoxExt->EnableHighlight( ETrue, ETrue ); |
4854 UpdateHighlightL( itemIndex ); |
5136 UpdateHighlightL( itemIndex ); |
4855 CCoeEnv::Static()->WsSession().Finish(); |
5137 CCoeEnv::Static()->WsSession().Finish(); |
4856 } |
5138 } |
4857 |
5139 |
4858 iListBoxExt->ImmediateFeedback( |
5140 if ( !( ( iListBoxFlags & EViewerFlag ) && |
4859 iListBoxExt->iFeedbackType, |
5141 ( iListBoxFlags & EDisableItemSpecificMenu ) ) ) |
4860 TTouchFeedbackType( ETouchFeedbackVibra | |
5142 { |
4861 ETouchFeedbackAudio ), |
5143 iListBoxExt->ImmediateFeedback( |
4862 aPointerEvent ); |
5144 iListBoxExt->iFeedbackType, |
|
5145 TTouchFeedbackType( ETouchFeedbackVibra | |
|
5146 ETouchFeedbackAudio ), |
|
5147 aPointerEvent ); |
|
5148 } |
4863 |
5149 |
4864 if ( !wasFlicking ) |
5150 if ( !wasFlicking ) |
4865 { |
5151 { |
4866 ReportListBoxEventL( |
5152 ReportListBoxEventL( |
4867 MEikListBoxObserver::EEventPenDownOnItem ); |
5153 MEikListBoxObserver::EEventPenDownOnItem ); |
5035 } |
5322 } |
5036 break; |
5323 break; |
5037 |
5324 |
5038 case TPointerEvent::EButton1Up: |
5325 case TPointerEvent::EButton1Up: |
5039 _AKNTRACE("TPointerEvent::EButton1Up"); |
5326 _AKNTRACE("TPointerEvent::EButton1Up"); |
5040 if ( iListBoxExt->FeedbackEnabledOnUpEvent() && iListBoxExt->iClickEventsAllowed ) |
5327 if ( iListBoxExt->FeedbackEnabledOnUpEvent() && iListBoxExt->iClickEventsAllowed |
|
5328 && ( !( ( iListBoxFlags & EViewerFlag ) && |
|
5329 ( iListBoxFlags & EDisableItemSpecificMenu ) ) ) ) |
5041 { |
5330 { |
5042 TTouchLogicalFeedback fbType = ETouchFeedbackList; |
5331 TTouchLogicalFeedback fbType = ETouchFeedbackList; |
5043 if ( iListBoxFlags & ES60StyleMultiselection ) |
5332 if ( iListBoxFlags & ES60StyleMultiselection |
|
5333 || iListBoxFlags & EMultipleSelection ) |
5044 { |
5334 { |
5045 fbType = ETouchFeedbackCheckbox; |
5335 fbType = ETouchFeedbackCheckbox; |
5046 } |
5336 } |
5047 iListBoxExt->ImmediateFeedback( fbType, |
5337 iListBoxExt->ImmediateFeedback( fbType, |
5048 ETouchFeedbackVibra, |
5338 ETouchFeedbackVibra, |
5109 MEikListBoxObserver::EEventItemSingleClicked ); |
5399 MEikListBoxObserver::EEventItemSingleClicked ); |
5110 _AKNTRACE_FUNC_EXIT; |
5400 _AKNTRACE_FUNC_EXIT; |
5111 return; |
5401 return; |
5112 } |
5402 } |
5113 } |
5403 } |
5114 else if ( s60StyleMultiselection && |
5404 // Due to the feature of capactior panel, the pointer position |
5115 iListBoxExt->iLastDownTappedItem == itemIndex && |
5405 // may change between pointer down and up during user click |
5116 !Buffer()->iDragToAnotherItem ) |
5406 // action. When the click position is between two items, the |
|
5407 // item index may change unwanted, so we make a threshold |
|
5408 // for this situation. |
|
5409 else if ( s60StyleMultiselection |
|
5410 && ( iListBoxExt->iLastDownTappedItem == itemIndex |
|
5411 || Abs( iListBoxExt->iLastPointerPos.iY |
|
5412 - aPointerEvent.iPosition.iY ) < KPointerDownAndUpThreshold ) |
|
5413 && !Buffer()->iDragToAnotherItem ) |
5117 { |
5414 { |
5118 iListBoxFlags |= EStateChanged; |
5415 iListBoxFlags |= EStateChanged; |
5119 Buffer()->iPressedIndex = itemIndex; |
5416 Buffer()->iPressedIndex = itemIndex; |
5120 iView->SetAnchor(itemIndex-1); // zero indexed |
5417 iView->SetAnchor(itemIndex-1); // zero indexed |
5121 iView->UpdateSelectionL(selectionMode); |
5418 iView->UpdateSelectionL(selectionMode); |
5791 } |
6091 } |
5792 iBackColor=iEikonEnv->ControlColor(IsDimmed() ? |
6092 iBackColor=iEikonEnv->ControlColor(IsDimmed() ? |
5793 EColorControlDimmedBackground : EColorControlBackground,*this); |
6093 EColorControlDimmedBackground : EColorControlBackground,*this); |
5794 UpdateViewColors(); |
6094 UpdateViewColors(); |
5795 UpdateItemDrawerColors(); |
6095 UpdateItemDrawerColors(); |
5796 |
6096 |
|
6097 // store the value of virtical offset as it will be 0 in SizeChange, |
|
6098 // that will affect view position in skin changed, which is a bug. |
|
6099 TInt oldOffset = 0; |
|
6100 if ( iView ) |
|
6101 { |
|
6102 oldOffset = iView->ItemOffsetInPixels(); |
|
6103 } |
|
6104 // TODO: check if this call is real need here. |
5797 SizeChanged(); |
6105 SizeChanged(); |
|
6106 if ( oldOffset !=0 && iView ) |
|
6107 { |
|
6108 iView->SetItemOffsetInPixels( oldOffset ); |
|
6109 UpdateScrollBarThumbs(); |
|
6110 } |
|
6111 // this methord is empty. |
5798 UpdateScrollBarsColors(); |
6112 UpdateScrollBarsColors(); |
5799 |
6113 |
5800 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
6114 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
5801 if ( transApi ) |
6115 if ( transApi ) |
5802 { |
6116 { |
6286 } |
6606 } |
6287 } |
6607 } |
6288 _AKNTRACE_FUNC_EXIT; |
6608 _AKNTRACE_FUNC_EXIT; |
6289 return enabled; |
6609 return enabled; |
6290 } |
6610 } |
|
6611 |
|
6612 |
|
6613 // --------------------------------------------------------------------------- |
|
6614 // CEikListBox::SetMarkingMode |
|
6615 // --------------------------------------------------------------------------- |
|
6616 // |
|
6617 EXPORT_C void CEikListBox::SetMarkingMode( TBool aEnable ) |
|
6618 { |
|
6619 if ( iListBoxExt && iListBoxExt->iSingleClickEnabled && |
|
6620 ( iListBoxFlags & CEikListBox::ES60StyleMarkable ) ) |
|
6621 { |
|
6622 if ( iListBoxExt->iMarkingModeInUse != aEnable ) |
|
6623 { |
|
6624 if ( aEnable ) |
|
6625 { |
|
6626 iView->ItemDrawer()->SetFlags( |
|
6627 CListItemDrawer::EMarkingModeEnabled ); |
|
6628 } |
|
6629 else |
|
6630 { |
|
6631 iView->ItemDrawer()->ClearFlags( |
|
6632 CListItemDrawer::EMarkingModeEnabled ); |
|
6633 |
|
6634 if ( iView->SelectionIndexes()->Count() > 0 ) |
|
6635 { |
|
6636 iView->ClearSelection( EFalse ); |
|
6637 } |
|
6638 } |
|
6639 |
|
6640 iListBoxExt->iMarkingModeInUse = aEnable; |
|
6641 DrawDeferred(); |
|
6642 } |
|
6643 |
|
6644 if ( MarkingModeObserver() ) |
|
6645 { |
|
6646 MarkingModeObserver()->MarkingModeStatusChanged( aEnable ); |
|
6647 } |
|
6648 } |
|
6649 } |
|
6650 |
|
6651 |
|
6652 // --------------------------------------------------------------------------- |
|
6653 // CEikListBox::SetMarkingModeObserver |
|
6654 // --------------------------------------------------------------------------- |
|
6655 // |
|
6656 EXPORT_C void CEikListBox::SetMarkingModeObserver( |
|
6657 MAknMarkingModeObserver* aObserver ) |
|
6658 { |
|
6659 if ( iListBoxExt ) |
|
6660 { |
|
6661 iListBoxExt->iMarkingModeObserver = aObserver; |
|
6662 } |
|
6663 } |
|
6664 |
6291 |
6665 |
6292 void CEikListBox::ScrollView( const TInt aOffset, TBool aDrawNow ) |
6666 void CEikListBox::ScrollView( const TInt aOffset, TBool aDrawNow ) |
6293 { |
6667 { |
6294 _AKNTRACE_FUNC_ENTER; |
6668 _AKNTRACE_FUNC_ENTER; |
6295 #ifdef _DEBUG |
6669 #ifdef _DEBUG |
6363 #ifdef _DEBUG |
6737 #ifdef _DEBUG |
6364 RDebug::Print( _L( "CEikListBox::ScrollView, newTopItemIndex = %d" ), newTopItemIndex ); |
6738 RDebug::Print( _L( "CEikListBox::ScrollView, newTopItemIndex = %d" ), newTopItemIndex ); |
6365 #endif // _DEBUG |
6739 #endif // _DEBUG |
6366 iView->SetTopItemIndex( newTopItemIndex ); |
6740 iView->SetTopItemIndex( newTopItemIndex ); |
6367 } |
6741 } |
|
6742 |
6368 if ( aDrawNow ) |
6743 if ( aDrawNow ) |
6369 { |
6744 { |
6370 TRect rect(Rect()); |
6745 TRect rect(Rect()); |
6371 |
6746 |
6372 // list position changed |
6747 // list position changed |
6373 if ( iListBoxExt ) |
6748 if ( iListBoxExt && iListBoxExt->FlickOrPanningOngoing() ) |
6374 { |
6749 { |
6375 iListBoxExt->iBackgroundDrawingSuppressed = ETrue; |
6750 iItemDrawer->SetFlags( CListItemDrawer::EDrawWholeBackground ); |
6376 } |
6751 } |
|
6752 |
6377 UpdateScrollBarThumbs(); |
6753 UpdateScrollBarThumbs(); |
6378 DrawNow(); |
6754 DrawNow(); |
|
6755 |
6379 if (iSBFrame && iSBFrame->VerticalScrollBar() && !iSBFrame->VerticalScrollBar()->OwnsWindow()) |
6756 if (iSBFrame && iSBFrame->VerticalScrollBar() && !iSBFrame->VerticalScrollBar()->OwnsWindow()) |
6380 { |
6757 { |
6381 TRect srect( iSBFrame->VerticalScrollBar()->Rect() ); |
6758 TRect srect( iSBFrame->VerticalScrollBar()->Rect() ); |
6382 if ( !srect.Intersects( rect )) |
6759 if ( !srect.Intersects( rect )) |
6383 { |
6760 { |
6384 iSBFrame->DrawScrollBarsNow(); |
6761 iSBFrame->DrawScrollBarsNow(); |
6385 } |
6762 } |
6386 } |
6763 } |
|
6764 |
6387 if ( iListBoxExt ) |
6765 if ( iListBoxExt ) |
6388 { |
6766 { |
6389 iListBoxExt->iBackgroundDrawingSuppressed = EFalse; |
6767 iItemDrawer->ClearFlags( CListItemDrawer::EDrawWholeBackground |
|
6768 | CListItemDrawer::EBackgroundDrawn ); |
6390 } |
6769 } |
6391 } |
6770 } |
6392 _AKNTRACE_FUNC_EXIT; |
6771 _AKNTRACE_FUNC_EXIT; |
6393 } |
6772 } |
6394 |
6773 |
6400 TBool CEikListBox::HandlePhysicsPointerEventL( const TPointerEvent& aPointerEvent ) |
6779 TBool CEikListBox::HandlePhysicsPointerEventL( const TPointerEvent& aPointerEvent ) |
6401 { |
6780 { |
6402 _AKNTRACE_FUNC_ENTER; |
6781 _AKNTRACE_FUNC_ENTER; |
6403 _AKNTRACE( "aPointerEvent.iType = %d", aPointerEvent.iType ); |
6782 _AKNTRACE( "aPointerEvent.iType = %d", aPointerEvent.iType ); |
6404 if ( iListBoxExt->iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionBouncing ) |
6783 if ( iListBoxExt->iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionBouncing ) |
6405 { |
6784 { |
6406 // Block scrolling events outside listbox area. Note that pointer |
6785 // Block scrolling events outside listbox area. |
6407 // event ignore must be done for the window-owning control or it |
6786 if ( iListBoxExt->IgnorePointerEventsUntilUp() ) |
6408 // doesn't have any effect! |
6787 { |
6409 CCoeControl* windowOwningControl = this; |
|
6410 |
|
6411 while ( windowOwningControl && !windowOwningControl->OwnsWindow() ) |
|
6412 { |
|
6413 windowOwningControl = windowOwningControl->Parent(); |
|
6414 } |
|
6415 |
|
6416 if ( windowOwningControl ) |
|
6417 { |
|
6418 windowOwningControl->IgnoreEventsUntilNextPointerUp(); |
|
6419 _AKNTRACE_FUNC_EXIT; |
6788 _AKNTRACE_FUNC_EXIT; |
6420 return ETrue; |
6789 return ETrue; |
6421 } |
6790 } |
6422 } |
6791 } |
6423 |
6792 |
6730 _AKNTRACE_FUNC_EXIT; |
7104 _AKNTRACE_FUNC_EXIT; |
6731 } |
7105 } |
6732 |
7106 |
6733 |
7107 |
6734 // --------------------------------------------------------------------------- |
7108 // --------------------------------------------------------------------------- |
|
7109 // CEikListBox::MarkingMode |
|
7110 // --------------------------------------------------------------------------- |
|
7111 // |
|
7112 TBool CEikListBox::MarkingMode() const |
|
7113 { |
|
7114 TBool markingModeInUse = EFalse; |
|
7115 |
|
7116 if ( iListBoxExt ) |
|
7117 { |
|
7118 markingModeInUse = iListBoxExt->iMarkingModeInUse; |
|
7119 } |
|
7120 |
|
7121 return markingModeInUse; |
|
7122 } |
|
7123 |
|
7124 |
|
7125 // --------------------------------------------------------------------------- |
|
7126 // CEikListBox::MarkingModeObserver |
|
7127 // --------------------------------------------------------------------------- |
|
7128 // |
|
7129 MAknMarkingModeObserver* CEikListBox::MarkingModeObserver() |
|
7130 { |
|
7131 MAknMarkingModeObserver* observer = NULL; |
|
7132 |
|
7133 if ( iListBoxExt ) |
|
7134 { |
|
7135 observer = iListBoxExt->iMarkingModeObserver; |
|
7136 } |
|
7137 |
|
7138 return observer; |
|
7139 } |
|
7140 |
|
7141 |
|
7142 // --------------------------------------------------------------------------- |
6735 // Sets this control as visible or invisible. |
7143 // Sets this control as visible or invisible. |
6736 // --------------------------------------------------------------------------- |
7144 // --------------------------------------------------------------------------- |
6737 // |
7145 // |
6738 EXPORT_C void CEikListBox::MakeVisible( TBool aVisible ) |
7146 EXPORT_C void CEikListBox::MakeVisible( TBool aVisible ) |
6739 { |
7147 { |