equal
deleted
inserted
replaced
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * Version : %version: MM_71.1.17.1.70 % << Don't touch! Updated by Synergy at check-out. |
15 * Version : %version: MM_71.1.17.1.75 % << Don't touch! Updated by Synergy at check-out. |
16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 #include <e32keys.h> |
19 #include <e32keys.h> |
20 #include <e32math.h> |
20 #include <e32math.h> |
109 , iLongTapDetector( NULL ) |
109 , iLongTapDetector( NULL ) |
110 , iAllowMove( EFalse ) |
110 , iAllowMove( EFalse ) |
111 , iRecipientId( KErrNotFound ) |
111 , iRecipientId( KErrNotFound ) |
112 , iEventParameters( NULL ) |
112 , iEventParameters( NULL ) |
113 , iDialogOpened( EFalse ) |
113 , iDialogOpened( EFalse ) |
114 , iHighlightVisibleBeforeLongTap( EFalse ) |
114 , iHighlightVisibleBeforeLongTap( EFalse ) |
|
115 , iResetHighlight( EFalse ) |
115 { |
116 { |
116 iWidgetPositionCache.iValid = EFalse; |
117 iWidgetPositionCache.iValid = EFalse; |
117 } |
118 } |
118 |
119 |
119 // ----------------------------------------------------------------------------- |
120 // ----------------------------------------------------------------------------- |
140 { |
141 { |
141 iLongTapDetector->EnableLongTapAnimation( aEnable ); |
142 iLongTapDetector->EnableLongTapAnimation( aEnable ); |
142 // cancel longTap timer, avoid showing popupmenu |
143 // cancel longTap timer, avoid showing popupmenu |
143 if( !aEnable ) |
144 if( !aEnable ) |
144 { |
145 { |
145 TRAP_IGNORE( iLongTapDetector->PointerEventL( TPointerEvent() ) ); |
146 TRAP_IGNORE( iLongTapDetector->CancelAnimationL() ); |
146 } |
147 } |
147 } |
148 } |
148 } |
149 } |
149 |
150 |
150 // ----------------------------------------------------------------------------- |
151 // ----------------------------------------------------------------------------- |
213 if( !iWidget->View()->XYPosToItemIndex( |
214 if( !iWidget->View()->XYPosToItemIndex( |
214 aPointerEvent.iPosition, iDraggedIndex ) ) |
215 aPointerEvent.iPosition, iDraggedIndex ) ) |
215 { |
216 { |
216 iDraggedIndex = KErrNotFound; |
217 iDraggedIndex = KErrNotFound; |
217 } |
218 } |
218 iItemRelativeTapPoint = aPointerEvent.iPosition - iWidget->View()->ItemPos( |
219 iItemRelativeTapPoint = aPointerEvent.iPosition |
219 iDraggedIndex ); |
220 - iWidget->View()->ItemPos( iDraggedIndex ); |
220 } |
221 } |
221 |
222 |
222 // ----------------------------------------------------------------------------- |
223 // ----------------------------------------------------------------------------- |
223 // |
224 // |
224 // ----------------------------------------------------------------------------- |
225 // ----------------------------------------------------------------------------- |
311 |
312 |
312 if( iLastDragHighlight != highlight ) |
313 if( iLastDragHighlight != highlight ) |
313 { |
314 { |
314 iDragAndDropObserver->HandleDragOverL( GetHighlight() ); |
315 iDragAndDropObserver->HandleDragOverL( GetHighlight() ); |
315 } |
316 } |
316 |
317 |
317 TPoint centerPoint( aPointerEvent.iPosition ); |
318 TPoint centerPoint( aPointerEvent.iPosition ); |
318 if( WidgetType() == EGridWidget ) |
319 if( WidgetType() == EGridWidget ) |
319 { // move item's TL corner by half width/height to center item horizontally. |
320 { // move item's TL corner by half width/height to center item horizontally. |
320 centerPoint.iX -= ( iWidget->View()->ItemSize( highlight ).iWidth / 2 ); |
321 centerPoint.iX -= ( iWidget->View()->ItemSize( highlight ).iWidth / 2 ); |
321 centerPoint.iY -= ( iWidget->View()->ItemSize( highlight ).iHeight / 2 ); |
322 centerPoint.iY -= ( iWidget->View()->ItemSize( highlight ).iHeight / 2 ); |
324 { // move item's T of corner by relative tap point to align left horizontally. |
325 { // move item's T of corner by relative tap point to align left horizontally. |
325 centerPoint.iX -= iItemRelativeTapPoint.iX; |
326 centerPoint.iX -= iItemRelativeTapPoint.iX; |
326 // move item's L of corner by half height to center item horizontally. |
327 // move item's L of corner by half height to center item horizontally. |
327 centerPoint.iY -= ( iWidget->View()->ItemSize( highlight ).iHeight / 2 ); |
328 centerPoint.iY -= ( iWidget->View()->ItemSize( highlight ).iHeight / 2 ); |
328 } |
329 } |
329 |
330 |
330 if( !tooFast ) |
331 if( !tooFast ) |
331 { |
332 { |
332 TSize itemSize = iWidget->View()->ItemSize( highlight ); |
333 TSize itemSize = iWidget->View()->ItemSize( highlight ); |
333 TPoint itemPos = iWidget->View()->ItemPos( highlight ); |
334 TPoint itemPos = iWidget->View()->ItemPos( highlight ); |
334 |
335 |
675 // iDrawer->ClearFlags( CListItemDrawer::EPressedDownState ); |
676 // iDrawer->ClearFlags( CListItemDrawer::EPressedDownState ); |
676 // } |
677 // } |
677 HandleButtonDownL( aPointerEvent ); |
678 HandleButtonDownL( aPointerEvent ); |
678 iDragAndDropObserver->HandleDragStartL( GetHighlight() ); |
679 iDragAndDropObserver->HandleDragStartL( GetHighlight() ); |
679 } |
680 } |
|
681 else if( IsNoItemDragged() && ( aPointerEvent.iType |
|
682 == TPointerEvent::EButton1Up ) ) |
|
683 { |
|
684 iWidget->View()->ItemDrawer()->SetFlags( |
|
685 CListItemDrawer::ESingleClickDisabledHighlight ); |
|
686 TInt highlight = GetHighlight(); |
|
687 CListBoxView* view = Widget()->View(); |
|
688 Widget()->DrawNow( TRect( view->ItemPos( highlight ), |
|
689 view->ItemSize( highlight ) ) ); |
|
690 } |
680 else if( ( aPointerEvent.iType == TPointerEvent::EDrag |
691 else if( ( aPointerEvent.iType == TPointerEvent::EDrag |
681 || aPointerEvent.iType == TPointerEvent::EButtonRepeat ) |
692 || aPointerEvent.iType == TPointerEvent::EButtonRepeat ) |
682 && iDraggedIndex != KErrNotFound ) |
693 && iDraggedIndex != KErrNotFound ) |
683 { |
694 { |
684 //TODO: PROTO OF 2PHASE HIGHLIGHT EDITMODE BEHAVIOUR |
695 //TODO: PROTO OF 2PHASE HIGHLIGHT EDITMODE BEHAVIOUR |
1141 } |
1152 } |
1142 } |
1153 } |
1143 |
1154 |
1144 if( resp == EKeyWasNotConsumed ) |
1155 if( resp == EKeyWasNotConsumed ) |
1145 { |
1156 { |
1146 resp = iWidget->OfferKeyEventL( aKeyEvent, aType ); |
1157 resp = iWidget->OfferKeyEventL( aKeyEvent, aType ); |
1147 } |
1158 } |
1148 |
1159 |
1149 if( iKeyEventObserver ) |
1160 if( iKeyEventObserver ) |
1150 { |
1161 { |
1151 resp = iKeyEventObserver->HandleKeyPressedL( aKeyEvent, aType ); |
1162 resp = iKeyEventObserver->HandleKeyPressedL( aKeyEvent, aType ); |
1152 } |
1163 } |
1153 |
1164 |
1163 { |
1174 { |
1164 iAllowLongPress = ETrue; |
1175 iAllowLongPress = ETrue; |
1165 |
1176 |
1166 SetHighlightVisibilityL( ETrue ); |
1177 SetHighlightVisibilityL( ETrue ); |
1167 SetDefaultHighlightL( ETrue ); |
1178 SetDefaultHighlightL( ETrue ); |
1168 HandleForegroundGainedL(); |
1179 HandleForegroundGainedL(); |
1169 } |
1180 } |
1170 } |
1181 } |
1171 return resp; |
1182 return resp; |
1172 } |
1183 } |
1173 |
1184 |
1731 iWidgetPositionCache.iVerticalItemOffset = 0; |
1742 iWidgetPositionCache.iVerticalItemOffset = 0; |
1732 iWidgetPositionCache.iTopItemIndex = 0; |
1743 iWidgetPositionCache.iTopItemIndex = 0; |
1733 iWidgetPositionCache.iValid = EFalse; |
1744 iWidgetPositionCache.iValid = EFalse; |
1734 iWidgetPositionCache.iHighlightedItemId = KErrNotFound; |
1745 iWidgetPositionCache.iHighlightedItemId = KErrNotFound; |
1735 Widget()->SetTopItemIndex( 0 ); |
1746 Widget()->SetTopItemIndex( 0 ); |
|
1747 Widget()->View()->SetCurrentItemIndex( 0 ); |
1736 SetVerticalItemOffset( 0 ); |
1748 SetVerticalItemOffset( 0 ); |
|
1749 iResetHighlight = ETrue; |
1737 } |
1750 } |
1738 |
1751 |
1739 // --------------------------------------------------------------------------- |
1752 // --------------------------------------------------------------------------- |
1740 // |
1753 // |
1741 // --------------------------------------------------------------------------- |
1754 // --------------------------------------------------------------------------- |
1875 // |
1888 // |
1876 // ----------------------------------------------------------------------------- |
1889 // ----------------------------------------------------------------------------- |
1877 // |
1890 // |
1878 EXPORT_C TBool CMmWidgetContainer::ScrollToItemL( TInt aIndex ) |
1891 EXPORT_C TBool CMmWidgetContainer::ScrollToItemL( TInt aIndex ) |
1879 { |
1892 { |
1880 TInt scrollConsumed( EFalse ); |
1893 TBool scrollConsumed( EFalse ); |
1881 if( aIndex >= 0 && aIndex <= NumberOfItems() ) |
1894 if( aIndex >= 0 && aIndex <= NumberOfItems() ) |
1882 { |
1895 { |
1883 scrollConsumed = AlignBottomOfViewL(); |
1896 scrollConsumed = AlignBottomOfViewL(); |
1884 if ( !scrollConsumed && Widget()->View()->ItemIsPartiallyVisible(aIndex)) |
1897 if ( ( !scrollConsumed || iResetHighlight ) |
|
1898 && Widget()->View()->ItemIsPartiallyVisible(aIndex) ) |
1885 { |
1899 { |
1886 // the case when the item is partially visible at top or |
1900 // the case when the item is partially visible at top or |
1887 // bottom of screen. The view is scrolled the offset to |
1901 // bottom of screen. The view is scrolled the offset to |
1888 // make the item entirely visible. |
1902 // make the item entirely visible. |
1889 TInt offsetBottom = Widget()->View()->ItemPos( aIndex ).iY |
1903 TInt offsetBottom = Widget()->View()->ItemPos( aIndex ).iY |
1895 if( offset != 0 ) |
1909 if( offset != 0 ) |
1896 { |
1910 { |
1897 ScrollInPixelsL( offset ); |
1911 ScrollInPixelsL( offset ); |
1898 scrollConsumed = ETrue; |
1912 scrollConsumed = ETrue; |
1899 } |
1913 } |
1900 |
|
1901 } |
1914 } |
1902 else if( !Widget()->View()->ItemIsVisible( aIndex ) ) |
1915 else if( !Widget()->View()->ItemIsVisible( aIndex ) ) |
1903 { |
1916 { |
1904 // the case when the item is not visible on screen |
1917 // the case when the item is not visible on screen |
1905 SetupScrollingEffectsL( aIndex > Widget()->BottomItemIndex() ); |
1918 SetupScrollingEffectsL( aIndex > Widget()->BottomItemIndex() ); |
1906 Widget()->ScrollToMakeItemVisible( aIndex ); |
1919 Widget()->ScrollToMakeItemVisible( aIndex ); |
1907 AlignBottomOfViewL(); |
1920 AlignBottomOfViewL(); |
1908 scrollConsumed = ETrue; |
1921 scrollConsumed = ETrue; |
1909 } |
1922 } |
|
1923 iResetHighlight = EFalse; |
1910 } |
1924 } |
1911 return scrollConsumed; |
1925 return scrollConsumed; |
1912 } |
1926 } |
1913 |
1927 |
1914 // ----------------------------------------------------------------------------- |
1928 // ----------------------------------------------------------------------------- |
2067 && !iDragOccured ) |
2081 && !iDragOccured ) |
2068 { |
2082 { |
2069 iListBoxObserver->HandleListBoxEventL( aListBox, aEventType ); |
2083 iListBoxObserver->HandleListBoxEventL( aListBox, aEventType ); |
2070 } |
2084 } |
2071 } |
2085 } |
|
2086 |
|
2087 // --------------------------------------------------------------------------- |
|
2088 // |
|
2089 // --------------------------------------------------------------------------- |
|
2090 // |
|
2091 EXPORT_C void CMmWidgetContainer::SetWidgetCommingFromBackground( TBool /*aCommingFromBackground*/) |
|
2092 { |
|
2093 // this method must not be implemented. Change and implement only descended methods. |
|
2094 } |
|
2095 |
2072 //End of file |
2096 //End of file |