44 #include <aknconsts.h> |
44 #include <aknconsts.h> |
45 #include <avkon.mbg> |
45 #include <avkon.mbg> |
46 #include <AknsDrawUtils.h> |
46 #include <AknsDrawUtils.h> |
47 #include <AknsFrameBackgroundControlContext.h> |
47 #include <AknsFrameBackgroundControlContext.h> |
48 #include <AknBidiTextUtils.h> |
48 #include <AknBidiTextUtils.h> |
|
49 #include <AknMarqueeControl.h> |
49 #include <skinlayout.cdl.h> |
50 #include <skinlayout.cdl.h> |
50 #include <aknlayoutscalable_avkon.cdl.h> |
51 #include <aknlayoutscalable_avkon.cdl.h> |
51 #include <AknLayoutFont.h> |
52 #include <AknLayoutFont.h> |
52 |
53 |
53 #include <AknsUtils.h> |
54 #include <AknsUtils.h> |
54 #include <AknIconUtils.h> |
55 #include <AknIconUtils.h> |
55 #include <aknappui.h> |
56 #include <aknappui.h> |
56 |
57 |
|
58 #include <AknsEffectAnim.h> |
|
59 #include <systemwarninglevels.hrh> |
57 #include <layoutmetadata.cdl.h> |
60 #include <layoutmetadata.cdl.h> |
58 #include <AknStatuspaneUtils.h> |
61 #include <AknStatuspaneUtils.h> |
59 #include <aknCharMap.h> |
62 #include <aknCharMap.h> |
60 #include <gfxtranseffect/gfxtranseffect.h> //For transition effects |
63 #include <gfxtranseffect/gfxtranseffect.h> //For transition effects |
61 #include <akntranseffect.h> //For transition effects |
64 #include <akntranseffect.h> //For transition effects |
62 #include <akntransitionutils.h> // SetAllParents method |
65 #include <akntransitionutils.h> // SetAllParents method |
63 #include <featmgr.h> |
66 #include <featmgr.h> |
|
67 #include <hal.h> |
64 #include <avkondomainpskeys.h> |
68 #include <avkondomainpskeys.h> |
65 #include <e32property.h> |
69 #include <e32property.h> |
|
70 |
|
71 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
72 #include <aknlistboxtfxinternal.h> // LISTBOX EFFECTS IMPLEMENTATION |
|
73 #include <aknlistloadertfx.h> |
|
74 #include <aknlistboxtfx.h> |
|
75 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
66 |
76 |
67 #include <touchfeedback.h> |
77 #include <touchfeedback.h> |
68 #include <AknTasHook.h> |
78 #include <AknTasHook.h> |
69 #include <aknphysics.h> |
79 #include <aknphysics.h> |
70 #include <aknphysicsobserveriface.h> |
80 #include <aknphysicsobserveriface.h> |
130 TBool HighlightTimerActive() const; |
165 TBool HighlightTimerActive() const; |
131 |
166 |
132 void ChangePosition( TPointerEvent& aPointerEvent ); |
167 void ChangePosition( TPointerEvent& aPointerEvent ); |
133 void CalculateParentEvent( const TPointerEvent& aPointerEvent, |
168 void CalculateParentEvent( const TPointerEvent& aPointerEvent, |
134 TPointerEvent& aParentEvent ); |
169 TPointerEvent& aParentEvent ); |
|
170 TRect GetBackgroundRect( const TRect& aWindowRect ) const; |
|
171 static void AdjustPopupLayoutData( TAknWindowLineLayout& aListScrollPaneLayout ); |
|
172 |
|
173 const TAknLayoutText GetMenuItemTextLayout(const TRect& aItemRect, TBool cascade); |
|
174 |
|
175 public: // Implementation of MCoeForegroundObserver |
|
176 void HandleGainingForeground(); |
|
177 void HandleLosingForeground(); |
|
178 |
|
179 public: // Implementation of MAknsEffectAnimObserver |
|
180 void AnimFrameReady( TInt aError, TInt ); |
135 void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); |
181 void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); |
|
182 |
|
183 protected: // CActive overloads |
|
184 void DoCancel(); |
|
185 void RunL(); |
|
186 |
|
187 private: // New internal methods |
|
188 void Play(); |
|
189 TBool DrawHighlightBackground( CFbsBitGc& aGc ); |
|
190 void PostDeleteAnimation(); |
|
191 void CreateAnimationL( const TSize& aHighlightSize ); |
|
192 void DoResizeL( const TSize& aHighlightSize, TBool aAboutToStart ); |
136 public: |
193 public: |
137 void ImmediateFeedback( TTouchLogicalFeedback aType, |
194 void ImmediateFeedback( TTouchLogicalFeedback aType, |
138 TTouchFeedbackType aFbType ); |
195 TTouchFeedbackType aFbType ); |
139 |
196 |
140 public: |
197 public: |
141 void StartCascadeMenuAppearTransition(); |
198 void StartCascadeMenuAppearTransition(); |
142 |
199 |
|
200 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
201 void CalcItemSize( MAknListBoxTfxInternal* transApi ) const; |
|
202 #endif |
|
203 |
143 /** |
204 /** |
144 * Prepares cascade menu for item specific commands. |
205 * Prepares cascade menu for item specific commands. |
145 */ |
206 */ |
146 void PrepareCascadeForItemCommandsL(); |
207 void PrepareCascadeForItemCommands(); |
147 |
208 |
148 /** |
209 /** |
149 * Returns ETrue if this menu pane belongs to a CS menu. |
210 * Returns ETrue if this menu pane belongs to a CS menu. |
150 * |
211 * |
151 * @return ETrue if this menu pane belongs to a CS menu. |
212 * @return ETrue if this menu pane belongs to a CS menu. |
173 /** |
234 /** |
174 * Is highlight enabled |
235 * Is highlight enabled |
175 * |
236 * |
176 * @return ETrue if highlight is enabled |
237 * @return ETrue if highlight is enabled |
177 */ |
238 */ |
178 TBool HighlightEnabled(); |
239 TBool HighlightEnabled(); |
179 |
240 |
180 /** |
241 /** |
181 * Sets the default highlight to options menu |
242 * Sets the default highlight to options menu |
182 * |
243 * |
183 */ |
244 */ |
184 void SetDefaultHighlight(); |
245 void SetDefaultHighlight(); |
185 |
246 |
186 public: // Data |
247 public: // Data |
|
248 TBool iHasIcon; |
|
249 TBool iIsPenEnable; |
187 CFbsBitmap* iCascadeBitmap; |
250 CFbsBitmap* iCascadeBitmap; |
188 CFbsBitmap* iCascadeBitmapMask; |
251 CFbsBitmap* iCascadeBitmapMask; |
189 CAknsFrameBackgroundControlContext* iBgContext; |
252 CAknsFrameBackgroundControlContext* iBgContext; |
190 TInt iSubMenuWidthIndex; // index for submenu layout which depends on the text length |
253 TInt iSubMenuWidthIndex; // index for submenu layout which depends on the text length |
191 CFbsBitmap* iCheckMarkBitmap; // bitmap to be drawn if the item has check box set on |
254 CFbsBitmap* iCheckMarkBitmap; // bitmap to be drawn if the item has check box set on |
192 CFbsBitmap* iCheckMarkBitmapMask; // mask for the above bitmap |
255 CFbsBitmap* iCheckMarkBitmapMask; // mask for the above bitmap |
193 CFbsBitmap* iRadioButtonBitmap; // bitmap to be drawn if the item has radio button set on |
256 CFbsBitmap* iRadioButtonBitmap; // bitmap to be drawn if the item has radio button set on |
194 CFbsBitmap* iRadioButtonBitmapMask; // mask for the above bitmap |
257 CFbsBitmap* iRadioButtonBitmapMask; // mask for the above bitmap |
195 TBool iHasRadioGroup; // is ETrue if submenu contains radio button group. |
258 TBool iHasRadioGroup; // is ETrue if submenu contains radio button group. |
196 TInt iSelectedRadioButtonItem; // index of the radio button item which is currently selected (one must be selected) |
259 TInt iSelectedRadioButtonItem; // index of the radio button item which is currently selected (one must be selected) |
|
260 CCoeControl* iGrabbingCBAComponent; // component control of CBA which is currently grabbing the pointer |
197 CEikMenuPane* iControl; |
261 CEikMenuPane* iControl; |
|
262 CAknsEffectAnim* iAnimation; |
|
263 /** |
|
264 * Stored flags are explained in enumeration TFlags. |
|
265 */ |
|
266 TBitFlags32 iAnimFlags; |
|
267 |
198 CAknCharMap* iSct; // Menu SCT row, created only when needed. |
268 CAknCharMap* iSct; // Menu SCT row, created only when needed. |
199 TBool iSctHighlighted; // No "normal" menu item can be highlighted if ETrue |
269 TBool iSctHighlighted; // No "normal" menu item can be highlighted if ETrue |
200 |
270 |
201 // Pen event related flag indicating whether the (sub)menu pane has |
271 // Pen event related flag indicating whether the (sub)menu pane has |
202 // already consumed EButton1Down or not. If false, |
272 // already consumed EButton1Down or not. If false, |
205 TBool iSpecialCharPointed; |
275 TBool iSpecialCharPointed; |
206 // transition demarcation rectangle for cascaded submenu |
276 // transition demarcation rectangle for cascaded submenu |
207 // needs to be mutable since we need to get information from Draw methods |
277 // needs to be mutable since we need to get information from Draw methods |
208 // (that are declared const) |
278 // (that are declared const) |
209 mutable TRect iCascadeDRect; |
279 mutable TRect iCascadeDRect; |
|
280 TBool iTransitionsOn; // Transitions FtMgr flag on |
210 TBool iShowCascadeTransition; |
281 TBool iShowCascadeTransition; |
211 // For later deletion of cascade menu, this allows the transition system |
282 // For later deletion of cascade menu, this allows the transition system |
212 // to correctly handle the aborted transitions |
283 // to correctly handle the aborted transitions |
213 CEikMenuPane* iCascadeMenuObject; |
284 CEikMenuPane* iCascadeMenuObject; |
214 TBool iDraggedOutside; |
285 TBool iDraggedOutside; |
215 TPointerEvent iLastPointerEvent; |
286 TPointerEvent iLastPointerEvent; |
|
287 |
|
288 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
289 CWindowGc* iGc; |
|
290 #endif |
216 TInt iItemsThatFitInView; |
291 TInt iItemsThatFitInView; |
217 TRect iScrollBarRect; |
292 TRect iScrollBarRect; |
218 TRect iSctRect; |
293 TRect iSctRect; |
|
294 TInt iTotalNumberOfItemsInView; // this value includes partial items |
|
295 |
|
296 |
219 CIdle* iTaskSwapIdle; |
297 CIdle* iTaskSwapIdle; |
220 CRedirectionListener* iRedirectionListener; |
298 CRedirectionListener* iRedirectionListener; |
|
299 TRect iSBRect; |
221 RWindow* iMenuPaneWindow; // Not own, used by SCT |
300 RWindow* iMenuPaneWindow; // Not own, used by SCT |
222 TBool iLaunchCascadeMenu; |
301 TBool iLaunchCascadeMenu; |
223 TBool isUpdateScrollDirectly; |
302 TBool isUpdateScrollDirectly; |
224 TBool iPressedDown; // ETrue if pointer is down, otherwise. |
303 TBool iPressedDown; // ETrue if pointer is down, otherwise. |
225 |
304 |
468 // --------------------------------------------------------------------------- |
535 // --------------------------------------------------------------------------- |
469 // |
536 // |
470 void CEikMenuPaneExtension::ViewPositionChanged( const TPoint& aNewPosition, |
537 void CEikMenuPaneExtension::ViewPositionChanged( const TPoint& aNewPosition, |
471 TBool aDrawNow, |
538 TBool aDrawNow, |
472 TUint /*aFlags*/ ) |
539 TUint /*aFlags*/ ) |
473 { |
540 { |
474 _AKNTRACE_FUNC_ENTER; |
541 _AKNTRACE_FUNC_ENTER; |
|
542 if ( !iControl->iItemArray ) |
|
543 { |
|
544 return; |
|
545 } |
|
546 |
|
547 iListTopIndex = aNewPosition.iY - iViewHeight / 2; |
|
548 |
|
549 iListBottomIndex = aNewPosition.iY + iViewHeight - iViewHeight / 2; |
|
550 |
475 TInt delta = iViewPosition.iY - aNewPosition.iY; |
551 TInt delta = iViewPosition.iY - aNewPosition.iY; |
476 |
|
477 if ( !iControl->iItemArray || delta == 0 ) |
|
478 { |
|
479 return; |
|
480 } |
|
481 |
|
482 iListTopIndex = aNewPosition.iY - iViewHeight / 2; |
|
483 iListBottomIndex = aNewPosition.iY + iViewHeight - iViewHeight / 2; |
|
484 |
552 |
485 DoOffset( delta ); |
553 DoOffset( delta ); |
486 |
554 |
487 iViewPosition = aNewPosition; |
555 iViewPosition = aNewPosition; |
488 _AKNTRACE( "iListTopIndex = %d", iListTopIndex ); |
556 _AKNTRACE( "iListTopIndex = %d", iListTopIndex ); |
489 _AKNTRACE( "iListBottomIndex = %d", iListBottomIndex ); |
557 _AKNTRACE( "iListBottomIndex = %d", iListBottomIndex ); |
490 _AKNTRACE( "delta = %d", delta ); |
558 _AKNTRACE( "delta = %d", delta ); |
491 _AKNTRACE( "iViewPosition(%d,%d)", iViewPosition.iX, iViewPosition.iY ); |
559 _AKNTRACE( "iViewPosition(%d,%d)", iViewPosition.iX, iViewPosition.iY ); |
492 |
560 |
493 //here checking the delta whether it is changed. |
|
494 //if it is changed,the view must be drawn using the below code. |
|
495 if ( delta != 0 ) |
|
496 { |
|
497 aDrawNow = ETrue; |
|
498 } |
|
499 if ( aDrawNow ) |
561 if ( aDrawNow ) |
500 { |
562 { |
501 if ( iFlags.IsClear( ESkipScrollbarUpdate ) ) |
563 TRAP_IGNORE( iControl->DoUpdateScrollBarL() ); |
502 { |
564 |
503 TRAP_IGNORE( iControl->DoUpdateScrollBarL() ); |
565 if ( iControl->iOwner ) // Submenu |
504 } |
566 { |
505 |
567 iControl->DrawNow(); |
506 // Redraw only item area if scrollbar is invisible, otherwise include |
568 } |
507 // also scrollbar's area in order to avoid drawdeferred. |
569 else |
508 TRect drawRect( iItemAreaRect ); |
570 { |
509 |
571 iControl->DrawNow( TRect( iMenuPaneRect.Size() ) ); |
510 if ( iScrollbarVisibility == CEikScrollBarFrame::EOn ) |
572 } |
511 { |
|
512 drawRect = iMenuAreaRect; |
|
513 } |
|
514 |
|
515 iControl->DrawNow( drawRect ); |
|
516 } |
573 } |
517 _AKNTRACE_FUNC_EXIT; |
574 _AKNTRACE_FUNC_EXIT; |
518 } |
575 } |
519 |
576 |
520 |
577 |
874 iCheckMarkBitmapMask( NULL ), |
946 iCheckMarkBitmapMask( NULL ), |
875 iRadioButtonBitmap( NULL ), |
947 iRadioButtonBitmap( NULL ), |
876 iRadioButtonBitmapMask( NULL ), |
948 iRadioButtonBitmapMask( NULL ), |
877 iHasRadioGroup( EFalse ), |
949 iHasRadioGroup( EFalse ), |
878 iSelectedRadioButtonItem( KNoSelectedRadioButtonItem ), |
950 iSelectedRadioButtonItem( KNoSelectedRadioButtonItem ), |
|
951 iGrabbingCBAComponent( NULL ), |
879 iControl( NULL ), |
952 iControl( NULL ), |
|
953 iAnimation( NULL ), |
|
954 iAnimFlags ( 0 ), |
880 iSct( NULL ), |
955 iSct( NULL ), |
881 iSctHighlighted( EFalse ), |
956 iSctHighlighted( EFalse ), |
882 iSpecialCharPointed( EFalse ) |
957 iSpecialCharPointed( EFalse ) |
|
958 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
959 ,iGc ( NULL ) |
|
960 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
883 ,iVerticalOffset( 0 ) |
961 ,iVerticalOffset( 0 ) |
884 ,iPhysics( NULL ) |
962 ,iPhysics( NULL ) |
885 ,iListTopIndex( 0 ) |
963 ,iListTopIndex( 0 ) |
886 ,iViewHeight( 0 ) |
964 ,iViewHeight( 0 ) |
887 ,iFlickActive( EFalse ) |
965 ,iFlickActive( EFalse ) |
888 ,iPanningActive( EFalse ) |
966 ,iPanningActive( EFalse ) |
889 ,iFeedback( MTouchFeedback::Instance() ) |
967 ,iFeedback( MTouchFeedback::Instance() ) |
890 ,iLastFeedbackTopItemIndex( 0 ) |
968 ,iLastFeedbackTopItemIndex( 0 ) |
891 { |
969 { |
892 iItemsReadyForPenSelection = !AknLayoutUtils::PenEnabled(); |
970 iIsPenEnable = AknLayoutUtils::PenEnabled(); |
|
971 iItemsReadyForPenSelection = !iIsPenEnable; |
893 iNextHighlightItem = KErrNotFound; |
972 iNextHighlightItem = KErrNotFound; |
894 iHighlightedItem = KErrNotFound; |
|
895 } |
973 } |
896 |
974 |
897 // ----------------------------------------------------------------------------- |
975 // ----------------------------------------------------------------------------- |
898 // CEikMenuPaneExtension::~CEikMenuPaneExtension |
976 // CEikMenuPaneExtension::~CEikMenuPaneExtension |
899 // Destructor for extension class |
977 // Destructor for extension class |
900 // ----------------------------------------------------------------------------- |
978 // ----------------------------------------------------------------------------- |
901 // |
979 // |
902 CEikMenuPaneExtension::~CEikMenuPaneExtension() |
980 CEikMenuPaneExtension::~CEikMenuPaneExtension() |
903 { |
981 { |
904 _AKNTRACE_FUNC_ENTER; |
982 _AKNTRACE_FUNC_ENTER; |
|
983 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
984 if ( CAknListLoader::TfxApiInternal( iGc ) ) |
|
985 { |
|
986 delete iGc; |
|
987 } |
|
988 #endif |
|
989 Cancel(); // Cancel possibly pending request |
|
990 |
|
991 // Stop receiving foreground events |
|
992 CCoeEnv* env = CCoeEnv::Static(); |
|
993 env->RemoveForegroundObserver( *this ); |
905 |
994 |
906 delete iCascadeBitmap; |
995 delete iCascadeBitmap; |
907 iCascadeBitmap = NULL; |
996 iCascadeBitmap = NULL; |
908 |
997 |
909 delete iCascadeBitmapMask; |
998 delete iCascadeBitmapMask; |
983 |
1082 |
984 iBgContext = CAknsFrameBackgroundControlContext::NewL( |
1083 iBgContext = CAknsFrameBackgroundControlContext::NewL( |
985 KAknsIIDQsnFrPopup, TRect( 0, 0, 1, 1 ), TRect( 0, 0, 1, 1 ), EFalse ); |
1084 KAknsIIDQsnFrPopup, TRect( 0, 0, 1, 1 ), TRect( 0, 0, 1, 1 ), EFalse ); |
986 } |
1085 } |
987 |
1086 |
|
1087 // ----------------------------------------------------------------------------- |
|
1088 // CEikMenuPaneExtension::CreateAnimation |
|
1089 // ----------------------------------------------------------------------------- |
|
1090 // |
|
1091 void CEikMenuPaneExtension::CreateAnimation() |
|
1092 { |
|
1093 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
1094 return; |
|
1095 #else |
|
1096 if( !iAnimation && iAnimFlags.IsSet( EFlagUseAnimation ) ) |
|
1097 { |
|
1098 TRect rect = iControl->HighlightRect(); |
|
1099 TRAPD( err, CreateAnimationL( rect.Size() ) ); |
|
1100 if( KErrNone != err ) |
|
1101 { |
|
1102 // Animation has not been drawn -> no need for repaint |
|
1103 UseNoAnimation(); |
|
1104 } |
|
1105 } |
|
1106 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
|
1107 } |
|
1108 |
|
1109 // ----------------------------------------------------------------------------- |
|
1110 // CEikMenuPaneExtension::NoAnimIfError |
|
1111 // ----------------------------------------------------------------------------- |
|
1112 // |
|
1113 void CEikMenuPaneExtension::NoAnimIfError( TInt aError ) |
|
1114 { |
|
1115 if( KErrNone != aError ) |
|
1116 UseNoAnimation(); |
|
1117 } |
|
1118 |
|
1119 // ----------------------------------------------------------------------------- |
|
1120 // CEikMenuPaneExtension::UseNoAnimation |
|
1121 // Falls back to normal highlight rendering. |
|
1122 // ----------------------------------------------------------------------------- |
|
1123 // |
|
1124 void CEikMenuPaneExtension::UseNoAnimation() |
|
1125 { |
|
1126 delete iAnimation; |
|
1127 iAnimation = NULL; |
|
1128 |
|
1129 // Do not attempt to create animations in the future |
|
1130 iAnimFlags.Clear( EFlagUseAnimation ); |
|
1131 |
|
1132 // Stop receiving foreground events |
|
1133 CCoeEnv* env = CCoeEnv::Static(); |
|
1134 env->RemoveForegroundObserver( *this ); |
|
1135 } |
988 |
1136 |
989 // ----------------------------------------------------------------------------- |
1137 // ----------------------------------------------------------------------------- |
990 // CEikMenuPaneExtension::StartCascadeMenuTimerL |
1138 // CEikMenuPaneExtension::StartCascadeMenuTimerL |
991 // Starts the timer for the sub menu launch. Timer is constructed when used for |
1139 // Starts the timer for the sub menu launch. Timer is constructed when used for |
992 // the first time |
1140 // the first time |
1216 // |
1361 // |
1217 void CEikMenuPaneExtension::CalculateParentEvent( const TPointerEvent& aPointerEvent, |
1362 void CEikMenuPaneExtension::CalculateParentEvent( const TPointerEvent& aPointerEvent, |
1218 TPointerEvent& aParentEvent ) |
1363 TPointerEvent& aParentEvent ) |
1219 { |
1364 { |
1220 aParentEvent.iModifiers = aPointerEvent.iModifiers; |
1365 aParentEvent.iModifiers = aPointerEvent.iModifiers; |
1221 TPoint subPos = iControl->Position(); |
1366 TPoint subPos = iControl->PositionRelativeToScreen(); |
1222 TPoint ownerPos = iControl->iOwner->Position(); |
1367 TPoint ownerPos = iControl->iOwner->PositionRelativeToScreen(); |
1223 aParentEvent.iPosition.SetXY ( |
1368 aParentEvent.iPosition.SetXY ( |
1224 aPointerEvent.iPosition.iX + subPos.iX - ownerPos.iX, |
1369 aPointerEvent.iPosition.iX + subPos.iX - ownerPos.iX, |
1225 aPointerEvent.iPosition.iY + subPos.iY - ownerPos.iY); |
1370 aPointerEvent.iPosition.iY + subPos.iY - ownerPos.iY); |
1226 aParentEvent.iType = aPointerEvent.iType; |
1371 aParentEvent.iType = aPointerEvent.iType; |
1227 } |
1372 } |
1228 |
1373 |
|
1374 // ----------------------------------------------------------------------------- |
|
1375 // CEikMenuPaneExtension::GetBackgroundRect |
|
1376 // Get background rect for landscape mode of menu pane. |
|
1377 // ----------------------------------------------------------------------------- |
|
1378 // |
|
1379 TRect CEikMenuPaneExtension::GetBackgroundRect( const TRect& aWindowRect ) const |
|
1380 { |
|
1381 return aWindowRect; |
|
1382 } |
|
1383 |
|
1384 // ----------------------------------------------------------------------------- |
|
1385 // CEikMenuPaneExtension::AdjustPopupLayoutData |
|
1386 // Adjust popup layout data for main menu pane in landscape mode |
|
1387 // ----------------------------------------------------------------------------- |
|
1388 // |
|
1389 void CEikMenuPaneExtension::AdjustPopupLayoutData( TAknWindowLineLayout& aListScrollPaneLayout ) |
|
1390 { |
|
1391 TRect screenRect; |
|
1392 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
|
1393 AknLayoutUtils::TAknCbaLocation cbaPosition = AknLayoutUtils::CbaLocation(); |
|
1394 |
|
1395 if ( screenRect.Width() == EQhdWidth && screenRect.Height() == EQhdHeight |
|
1396 && cbaPosition == AknLayoutUtils::EAknCbaLocationBottom ) |
|
1397 { |
|
1398 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
1399 { |
|
1400 aListScrollPaneLayout.ir -= 32; |
|
1401 } |
|
1402 else |
|
1403 { |
|
1404 aListScrollPaneLayout.il -= 32; |
|
1405 } |
|
1406 } |
|
1407 } |
|
1408 |
|
1409 |
|
1410 // ----------------------------------------------------------------------------- |
|
1411 // CEikMenuPaneExtension::GetMenuItemTextLayout |
|
1412 // Get Layout of menu item text. |
|
1413 // ----------------------------------------------------------------------------- |
|
1414 // |
|
1415 const TAknLayoutText CEikMenuPaneExtension::GetMenuItemTextLayout(const TRect& aItemRect, TBool cascade) |
|
1416 { |
|
1417 TAknTextLineLayout menuTextLayout; |
|
1418 |
|
1419 if ( !iControl->iOwner ) |
|
1420 { |
|
1421 menuTextLayout = AknLayoutScalable_Avkon::list_single_pane_t1_cp2( cascade ? 3 : 0 ).LayoutLine(); |
|
1422 } |
|
1423 else |
|
1424 { |
|
1425 if ( iHasIcon ) |
|
1426 { |
|
1427 menuTextLayout = TAknTextLineLayout( AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 1 ).LayoutLine() ); |
|
1428 } |
|
1429 else |
|
1430 { |
|
1431 menuTextLayout = TAknTextLineLayout( AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 0 ).LayoutLine() ); |
|
1432 } |
|
1433 } |
|
1434 |
|
1435 TAknLayoutText textRect; |
|
1436 textRect.LayoutText( aItemRect, menuTextLayout ); |
|
1437 return textRect; |
|
1438 } |
|
1439 |
|
1440 |
|
1441 // ----------------------------------------------------------------------------- |
|
1442 // CEikMenuPaneExtension::FocusGained |
|
1443 // The owning control has gained focus -> animation should be continued. |
|
1444 // ----------------------------------------------------------------------------- |
|
1445 // |
|
1446 void CEikMenuPaneExtension::FocusGained() |
|
1447 { |
|
1448 Play(); |
|
1449 } |
|
1450 |
|
1451 // ----------------------------------------------------------------------------- |
|
1452 // CEikMenuPaneExtension::FocusLost |
|
1453 // The owning control has lost focus -> no running animation (even if the |
|
1454 // control is partially visible). |
|
1455 // ----------------------------------------------------------------------------- |
|
1456 // |
|
1457 void CEikMenuPaneExtension::FocusLost() |
|
1458 { |
|
1459 if( iAnimation ) |
|
1460 { |
|
1461 NoAnimIfError( iAnimation->Pause() ); |
|
1462 } |
|
1463 } |
|
1464 |
|
1465 // ----------------------------------------------------------------------------- |
|
1466 // CEikMenuPaneExtension::HandleLayoutSwitch |
|
1467 // ----------------------------------------------------------------------------- |
|
1468 // |
|
1469 void CEikMenuPaneExtension::HandleLayoutSwitch() |
|
1470 { |
|
1471 if( iAnimation ) // Animation exists -> try to resize |
|
1472 { |
|
1473 TRect rect( iControl->HighlightRect() ); |
|
1474 |
|
1475 // Resize animation |
|
1476 TBool aboutToStart = ETrue; |
|
1477 if( iAnimation->State() == EAknsAnimStateStopped ) |
|
1478 aboutToStart = EFalse; |
|
1479 |
|
1480 TRAPD( err, DoResizeL( rect.Size(), aboutToStart ) ); |
|
1481 NoAnimIfError( err ); |
|
1482 } |
|
1483 } |
|
1484 |
|
1485 // ----------------------------------------------------------------------------- |
|
1486 // CEikMenuPaneExtension::ChangeHighlightBackground |
|
1487 // ----------------------------------------------------------------------------- |
|
1488 // |
|
1489 void CEikMenuPaneExtension::ChangeHighlightBackground() |
|
1490 { |
|
1491 // Every time the current list item is changed we need to change the |
|
1492 // animation input layer (animated element is the highlight bacground that |
|
1493 // can differ between highlight positions). |
|
1494 if( iAnimation ) |
|
1495 { |
|
1496 if( iAnimation->State() == EAknsAnimStateStopped ) |
|
1497 { |
|
1498 // Input layers don't exist when stopped or finished. We need to |
|
1499 // resize to create the input layers and to update the output |
|
1500 // layer. |
|
1501 |
|
1502 TRAPD( err, DoResizeL( iAnimation->Size(), EFalse ) ); |
|
1503 NoAnimIfError( err ); |
|
1504 } |
|
1505 else // Either paused, running or finished |
|
1506 { |
|
1507 // Update the highlight background |
|
1508 if( iAnimation->InputRgbGc() ) |
|
1509 DrawHighlightBackground( *iAnimation->InputRgbGc() ); |
|
1510 |
|
1511 // We need to update the output frame (otherwise the highlight |
|
1512 // would drawn with the old output before the next new animation |
|
1513 // frame). |
|
1514 NoAnimIfError( iAnimation->UpdateOutput() ); |
|
1515 } |
|
1516 } |
|
1517 } |
1229 |
1518 |
1230 // ----------------------------------------------------------------------------- |
1519 // ----------------------------------------------------------------------------- |
1231 // CEikMenuPaneExtension::MenuClosed |
1520 // CEikMenuPaneExtension::MenuClosed |
1232 // ----------------------------------------------------------------------------- |
1521 // ----------------------------------------------------------------------------- |
1233 // |
1522 // |
1234 void CEikMenuPaneExtension::MenuClosed() |
1523 void CEikMenuPaneExtension::MenuClosed() |
1235 { |
1524 { |
1236 _AKNTRACE_FUNC_ENTER; |
1525 _AKNTRACE_FUNC_ENTER; |
|
1526 delete iAnimation; |
|
1527 iAnimation = NULL; |
|
1528 |
|
1529 CCoeEnv* env = CCoeEnv::Static(); |
|
1530 env->RemoveForegroundObserver( *this ); |
|
1531 |
|
1532 iAnimFlags.Set( EFlagUseAnimation ); |
|
1533 |
1237 delete iSct; |
1534 delete iSct; |
1238 iSct = NULL; |
1535 iSct = NULL; |
1239 iSctHighlighted = EFalse; |
1536 iSctHighlighted = EFalse; |
|
1537 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
1538 iSctRect = TRect::EUninitialized; |
|
1539 #endif |
1240 |
1540 |
1241 if ( iCba ) |
1541 if ( iCba ) |
1242 { |
1542 { |
1243 iCba = NULL; |
1543 iCba = NULL; |
1244 } |
1544 } |
1247 { |
1547 { |
1248 iRedirectionListener->Closing(); |
1548 iRedirectionListener->Closing(); |
1249 } |
1549 } |
1250 |
1550 |
1251 iFlags.Clear( EHideItemSpecificCommands ); |
1551 iFlags.Clear( EHideItemSpecificCommands ); |
1252 iFlags.Clear( EHideItemActionCommands ); |
|
1253 iFlags.Clear( EContextSensitive ); |
1552 iFlags.Clear( EContextSensitive ); |
1254 iFlags.Clear( EHighlightEnabled ); |
1553 iFlags.Clear( EHighlightEnabled ); |
1255 iFlags.Clear( EHideViewSpecificCommands ); |
|
1256 iFlags.Clear( EHideMarkAndUnmark ); |
|
1257 _AKNTRACE_FUNC_EXIT; |
1554 _AKNTRACE_FUNC_EXIT; |
1258 } |
1555 } |
1259 |
1556 |
|
1557 // ----------------------------------------------------------------------------- |
|
1558 // CEikMenuPaneExtension::HandleGainingForeground |
|
1559 // The application has gained foreground -> animation should be continued. |
|
1560 // ----------------------------------------------------------------------------- |
|
1561 // |
|
1562 void CEikMenuPaneExtension::HandleGainingForeground() |
|
1563 { |
|
1564 // It is safe to start animation in this method because animation is |
|
1565 // deleted when the menu is closed -> it is not possible that menu receives |
|
1566 // foreground event while it is not visible and the animation exists. |
|
1567 |
|
1568 // We need to check if the menu has focus (to prevent running nonfocused |
|
1569 // animation because also the nonfocused menu (menu/submenu) receives |
|
1570 // foreground events) |
|
1571 Play(); |
|
1572 } |
|
1573 |
|
1574 // ----------------------------------------------------------------------------- |
|
1575 // CEikMenuPaneExtension::HandleLosingForeground |
|
1576 // The application lost foreground -> no running animation (even if the |
|
1577 // application is partially visible). |
|
1578 // ----------------------------------------------------------------------------- |
|
1579 // |
|
1580 void CEikMenuPaneExtension::HandleLosingForeground() |
|
1581 { |
|
1582 if( iAnimation ) |
|
1583 { |
|
1584 NoAnimIfError( iAnimation->Stop() ); |
|
1585 } |
|
1586 } |
|
1587 |
|
1588 // ----------------------------------------------------------------------------- |
|
1589 // CEikMenuPaneExtension::AnimFrameReady |
|
1590 // ----------------------------------------------------------------------------- |
|
1591 // |
|
1592 void CEikMenuPaneExtension::AnimFrameReady( TInt aError, TInt ) |
|
1593 { |
|
1594 if( KErrNone != aError ) |
|
1595 { |
|
1596 // Animation has failed to run -> schedule the animation for |
|
1597 // deletion to fall back to normal rendering. |
|
1598 PostDeleteAnimation(); |
|
1599 } |
|
1600 else if( iControl ) // Frame ok |
|
1601 { |
|
1602 if ( iControl->IsVisible() ) |
|
1603 { |
|
1604 iControl->RepaintHighlight(); |
|
1605 } |
|
1606 } |
|
1607 } |
|
1608 |
|
1609 // ----------------------------------------------------------------------------- |
|
1610 // CEikMenuPaneExtension::DoCancel |
|
1611 // ----------------------------------------------------------------------------- |
|
1612 // |
|
1613 void CEikMenuPaneExtension::DoCancel() |
|
1614 { |
|
1615 // Required method, but not needed |
|
1616 } |
|
1617 |
|
1618 |
|
1619 // ----------------------------------------------------------------------------- |
|
1620 // CEikMenuPaneExtension::RunL |
|
1621 // Postponed animation deletion is done here |
|
1622 // ----------------------------------------------------------------------------- |
|
1623 // |
|
1624 void CEikMenuPaneExtension::RunL() |
|
1625 { |
|
1626 UseNoAnimation(); |
|
1627 } |
|
1628 |
|
1629 // ----------------------------------------------------------------------------- |
|
1630 // CEikMenuPaneExtension::Play |
|
1631 // ----------------------------------------------------------------------------- |
|
1632 // |
|
1633 void CEikMenuPaneExtension::Play() |
|
1634 { |
|
1635 if( !iAnimation || !iControl->IsFocused() ) |
|
1636 { |
|
1637 return; |
|
1638 } |
|
1639 |
|
1640 // No need to start running/finished animation |
|
1641 if( EAknsAnimStateRunning == iAnimation->State() || |
|
1642 EAknsAnimStateFinished == iAnimation->State() ) |
|
1643 { |
|
1644 return; |
|
1645 } |
|
1646 |
|
1647 CAknAppUi* aui = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi()); |
|
1648 if( !aui->IsForeground() ) |
|
1649 { |
|
1650 return; |
|
1651 } |
|
1652 |
|
1653 if( EAknsAnimStatePaused == iAnimation->State() ) |
|
1654 { |
|
1655 NoAnimIfError( iAnimation->Continue() ); |
|
1656 } |
|
1657 else if( EAknsAnimStateStopped == iAnimation->State() ) |
|
1658 { |
|
1659 if( iAnimation->NeedsInputLayer() ) |
|
1660 { |
|
1661 TRAPD( err, DoResizeL( iAnimation->Size(), ETrue ) ); |
|
1662 NoAnimIfError( err ); |
|
1663 |
|
1664 if( KErrNone != err ) |
|
1665 return; |
|
1666 } |
|
1667 |
|
1668 NoAnimIfError( iAnimation->Start() ); |
|
1669 } |
|
1670 } |
|
1671 |
|
1672 // ----------------------------------------------------------------------------- |
|
1673 // CEikMenuPaneExtension::DrawHighlightBackground |
|
1674 // Draws skinned highlight background to the provided graphics context. |
|
1675 // ----------------------------------------------------------------------------- |
|
1676 // |
|
1677 TBool CEikMenuPaneExtension::DrawHighlightBackground( CFbsBitGc& aGc ) |
|
1678 { |
|
1679 // Draw the background under the current highlight. This simplified |
|
1680 // drawing, we only grab a piece from the list background bitmap. |
|
1681 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1682 |
|
1683 return AknsDrawUtils::DrawBackground( skin, iBgContext, iControl, aGc, TPoint(0,0), |
|
1684 iControl->HighlightRect(), |
|
1685 KAknsDrawParamRGBOnly ); |
|
1686 } |
|
1687 |
|
1688 // ----------------------------------------------------------------------------- |
|
1689 // CEikMenuPaneExtension::PostDeleteAnimation |
|
1690 // Schedules the animation for deletion by activating the extension itself. |
|
1691 // Deletion is postponed because in many error/failure occasions the caller has |
|
1692 // been animation and direct deletion is possibly not safe (because function |
|
1693 // stack would return through the deleted object). |
|
1694 // ----------------------------------------------------------------------------- |
|
1695 // |
|
1696 void CEikMenuPaneExtension::PostDeleteAnimation() |
|
1697 { |
|
1698 TRequestStatus* status = &iStatus; |
|
1699 User::RequestComplete( status, KErrNone ); |
|
1700 SetActive(); |
|
1701 } |
|
1702 |
|
1703 // ----------------------------------------------------------------------------- |
|
1704 // CEikMenuPaneExtension::CreateAnimationL |
|
1705 // ----------------------------------------------------------------------------- |
|
1706 // |
|
1707 void CEikMenuPaneExtension::CreateAnimationL( const TSize& aHighlightSize ) |
|
1708 { |
|
1709 // Create animation |
|
1710 CCoeEnv* env = CCoeEnv::Static(); |
|
1711 env->AddForegroundObserverL( *this ); |
|
1712 |
|
1713 delete iAnimation; |
|
1714 iAnimation = NULL; |
|
1715 |
|
1716 iAnimation = CAknsEffectAnim::NewL( this ); |
|
1717 TBool ok = iAnimation->ConstructFromSkinL( KAknsIIDQsnAnimList ); |
|
1718 |
|
1719 if( !ok ) // Animation for the ID was not found from the skin |
|
1720 { |
|
1721 User::Leave( KErrNotFound ); |
|
1722 } |
|
1723 |
|
1724 DoResizeL( aHighlightSize, ETrue ); |
|
1725 |
|
1726 Play(); |
|
1727 } |
|
1728 |
|
1729 // ----------------------------------------------------------------------------- |
|
1730 // CEikMenuPaneExtension::DoResizeL |
|
1731 // ----------------------------------------------------------------------------- |
|
1732 // |
|
1733 void CEikMenuPaneExtension::DoResizeL( |
|
1734 const TSize& aHighlightSize, TBool aAboutToStart ) |
|
1735 { |
|
1736 iAnimation->BeginConfigInputLayersL( aHighlightSize, aAboutToStart ); |
|
1737 |
|
1738 if( iAnimation->InputRgbGc() ) |
|
1739 DrawHighlightBackground( *iAnimation->InputRgbGc() ); |
|
1740 |
|
1741 iAnimation->EndConfigInputLayersL(); |
|
1742 } |
1260 |
1743 |
1261 // ----------------------------------------------------------------------------- |
1744 // ----------------------------------------------------------------------------- |
1262 // CEikMenuPaneExtension::ConstructMenuSctRowL |
1745 // CEikMenuPaneExtension::ConstructMenuSctRowL |
1263 // Creates a special characters row to be used in edit menu. |
1746 // Creates a special characters row to be used in edit menu. |
1264 // ----------------------------------------------------------------------------- |
1747 // ----------------------------------------------------------------------------- |
1303 iSct->ConstructMenuSctRowFromDialogL(aResourceId); |
1789 iSct->ConstructMenuSctRowFromDialogL(aResourceId); |
1304 iSct->SetBuffer( aSpecialChars ); |
1790 iSct->SetBuffer( aSpecialChars ); |
1305 if ( renew && iMenuPaneWindow && iControl) |
1791 if ( renew && iMenuPaneWindow && iControl) |
1306 { |
1792 { |
1307 iSct->SetContainerWindowL( *iControl ); |
1793 iSct->SetContainerWindowL( *iControl ); |
1308 iSct->SetGloballyCapturing( ETrue ); |
1794 if ( AknLayoutUtils::PenEnabled() ) |
1309 iSct->SetPointerCapture( ETrue ); |
1795 { |
|
1796 iSct->SetGloballyCapturing( ETrue ); |
|
1797 iSct->SetPointerCapture( ETrue ); |
|
1798 } |
1310 } |
1799 } |
1311 } |
1800 } |
1312 |
1801 |
1313 // ----------------------------------------------------------------------------- |
1802 // ----------------------------------------------------------------------------- |
1314 // CEikMenuPaneExtension::HandleControlEventL |
1803 // CEikMenuPaneExtension::HandleControlEventL |
1315 // ----------------------------------------------------------------------------- |
1804 // ----------------------------------------------------------------------------- |
1316 // |
1805 // |
1317 void CEikMenuPaneExtension::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType) |
1806 void CEikMenuPaneExtension::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType) |
1318 { |
1807 { |
1319 _AKNTRACE_FUNC_ENTER; |
1808 _AKNTRACE_FUNC_ENTER; |
1320 if ( aEventType == EEventStateChanged ) |
1809 if ( AknLayoutUtils::PenEnabled() ) |
1321 { |
1810 { |
1322 // Something has been selected from CharMap |
1811 if(aEventType == EEventStateChanged) |
1323 iSpecialCharPointed = ETrue; |
1812 { |
|
1813 // Something has been selected from CharMap |
|
1814 iSpecialCharPointed = ETrue; |
|
1815 } |
1324 } |
1816 } |
1325 _AKNTRACE( "aEventType = %d", aEventType ); |
1817 _AKNTRACE( "aEventType = %d", aEventType ); |
1326 _AKNTRACE_FUNC_EXIT; |
1818 _AKNTRACE_FUNC_EXIT; |
1327 } |
1819 } |
1328 |
1820 |
1333 // |
1825 // |
1334 void CEikMenuPaneExtension::ImmediateFeedback( |
1826 void CEikMenuPaneExtension::ImmediateFeedback( |
1335 TTouchLogicalFeedback aType, |
1827 TTouchLogicalFeedback aType, |
1336 TTouchFeedbackType aFbType = TTouchFeedbackType( ETouchFeedbackAudio | |
1828 TTouchFeedbackType aFbType = TTouchFeedbackType( ETouchFeedbackAudio | |
1337 ETouchFeedbackVibra )) |
1829 ETouchFeedbackVibra )) |
1338 { |
1830 { |
1339 if( iFeedback && AknLayoutUtils::PenEnabled() ) |
1831 if ( iFeedback ) |
1340 { |
1832 { |
1341 iFeedback->InstantFeedback( iControl, aType, aFbType, TPointerEvent() ); |
1833 iFeedback->InstantFeedback( iControl, aType, aFbType, TPointerEvent() ); |
1342 } |
1834 } |
1343 } |
1835 } |
1344 |
1836 |
1345 |
1837 |
1346 // ----------------------------------------------------------------------------- |
1838 // ----------------------------------------------------------------------------- |
1347 // CEikMenuPaneExtension::PrepareCascadeForItemCommandsL |
1839 // CEikMenuPaneExtension::PrepareCascadeForItemCommands |
1348 // ----------------------------------------------------------------------------- |
1840 // ----------------------------------------------------------------------------- |
1349 // |
1841 // |
1350 void CEikMenuPaneExtension::PrepareCascadeForItemCommandsL() |
1842 void CEikMenuPaneExtension::PrepareCascadeForItemCommands() |
1351 { |
1843 { |
1352 if ( iFlags.IsSet( ESingleClickEnabled ) |
1844 if ( iFlags.IsSet( ESingleClickEnabled ) |
1353 && iControl->iOwner |
1845 && iControl->iOwner |
1354 && iControl->iOwner->iExtension ) |
1846 && iControl->iOwner->iExtension ) |
1355 { |
1847 { |
1356 const TBitFlags& ownerFlags( iControl->iOwner->iExtension->iFlags ); |
1848 const TBitFlags& ownerFlags( iControl->iOwner->iExtension->iFlags ); |
1357 if ( ownerFlags.IsSet( EContextSensitive ) ) |
1849 if ( ownerFlags.IsSet( EContextSensitive ) ) |
1358 { |
1850 { |
1359 iFlags.Set( EContextSensitive ); |
1851 iFlags.Set( EContextSensitive ); |
1360 } |
1852 } |
1361 else |
1853 else if ( ownerFlags.IsSet( EHideItemSpecificCommands ) ) |
1362 { |
1854 { |
1363 if ( ownerFlags.IsSet( EHideItemSpecificCommands ) ) |
1855 iControl->SetItemCommandsDimmed(); |
1364 { |
|
1365 iControl->SetItemCommandsStateL( ETrue ); |
|
1366 } |
|
1367 if ( ownerFlags.IsSet( EHideItemActionCommands ) ) |
|
1368 { |
|
1369 iControl->SetItemActionsStateL( ETrue ); |
|
1370 } |
|
1371 } |
1856 } |
1372 } |
1857 } |
1373 } |
1858 } |
1374 |
1859 |
1375 |
1860 |
1882 iEditMenuObserver = aEditMenuObserver; |
2360 iEditMenuObserver = aEditMenuObserver; |
1883 |
2361 |
1884 CheckCreateScrollerL(); |
2362 CheckCreateScrollerL(); |
1885 CheckCreateExtensionL(); |
2363 CheckCreateExtensionL(); |
1886 |
2364 |
|
2365 iExtension->iTransitionsOn = FeatureManager::FeatureSupported( KFeatureIdUiTransitionEffects ); |
|
2366 |
1887 CreateWindowL( iCoeEnv->RootWin() ); |
2367 CreateWindowL( iCoeEnv->RootWin() ); |
1888 EnableWindowTransparency(); |
2368 EnableWindowTransparency(); |
1889 SetAllowStrayPointers(); |
2369 SetAllowStrayPointers(); |
1890 EnableDragEvents(); |
2370 EnableDragEvents(); |
1891 |
2371 |
1892 iItemHeight = CalculateItemHeight(); |
2372 TAknWindowLineLayout menuLineLayout; |
|
2373 if ( iOwner ) // submenu |
|
2374 { |
|
2375 menuLineLayout = AknLayoutScalable_Avkon::list_single_popup_submenu_pane( 0 ).LayoutLine(); |
|
2376 } |
|
2377 else |
|
2378 { |
|
2379 menuLineLayout = AknLayoutScalable_Avkon::list_single_pane_cp2( 0 ).LayoutLine(); |
|
2380 } |
|
2381 |
|
2382 TRect windowRect = Rect(); |
|
2383 TAknLayoutRect menuLayoutRect; |
|
2384 menuLayoutRect.LayoutRect( windowRect, menuLineLayout ); |
|
2385 iItemHeight = menuLayoutRect.Rect().Height(); |
1893 |
2386 |
1894 if ( iExtension->iSct ) |
2387 if ( iExtension->iSct ) |
1895 { |
2388 { |
1896 RWindow* window = (RWindow*)this->DrawableWindow(); |
2389 RWindow* window = (RWindow*)this->DrawableWindow(); |
1897 iExtension->iMenuPaneWindow = window; |
2390 iExtension->iMenuPaneWindow = window; |
1898 iExtension->iSct->SetContainerWindowL( *this ); |
2391 iExtension->iSct->SetContainerWindowL( *this ); |
1899 |
2392 |
1900 // This is effectively the same as CCoeControl::EnableDragEvents() |
2393 if ( AknLayoutUtils::PenEnabled() ) |
1901 // which is protected. |
2394 { |
1902 window->PointerFilter( EPointerFilterDrag, 0 ); |
2395 // This is effectively the same as CCoeControl::EnableDragEvents() |
1903 iExtension->iSct->SetGloballyCapturing( ETrue ); |
2396 // which is protected. |
1904 iExtension->iSct->SetPointerCapture( ETrue ); |
2397 window->PointerFilter( EPointerFilterDrag, 0 ); |
1905 iExtension->iSct->SetObserver(iExtension); |
2398 iExtension->iSct->SetGloballyCapturing( ETrue ); |
|
2399 iExtension->iSct->SetPointerCapture( ETrue ); |
|
2400 iExtension->iSct->SetObserver(iExtension); |
|
2401 } |
1906 } |
2402 } |
1907 |
2403 |
1908 if ( iOwner ) // submenu |
2404 if ( iOwner ) // submenu |
1909 { |
2405 { |
1910 SetPointerCapture( ETrue ); |
2406 SetPointerCapture( ETrue ); |
2512 TInt previousTopItem = iScroller->TopItemIndex(); |
3037 TInt previousTopItem = iScroller->TopItemIndex(); |
2513 TInt previousSelectedItem = iSelectedItem; |
3038 TInt previousSelectedItem = iSelectedItem; |
2514 _AKNTRACE( "previousTopItem = %d", previousTopItem ); |
3039 _AKNTRACE( "previousTopItem = %d", previousTopItem ); |
2515 _AKNTRACE( "previousSelectedItem = %d", previousSelectedItem ); |
3040 _AKNTRACE( "previousSelectedItem = %d", previousSelectedItem ); |
2516 |
3041 |
2517 SetSelectedItem( aNewSelectedItem ); |
3042 ActivateGc(); |
2518 |
3043 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3044 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iExtension->iGc ); |
|
3045 if ( transApi ) |
|
3046 { |
|
3047 iExtension->iGc->Activate( *DrawableWindow() ); |
|
3048 } |
|
3049 CWindowGc& gc = transApi ? *iExtension->iGc : SystemGc(); |
|
3050 #else |
|
3051 CWindowGc& gc = SystemGc(); |
|
3052 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
3053 PrepareGcForDrawingItems( gc ); |
|
3054 |
|
3055 // Scrollers top item index must be updated first because setting selected |
|
3056 // item results in animation redraw (which requires knowledge about the |
|
3057 // current top item). |
2519 if ( aNewSelectedItem >= 0 ) |
3058 if ( aNewSelectedItem >= 0 ) |
2520 { |
3059 { |
2521 ScrollToMakeItemVisible( aNewSelectedItem ); |
3060 ScrollToMakeItemVisible( aNewSelectedItem ); |
2522 } |
3061 } |
2523 else |
3062 else |
2524 { |
3063 { |
2525 ScrollToMakeItemVisible( 0 ); |
3064 ScrollToMakeItemVisible( 0 ); |
2526 } |
3065 } |
2527 |
3066 |
2528 ActivateGc(); |
|
2529 CWindowGc& gc = SystemGc(); |
|
2530 PrepareGcForDrawingItems( gc ); |
|
2531 |
|
2532 TInt topItem = iScroller->TopItemIndex(); |
3067 TInt topItem = iScroller->TopItemIndex(); |
2533 TInt bottomItem = topItem + NumberOfItemsThatFitInView(); |
3068 TInt bottomItem = topItem + NumberOfItemsThatFitInView(); |
2534 if( bottomItem > NumberOfItemsInPane() ) |
3069 if( bottomItem > NumberOfItemsInPane() ) |
2535 { |
3070 { |
2536 bottomItem = NumberOfItemsInPane(); |
3071 bottomItem = NumberOfItemsInPane(); |
2542 if (iExtension->iSctHighlighted) |
3077 if (iExtension->iSctHighlighted) |
2543 { |
3078 { |
2544 DrawItem( gc, topItem, ERemoveHighlight ); |
3079 DrawItem( gc, topItem, ERemoveHighlight ); |
2545 DrawItem( gc, (bottomItem-1), ERemoveHighlight ); |
3080 DrawItem( gc, (bottomItem-1), ERemoveHighlight ); |
2546 } |
3081 } |
|
3082 SetSelectedItem( aNewSelectedItem ); |
2547 |
3083 |
2548 PrepareHighlightFrame(); |
3084 PrepareHighlightFrame(); |
2549 |
3085 |
2550 if ( previousTopItem == topItem && aNewSelectedItem >= 0 ) |
3086 if ( previousTopItem == topItem && aNewSelectedItem >= 0 ) |
2551 { |
3087 { |
2552 // then only previuosly and currently selected items should be redrawn |
3088 // then only previuosly and currently selected items should be redrawn |
2553 if ( iExtension->iHighlightedItem != KErrNotFound ) |
3089 DrawItem( gc, previousSelectedItem, ERemoveHighlight ); |
2554 { |
|
2555 DrawItem( gc, previousSelectedItem, ERemoveHighlight ); |
|
2556 } |
|
2557 |
3090 |
2558 if ( !iExtension->iSctHighlighted ) |
3091 if ( !iExtension->iSctHighlighted ) |
2559 { |
3092 { |
2560 DrawItem( gc, aNewSelectedItem, EDrawHighlight ); |
3093 DrawItem( gc, aNewSelectedItem, EDrawHighlight ); |
2561 } |
3094 } |
2562 } |
3095 } |
2563 |
3096 else |
|
3097 { |
|
3098 TBool skipHighlight = EFalse; |
|
3099 if (iExtension && iExtension->iSct && aNewSelectedItem == 0 && |
|
3100 previousSelectedItem > 1) |
|
3101 { |
|
3102 skipHighlight = ETrue; |
|
3103 } |
|
3104 for( TInt i = topItem; i<bottomItem; i++ ) |
|
3105 { |
|
3106 if( i == aNewSelectedItem && !skipHighlight) |
|
3107 { |
|
3108 DrawItem( gc, i, EDrawHighlight ); |
|
3109 } |
|
3110 else |
|
3111 { |
|
3112 DrawItem( gc, i, ERemoveHighlight ); |
|
3113 } |
|
3114 } |
|
3115 } |
|
3116 |
|
3117 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3118 if ( transApi ) |
|
3119 { |
|
3120 iExtension->iGc->Deactivate(); |
|
3121 } |
|
3122 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
2564 DeactivateGc(); |
3123 DeactivateGc(); |
|
3124 |
|
3125 UpdateScrollBarThumbs(); |
2565 |
3126 |
|
3127 // Updating view position here prevents some flickering |
|
3128 iExtension->ViewPositionChanged( iExtension->iViewPosition ); |
|
3129 |
2566 _AKNTRACE_FUNC_EXIT; |
3130 _AKNTRACE_FUNC_EXIT; |
2567 } |
3131 } |
2568 |
3132 |
2569 // ----------------------------------------------------------------------------- |
3133 // ----------------------------------------------------------------------------- |
2570 // CEikMenuPane::PrepareGcForDrawingItems |
3134 // CEikMenuPane::PrepareGcForDrawingItems |
2571 // ----------------------------------------------------------------------------- |
3135 // ----------------------------------------------------------------------------- |
2572 // |
3136 // |
2573 void CEikMenuPane::PrepareGcForDrawingItems(CGraphicsContext& aGc) const |
3137 void CEikMenuPane::PrepareGcForDrawingItems(CGraphicsContext& aGc) const |
2574 { |
3138 { |
|
3139 |
2575 // BIDI |
3140 // BIDI |
2576 /* |
3141 /* |
2577 * get the fonts from the LAF! |
3142 * get the fonts from the LAF! |
2578 * Do we need to get them here? - nope - moved to DrawItem() |
3143 * Do we need to get them here? - nope - moved to DrawItem() |
2579 */ |
3144 */ |
2580 aGc.SetPenColor( iEikonEnv->ControlColor( EColorMenuPaneText, *this) ); |
3145 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3146 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iExtension->iGc ); |
|
3147 if ( transApi ) |
|
3148 { |
|
3149 transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified ); |
|
3150 } |
|
3151 #endif |
|
3152 |
|
3153 aGc.SetPenColor(iEikonEnv->ControlColor( EColorMenuPaneText, *this) ); |
|
3154 #if defined(MENU_TEXTURED_BACKGROUND) |
|
3155 iEikonEnv->SetTexturedBrush( aGc ); |
|
3156 #else |
2581 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
3157 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
2582 aGc.SetBrushColor( iEikonEnv->ControlColor( EColorMenuPaneBackground,*this ) ); |
3158 aGc.SetBrushColor( iEikonEnv->ControlColor( EColorMenuPaneBackground,*this ) ); |
2583 } |
3159 #endif |
|
3160 |
|
3161 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3162 if ( transApi ) |
|
3163 { |
|
3164 transApi->StopDrawing(); |
|
3165 } |
|
3166 #endif |
|
3167 } |
|
3168 |
|
3169 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3170 /** |
|
3171 * Iterate through the visible items in a menu and calculate minimum |
|
3172 * item margins that dont need drawing. |
|
3173 */ |
|
3174 void CEikMenuPaneExtension::CalcItemSize( MAknListBoxTfxInternal* transApi ) const |
|
3175 { |
|
3176 if ( transApi && iControl->iItemArray && iControl->iItemArray->Count() ) |
|
3177 { |
|
3178 TRect marginRect(TRect::EUninitialized); |
|
3179 const TInt index = 0; |
|
3180 |
|
3181 // Specifies whether the text should be moved to give some space for icon. |
|
3182 TInt hasIcon = iControl->MenuHasIcon() ? 1 : 0; |
|
3183 |
|
3184 TAknWindowLineLayout menuPane( AKN_LAYOUT_WINDOW_list_menu_pane( 0 , 0 ) ); |
|
3185 TAknWindowLineLayout singleMenuPane( |
|
3186 AKN_LAYOUT_WINDOW_list_single_popup_menu_pane( index ) ); |
|
3187 TAknTextLineLayout menuTextLayout( |
|
3188 AKN_LAYOUT_TEXT_List_pane_texts__menu_single__Line_1(0) ); |
|
3189 |
|
3190 TAknLayoutRect menuPaneRect; |
|
3191 TAknLayoutRect singleMenuPaneRect; |
|
3192 TAknLayoutText textRect; |
|
3193 |
|
3194 TBool hasCascade = EFalse; |
|
3195 TBool hasNonCascade = EFalse; |
|
3196 |
|
3197 // number of items in the whole menu |
|
3198 for(TInt i = 0; i < iControl->iItemArray->Count(); i++) |
|
3199 { |
|
3200 CEikMenuPaneItem* item = (*iControl->iItemArray)[i]; |
|
3201 |
|
3202 // true if a cascade symbol must be drawn (main menu only) |
|
3203 TBool cascade = item->iData.iCascadeId != 0; |
|
3204 |
|
3205 if ( cascade ) |
|
3206 { |
|
3207 if ( hasCascade ) |
|
3208 { |
|
3209 if ( hasNonCascade ) |
|
3210 { |
|
3211 break; |
|
3212 } |
|
3213 continue; |
|
3214 } |
|
3215 hasCascade = ETrue; |
|
3216 } |
|
3217 else |
|
3218 { |
|
3219 if ( hasNonCascade ) |
|
3220 { |
|
3221 if ( hasCascade ) |
|
3222 { |
|
3223 break; |
|
3224 } |
|
3225 continue; |
|
3226 } |
|
3227 hasNonCascade = ETrue; |
|
3228 } |
|
3229 |
|
3230 if ( !iControl->iOwner ) |
|
3231 { |
|
3232 TAknWindowLineLayout listScrollPaneLayout( |
|
3233 AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() ); |
|
3234 AdjustPopupLayoutData( listScrollPaneLayout ); |
|
3235 TAknLayoutRect listScrollPaneRect; |
|
3236 listScrollPaneRect.LayoutRect( iControl->Rect(), listScrollPaneLayout ); |
|
3237 |
|
3238 menuPane = AknLayoutScalable_Avkon::list_menu_pane( 0 ).LayoutLine(); |
|
3239 menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), menuPane ); |
|
3240 |
|
3241 singleMenuPane = AknLayoutScalable_Avkon::list_single_pane_cp2( index ).LayoutLine(); |
|
3242 singleMenuPaneRect.LayoutRect( menuPaneRect.Rect(), singleMenuPane ); |
|
3243 |
|
3244 menuTextLayout = AknLayoutScalable_Avkon::list_single_pane_t1_cp2( cascade ? 3 : 0 ).LayoutLine(); |
|
3245 } |
|
3246 else // Submenu |
|
3247 { |
|
3248 TBool hasDoubleSpanScrollBar = EFalse; |
|
3249 if ( iControl->iOwner && iControl->iSBFrame && |
|
3250 iControl->iSBFrame->VScrollBarVisibility() ) |
|
3251 { |
|
3252 hasDoubleSpanScrollBar = ETrue; |
|
3253 } |
|
3254 TAknWindowLineLayout listScrollPaneLayout( AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
|
3255 TAknLayoutRect listScrollPaneRect; |
|
3256 listScrollPaneRect.LayoutRect( iControl->Rect(), listScrollPaneLayout ); |
|
3257 |
|
3258 menuPane = AknLayoutScalable_Avkon::list_submenu_pane( !hasDoubleSpanScrollBar ).LayoutLine(); |
|
3259 menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), menuPane ); |
|
3260 |
|
3261 singleMenuPane = AknLayoutScalable_Avkon::list_single_popup_submenu_pane( index ).LayoutLine(); |
|
3262 singleMenuPaneRect.LayoutRect( menuPaneRect.Rect(), singleMenuPane ); |
|
3263 |
|
3264 menuTextLayout = TAknTextLineLayout( AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( hasIcon ).LayoutLine() ); |
|
3265 } |
|
3266 |
|
3267 textRect.LayoutText( singleMenuPaneRect.Rect(), menuTextLayout ); |
|
3268 if (marginRect == TRect::EUninitialized) |
|
3269 { |
|
3270 marginRect = textRect.TextRect(); |
|
3271 } |
|
3272 else |
|
3273 { |
|
3274 marginRect.BoundingRect(textRect.TextRect()); |
|
3275 } |
|
3276 |
|
3277 if ( cascade ) |
|
3278 { |
|
3279 TAknWindowLineLayout elementCascade( AknLayoutScalable_Avkon::list_single_pane_cp2_g3().LayoutLine()); |
|
3280 TAknLayoutRect cascadeRect; |
|
3281 cascadeRect.LayoutRect( singleMenuPaneRect.Rect(), elementCascade ); |
|
3282 marginRect.BoundingRect(cascadeRect.Rect()); |
|
3283 } |
|
3284 else |
|
3285 { |
|
3286 TAknLayoutRect activeApplicationsIconRect; |
|
3287 activeApplicationsIconRect.LayoutRect( singleMenuPaneRect.Rect(), |
|
3288 AknLayoutScalable_Avkon::list_single_pane_g1_cp2(0).LayoutLine() ); |
|
3289 marginRect.BoundingRect(activeApplicationsIconRect.Rect()); |
|
3290 } |
|
3291 } |
|
3292 |
|
3293 if ( hasIcon ) |
|
3294 { |
|
3295 TAknLayoutRect iconLayoutRect; |
|
3296 iconLayoutRect.LayoutRect( singleMenuPaneRect.Rect(), |
|
3297 AknLayoutScalable_Avkon::list_single_popup_submenu_pane_g1().LayoutLine() ); |
|
3298 marginRect.BoundingRect(iconLayoutRect.Rect()); |
|
3299 } |
|
3300 |
|
3301 //send margins to tfx |
|
3302 TPoint tl ( marginRect.iTl - menuPaneRect.Rect().iTl ); |
|
3303 transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, tl ); |
|
3304 |
|
3305 TPoint br( singleMenuPaneRect.Rect().Size().AsPoint() - marginRect.iBr + menuPaneRect.Rect().iTl ); |
|
3306 transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, br ); |
|
3307 } |
|
3308 } |
|
3309 #endif |
2584 |
3310 |
2585 |
3311 |
2586 // --------------------------------------------------------------------------- |
3312 // --------------------------------------------------------------------------- |
2587 // CEikMenuPane::DrawItem |
3313 // CEikMenuPane::DrawItem |
2588 // --------------------------------------------------------------------------- |
3314 // --------------------------------------------------------------------------- |
2589 // |
3315 // |
2590 void CEikMenuPane::DrawItem( TInt aItem, THighlightType aHighlight ) const |
3316 void CEikMenuPane::DrawItem( TInt aItem, THighlightType aHighlight ) const |
2591 { |
3317 { |
2592 ActivateGc(); |
3318 ActivateGc(); |
|
3319 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3320 MAknListBoxTfxInternal* transApi = |
|
3321 CAknListLoader::TfxApiInternal( iExtension->iGc ); |
|
3322 |
|
3323 if ( transApi ) |
|
3324 { |
|
3325 iExtension->iGc->Activate( *DrawableWindow() ); |
|
3326 } |
|
3327 |
|
3328 CWindowGc& gc = transApi ? *iExtension->iGc : SystemGc(); |
|
3329 #else |
2593 CWindowGc& gc = SystemGc(); |
3330 CWindowGc& gc = SystemGc(); |
|
3331 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
2594 PrepareGcForDrawingItems( gc ); |
3332 PrepareGcForDrawingItems( gc ); |
2595 DrawItem( gc, aItem, aHighlight ); |
3333 DrawItem( gc, aItem, aHighlight ); |
|
3334 |
|
3335 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3336 if ( transApi ) |
|
3337 { |
|
3338 iExtension->iGc->Deactivate(); |
|
3339 } |
|
3340 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
2596 DeactivateGc(); |
3341 DeactivateGc(); |
2597 } |
3342 } |
2598 |
3343 |
2599 |
3344 |
2600 // --------------------------------------------------------------------------- |
3345 // --------------------------------------------------------------------------- |
2669 if ( index < 0 || index >= maxNumberOfItems || (iExtension->iSct && index==0)) |
3419 if ( index < 0 || index >= maxNumberOfItems || (iExtension->iSct && index==0)) |
2670 { |
3420 { |
2671 return; // only interested in drawing visible items |
3421 return; // only interested in drawing visible items |
2672 } |
3422 } |
2673 |
3423 |
2674 TAknTextLineLayout menuTextLayout; |
3424 // Collect all of the information from the Layout DLL. Initialise these |
|
3425 // variables with DUMMY data. Then replace it with menu/submenu data. |
|
3426 TAknWindowLineLayout menuPane( AKN_LAYOUT_WINDOW_list_menu_pane( 0 , 0 ) ); |
|
3427 TAknWindowLineLayout singleMenuPane( |
|
3428 AKN_LAYOUT_WINDOW_list_single_popup_menu_pane( index ) ); |
|
3429 TAknTextLineLayout menuTextLayout( |
|
3430 AKN_LAYOUT_TEXT_List_pane_texts__menu_single__Line_1(0) ); |
|
3431 TAknLayoutRect menuPaneRect; |
2675 TAknLayoutRect singleMenuPaneRect; |
3432 TAknLayoutRect singleMenuPaneRect; |
2676 |
3433 |
2677 if ( !iOwner ) // main menu |
3434 if ( !iOwner ) |
2678 { |
3435 { |
2679 singleMenuPaneRect.LayoutRect( iExtension->iItemAreaRect, |
3436 TAknWindowLineLayout listScrollPaneLayout( |
2680 AknLayoutScalable_Avkon::list_single_pane_cp2( index ).LayoutLine() ); |
3437 AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() ); |
2681 menuTextLayout = |
3438 if ( iExtension ) |
2682 AknLayoutScalable_Avkon::list_single_pane_t1_cp2( cascade ? 1 : 0 ).LayoutLine(); |
3439 { |
2683 } |
3440 iExtension->AdjustPopupLayoutData( listScrollPaneLayout ); |
2684 else // submenu |
3441 } |
2685 { |
3442 TAknLayoutRect listScrollPaneRect; |
2686 singleMenuPaneRect.LayoutRect( iExtension->iItemAreaRect, |
3443 listScrollPaneRect.LayoutRect( windowRect, listScrollPaneLayout ); |
2687 AknLayoutScalable_Avkon::list_single_popup_submenu_pane( index ).LayoutLine() ); |
3444 |
2688 |
3445 menuPane = AknLayoutScalable_Avkon::list_menu_pane( 0 ).LayoutLine(); |
|
3446 menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), menuPane ); |
|
3447 |
|
3448 singleMenuPane = AknLayoutScalable_Avkon::list_single_pane_cp2( index ).LayoutLine(); |
|
3449 singleMenuPaneRect.LayoutRect( menuPaneRect.Rect(), singleMenuPane ); |
|
3450 |
|
3451 menuTextLayout = AknLayoutScalable_Avkon::list_single_pane_t1_cp2( cascade ? 3 : 0 ).LayoutLine(); |
|
3452 } |
|
3453 else // Submenu |
|
3454 { |
|
3455 TBool hasDoubleSpanScrollBar = EFalse; |
|
3456 if ( iSBFrame && iSBFrame->VScrollBarVisibility() ) |
|
3457 { |
|
3458 hasDoubleSpanScrollBar = ETrue; |
|
3459 } |
|
3460 |
|
3461 TAknWindowLineLayout listScrollPaneLayout( AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
|
3462 TAknLayoutRect listScrollPaneRect; |
|
3463 listScrollPaneRect.LayoutRect( windowRect, listScrollPaneLayout ); |
|
3464 |
|
3465 menuPane = AknLayoutScalable_Avkon::list_submenu_pane( !hasDoubleSpanScrollBar ).LayoutLine(); |
|
3466 menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), menuPane ); |
|
3467 |
|
3468 singleMenuPane = AknLayoutScalable_Avkon::list_single_popup_submenu_pane( index ).LayoutLine(); |
|
3469 singleMenuPaneRect.LayoutRect( menuPaneRect.Rect(), singleMenuPane ); |
|
3470 |
|
3471 menuTextLayout = TAknTextLineLayout( AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 0 ).LayoutLine() ); |
|
3472 |
2689 if ( hasIcon ) |
3473 if ( hasIcon ) |
2690 { |
3474 { |
2691 menuTextLayout = |
3475 menuTextLayout = TAknTextLineLayout( AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 1 ).LayoutLine() ); |
2692 TAknTextLineLayout( |
|
2693 AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 1 ).LayoutLine() ); |
|
2694 } |
|
2695 else |
|
2696 { |
|
2697 menuTextLayout = |
|
2698 TAknTextLineLayout( |
|
2699 AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 0 ).LayoutLine() ); |
|
2700 } |
3476 } |
2701 } |
3477 } |
2702 |
3478 |
2703 TRect itemRect( singleMenuPaneRect.Rect() ); |
3479 TRect itemRect( singleMenuPaneRect.Rect() ); |
2704 |
3480 |
2714 |
3490 |
2715 TBool drawingInitiated = ETrue; |
3491 TBool drawingInitiated = ETrue; |
2716 |
3492 |
2717 RWindow& window = Window(); |
3493 RWindow& window = Window(); |
2718 |
3494 |
2719 if ( &window && window.GetDrawRect() == TRect::EUninitialized ) |
3495 if ( &window && window.GetDrawRect() == TRect::EUninitialized ) |
2720 { |
3496 { |
|
3497 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3498 MAknListBoxTfxInternal* transApi = |
|
3499 CAknListLoader::TfxApiInternal( &aGc ); |
|
3500 drawingInitiated = transApi && !transApi->EffectsDisabled(); |
|
3501 #else |
2721 drawingInitiated = EFalse; |
3502 drawingInitiated = EFalse; |
2722 } |
3503 #endif |
2723 |
3504 } |
2724 if ( !drawingInitiated && !iExtension->iFullRedraw ) |
3505 |
2725 { |
3506 if ( !drawingInitiated ) |
2726 TRect drawRect( itemRect ); |
3507 { |
2727 drawRect.Intersection( iExtension->iItemAreaRect ); |
3508 window.Invalidate( itemRect ); |
2728 window.Invalidate( drawRect ); |
3509 window.BeginRedraw( itemRect ); |
2729 window.BeginRedraw( drawRect ); |
|
2730 } |
3510 } |
2731 |
3511 |
2732 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
3512 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
2733 MAknsControlContext* cc = NULL; |
3513 MAknsControlContext* cc = NULL; |
2734 if( iExtension ) |
3514 if( iExtension ) |
2735 { |
3515 { |
2736 cc = iExtension->iBgContext; |
3516 cc = iExtension->iBgContext; |
2737 } |
3517 } |
2738 TBool background( ETrue ); |
3518 TBool background( ETrue ); |
2739 |
3519 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2740 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
3520 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc ); |
2741 aGc.SetBrushColor( singleMenuPaneRect.Color() ); |
3521 if ( transApi && !transApi->EffectsDisabled() ) |
2742 |
3522 { |
2743 // there can be partial items, so clip drawing on menu pane's item area |
3523 iExtension->iGc->Activate( *DrawableWindow() ); |
2744 aGc.SetClippingRect( iExtension->iItemAreaRect ); |
3524 } |
2745 |
3525 #endif |
2746 if (!iExtension->iFullRedraw) |
3526 |
2747 { |
3527 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2748 background = AknsDrawUtils::Background( |
3528 if ( !transApi || transApi->EffectsDisabled() ) |
2749 skin, cc, this, aGc, itemRect, |
3529 { |
2750 KAknsDrawParamNoClearUnderImage ); |
3530 #endif |
2751 } |
|
2752 |
|
2753 if ( !background ) |
|
2754 { |
|
2755 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
3531 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
2756 aGc.SetPenStyle( CGraphicsContext::ENullPen ); |
3532 aGc.SetBrushColor( singleMenuPaneRect.Color() ); |
2757 aGc.SetPenColor( singleMenuPaneRect.Color() ); |
3533 |
2758 aGc.SetBrushColor( singleMenuPaneRect.Color() ); |
3534 if(!iExtension->iFullRedraw) |
2759 aGc.DrawRect( itemRect ); |
3535 { |
2760 } |
3536 background = AknsDrawUtils::Background( |
|
3537 skin, cc, this, aGc, itemRect, |
|
3538 KAknsDrawParamNoClearUnderImage ); |
|
3539 } |
|
3540 |
|
3541 if( !background ) |
|
3542 { |
|
3543 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
3544 aGc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
3545 aGc.SetPenColor( singleMenuPaneRect.Color() ); |
|
3546 aGc.SetBrushColor( singleMenuPaneRect.Color() ); |
|
3547 aGc.DrawRect( itemRect ); |
|
3548 } |
|
3549 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3550 } |
|
3551 #endif |
2761 |
3552 |
2762 if ( !iExtension->HighlightEnabled() ) |
3553 if ( !iExtension->HighlightEnabled() ) |
2763 { |
3554 { |
2764 aHighlight = ENoHighlight; |
3555 aHighlight = ENoHighlight; |
2765 } |
3556 } |
2766 |
3557 |
2767 switch ( aHighlight ) |
3558 switch ( aHighlight ) |
2768 { |
3559 { |
2769 case EDrawHighlight : |
3560 case EDrawHighlight : |
2770 { |
3561 { |
2771 if ( !iExtension->iSctHighlighted ) |
3562 if ( !iExtension->iSctHighlighted ) |
2772 { |
3563 { |
2773 iExtension->iHighlightedItem = aItem; |
3564 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2774 |
3565 if ( transApi ) |
2775 // Because of transparency, background must be drawn here as well |
3566 { |
2776 // (as frame may be see-through) |
3567 // This will remove the old bitmap |
2777 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
3568 transApi->Invalidate( MAknListBoxTfxInternal::EListHighlight ); |
2778 aGc.SetBrushColor( singleMenuPaneRect.Color() ); |
3569 |
2779 |
3570 transApi->BeginRedraw( MAknListBoxTfxInternal::EListHighlight, |
2780 AknsDrawUtils::Background( |
3571 itemRect ); |
2781 skin, cc, this, aGc, itemRect, |
3572 transApi->StartDrawing( MAknListBoxTfxInternal::EListHighlight ); |
2782 KAknsDrawParamNoClearUnderImage ); |
3573 } |
2783 |
3574 #endif |
2784 TAknLayoutRect highlightTopLeft; |
3575 |
2785 TAknLayoutRect highlightBottomRight; |
3576 // Partial items, so prevent drawing over the edge of menu pane |
2786 |
3577 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2787 highlightTopLeft.LayoutRect(itemRect, |
3578 if ( !transApi || ( transApi && transApi->EffectsDisabled() ) ) |
2788 SkinLayout::List_highlight_skin_placing__popup_windows__Line_2() ); |
3579 { |
2789 highlightBottomRight.LayoutRect(itemRect, |
3580 aGc.SetClippingRect(menuPaneRect.Rect()); |
2790 SkinLayout::List_highlight_skin_placing__popup_windows__Line_5() ); |
3581 } |
2791 TRect outerRect( highlightTopLeft.Rect().iTl, highlightBottomRight.Rect().iBr ); |
3582 #else |
2792 TRect innerRect( highlightTopLeft.Rect().iBr, highlightBottomRight.Rect().iTl ); |
3583 aGc.SetClippingRect(menuPaneRect.Rect()); |
2793 |
3584 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
2794 TBool drawOk = AknsDrawUtils::DrawFrame( skin, |
3585 |
2795 aGc, |
3586 TBool drawOk = EFalse; |
2796 outerRect, |
3587 if( iExtension->iAnimation ) // Draw animated highlight |
2797 innerRect, |
3588 { |
2798 KAknsIIDQsnFrList, |
3589 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2799 KAknsIIDDefault ); |
3590 if ( transApi && transApi->VerifyKml() == KErrNone ) |
2800 |
3591 { |
2801 // skinned highlight drawing has failed |
3592 Extension()->UseNoAnimation(); |
2802 if ( !drawOk ) |
3593 } |
|
3594 else |
|
3595 { |
|
3596 #endif |
|
3597 TAknLayoutRect highlightTopLeft; |
|
3598 TAknLayoutRect highlightBottomRight; |
|
3599 |
|
3600 highlightTopLeft.LayoutRect( itemRect, |
|
3601 SkinLayout::List_highlight_skin_placing__popup_windows__Line_2() ); |
|
3602 highlightBottomRight.LayoutRect( itemRect, |
|
3603 SkinLayout::List_highlight_skin_placing__popup_windows__Line_5() ); |
|
3604 |
|
3605 TRect outerRect( highlightTopLeft.Rect().iTl, highlightBottomRight.Rect().iBr ); |
|
3606 |
|
3607 drawOk = iExtension->iAnimation->Render( aGc, outerRect ); |
|
3608 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3609 } |
|
3610 #endif |
|
3611 } |
|
3612 |
|
3613 if( !drawOk ) |
|
3614 { |
|
3615 // Animated highlight was not available, use normal skinned |
|
3616 // rendering. |
|
3617 |
|
3618 // Because of transparency, background must be drawn here as well |
|
3619 // (as frame may be see-through) |
|
3620 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
3621 aGc.SetBrushColor( singleMenuPaneRect.Color() ); |
|
3622 |
|
3623 AknsDrawUtils::Background( |
|
3624 skin, cc, this, aGc, itemRect, |
|
3625 KAknsDrawParamNoClearUnderImage ); |
|
3626 |
|
3627 TAknLayoutRect highlightTopLeft; |
|
3628 TAknLayoutRect highlightBottomRight; |
|
3629 |
|
3630 highlightTopLeft.LayoutRect(itemRect, |
|
3631 SkinLayout::List_highlight_skin_placing__popup_windows__Line_2() ); |
|
3632 highlightBottomRight.LayoutRect(itemRect, |
|
3633 SkinLayout::List_highlight_skin_placing__popup_windows__Line_5() ); |
|
3634 TRect outerRect( highlightTopLeft.Rect().iTl, highlightBottomRight.Rect().iBr ); |
|
3635 TRect innerRect( highlightTopLeft.Rect().iBr, highlightBottomRight.Rect().iTl ); |
|
3636 |
|
3637 drawOk = AknsDrawUtils::DrawFrame( skin, |
|
3638 aGc, |
|
3639 outerRect, |
|
3640 innerRect, |
|
3641 KAknsIIDQsnFrList, |
|
3642 KAknsIIDDefault ); |
|
3643 |
|
3644 } |
|
3645 |
|
3646 // Both animated highlight and normal highlight drawing have |
|
3647 // failed. |
|
3648 if( !drawOk ) |
2803 { |
3649 { |
2804 TAknLayoutRect shadowRect; |
3650 TAknLayoutRect shadowRect; |
2805 TAknLayoutRect highlightRect; |
3651 TAknLayoutRect highlightRect; |
2806 shadowRect.LayoutRect( itemRect, |
3652 shadowRect.LayoutRect( itemRect, |
2807 AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_1( itemRect ) ); |
3653 AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_1( itemRect ) ); |
2981 TRect cascRect( textRect.TextRect() ); |
3844 TRect cascRect( textRect.TextRect() ); |
2982 cascRect.Move( position ); |
3845 cascRect.Move( position ); |
2983 iExtension->iCascadeDRect.SetRect( cascRect.iTl, cascRect.iBr ); |
3846 iExtension->iCascadeDRect.SetRect( cascRect.iTl, cascRect.iBr ); |
2984 } |
3847 } |
2985 |
3848 |
2986 TAknLayoutRect highlightRect; |
3849 if(iExtension->iIsPenEnable) |
2987 highlightRect.LayoutRect( itemRect, |
3850 { |
2988 AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_2( itemRect ) ); |
3851 TAknLayoutRect highlightRect; |
2989 |
3852 highlightRect.LayoutRect( itemRect, |
2990 // store the calculated y-position to the menu item, |
3853 AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_2( itemRect ) ); |
2991 // so that it can be used in HandlePointerEventL() |
3854 |
2992 item->iPos = highlightRect.Rect().iTl.iY; |
3855 // store the calculated y-position to the menu item, |
2993 |
3856 // so that it can be used in HandlePointerEventL() |
2994 // don't draw separator line for the last item |
3857 item->iPos = highlightRect.Rect().iTl.iY; |
2995 if ( drawSeparator ) |
3858 aGc.DiscardFont(); |
2996 { |
3859 } |
2997 AknListUtils::DrawSeparator( aGc, itemRect, textColor, skin ); |
3860 |
2998 } |
3861 if ( !drawingInitiated ) |
2999 |
|
3000 if ( !drawingInitiated && !iExtension->iFullRedraw ) |
|
3001 { |
3862 { |
3002 Window().EndRedraw(); |
3863 Window().EndRedraw(); |
3003 } |
3864 } |
3004 |
3865 |
3005 aGc.CancelClippingRect(); |
3866 aGc.CancelClippingRect(); |
|
3867 |
|
3868 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3869 if ( transApi && !transApi->EffectsDisabled() ) |
|
3870 { |
|
3871 transApi->StopDrawing(); |
|
3872 transApi->EndRedraw( MAknListBoxTfxInternal::EListItem, aItem ); |
|
3873 iExtension->iGc->Deactivate(); |
|
3874 } |
|
3875 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
3006 } |
3876 } |
3007 |
3877 |
3008 |
3878 |
3009 // ----------------------------------------------------------------------------- |
3879 // ----------------------------------------------------------------------------- |
3010 // CEikMenuPane::Draw |
3880 // CEikMenuPane::Draw |
3011 // ----------------------------------------------------------------------------- |
3881 // ----------------------------------------------------------------------------- |
3012 // |
3882 // |
|
3883 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3013 EXPORT_C void CEikMenuPane::Draw( const TRect& aRect ) const |
3884 EXPORT_C void CEikMenuPane::Draw( const TRect& aRect ) const |
3014 { |
3885 { |
|
3886 CWindowGc& gc = ( iExtension && iExtension->iGc ) ? |
|
3887 *iExtension->iGc : SystemGc(); |
|
3888 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &gc ); |
|
3889 |
|
3890 if ( transApi ) |
|
3891 { |
|
3892 iExtension->iGc->Activate( *DrawableWindow() ); |
|
3893 |
|
3894 if ( !transApi->EffectsDisabled() ) |
|
3895 { |
|
3896 if ( iExtension->iScrollBarRect.iTl.iX <= aRect.iTl.iX && |
|
3897 iExtension->iScrollBarRect.iBr.iX >= aRect.iBr.iX ) |
|
3898 { |
|
3899 transApi->BeginRedraw( MAknListBoxTfxInternal::EListUpdateRect, aRect ); |
|
3900 iExtension->iGc->Deactivate(); |
|
3901 return; |
|
3902 } |
|
3903 |
|
3904 iExtension->CalcItemSize( transApi ); |
|
3905 } |
|
3906 } |
|
3907 #else |
|
3908 EXPORT_C void CEikMenuPane::Draw(const TRect& /*aRect*/) const |
|
3909 { |
|
3910 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
3911 |
|
3912 TRect windowRect( Rect() ); |
3015 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
3913 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
3016 MAknsControlContext* cc = NULL; |
3914 MAknsControlContext* cc = NULL; |
3017 |
3915 |
3018 if( iExtension ) |
3916 if( iExtension ) |
3019 { |
3917 { |
3020 cc = iExtension->iBgContext; |
3918 cc = iExtension->iBgContext; |
3021 } |
3919 } |
3022 |
3920 |
|
3921 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3922 if ( transApi ) |
|
3923 { |
|
3924 transApi->SetListType( MAknListBoxTfxInternal::EListBoxTypeMenuPane ); |
|
3925 transApi->BeginRedraw( MAknListBoxTfxInternal::EListView, windowRect ); |
|
3926 } |
|
3927 #else |
3023 CWindowGc& gc = SystemGc(); |
3928 CWindowGc& gc = SystemGc(); |
|
3929 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
3024 PrepareGcForDrawingItems( gc ); |
3930 PrepareGcForDrawingItems( gc ); |
|
3931 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3932 if ( transApi ) |
|
3933 { |
|
3934 transApi->StartDrawing( MAknListBoxTfxInternal::EListView ); |
|
3935 } |
|
3936 #endif |
|
3937 |
|
3938 if ( !IsCascadeMenuPane() ) |
|
3939 { |
|
3940 CFbsBitmap* cbaExtension = AknsUtils::GetCachedBitmap( skin, KAknsIIDQsnBgSlicePopup ); |
|
3941 if ( cbaExtension ) |
|
3942 { |
|
3943 TAknLayoutRect sliceRect; |
|
3944 sliceRect.LayoutRect( windowRect, SkinLayout::Popup_windows_skin_placing__background_slice__Line_2() ); |
|
3945 AknIconUtils::SetSize( cbaExtension, sliceRect.Rect().Size() ); |
|
3946 gc.BitBlt( TPoint( windowRect.iTl.iX, windowRect.iBr.iY-cbaExtension->SizeInPixels().iHeight ), cbaExtension ); |
|
3947 windowRect.iBr.iY -=2; // two used as margin when rect layouts were done |
|
3948 } |
|
3949 } |
3025 |
3950 |
3026 TInt count=0; |
3951 TInt count=0; |
3027 |
|
3028 if( iItemArray ) |
3952 if( iItemArray ) |
3029 { |
3953 { |
3030 count=iItemArray->Count(); |
3954 count=iItemArray->Count(); |
3031 } |
3955 } |
3032 |
3956 |
3033 // Give the topmost menu item's rect to SCT if needed. |
3957 // Give the topmost menu item's rect to SCT if needed. |
3034 if ( iExtension->iSct ) |
3958 if ( iExtension->iSct ) |
3035 { |
3959 { |
3036 iExtension->iSct->SetMenuSctRect( ItemRect( 0 ) ); |
3960 TAknLayoutRect listScrollPaneRect; |
3037 |
3961 TAknLayoutRect menuPaneRect; |
|
3962 TAknLayoutRect singleMenuPaneRect; |
|
3963 |
|
3964 TAknWindowLineLayout listScrollPaneLayout( |
|
3965 AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() ); |
|
3966 if ( iExtension ) |
|
3967 { |
|
3968 iExtension->AdjustPopupLayoutData( listScrollPaneLayout ); |
|
3969 } |
|
3970 listScrollPaneRect.LayoutRect( windowRect, listScrollPaneLayout ); |
|
3971 menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), |
|
3972 AknLayoutScalable_Avkon::list_menu_pane( 0 ).LayoutLine() ); |
|
3973 singleMenuPaneRect.LayoutRect( menuPaneRect.Rect(), |
|
3974 AknLayoutScalable_Avkon::list_single_pane_cp2( 0 ).LayoutLine() ); |
|
3975 // Give the rect of the first menu item to SCT. |
|
3976 iExtension->iSct->SetMenuSctRect( singleMenuPaneRect.Rect() ); |
|
3977 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3978 if( transApi ) |
|
3979 { |
|
3980 iExtension->iSctRect = singleMenuPaneRect.Rect(); |
|
3981 TAknLayoutRect cellLayRect; |
|
3982 cellLayRect.LayoutRect( iExtension->iSctRect, |
|
3983 AknLayoutScalable_Avkon::cell_graphic_popup_pane( 0, 0, 0 ) ); |
|
3984 iExtension->iSctRect.iTl.iX -= 1; |
|
3985 iExtension->iSctRect.iTl.iY -= 1; |
|
3986 iExtension->iSctRect.iBr.iX += 3; |
|
3987 transApi->ResetNonDrawingRects(); |
|
3988 transApi->AddNonDrawingRect( iExtension->iScrollBarRect ); |
|
3989 transApi->AddNonDrawingRect( iExtension->iSctRect ); |
|
3990 } |
|
3991 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
3992 } |
|
3993 |
|
3994 if ( iExtension->iSct ) |
|
3995 { |
3038 TRegionFix<4> region; |
3996 TRegionFix<4> region; |
3039 region.AddRect( aRect ); |
3997 region.AddRect( Rect() ); |
3040 region.SubRect( iExtension->iSct->Rect() ); |
3998 region.SubRect( iExtension->iSct->Rect() ); |
3041 gc.SetClippingRegion( region ); |
3999 gc.SetClippingRegion( region ); |
3042 } |
4000 } |
|
4001 |
|
4002 TRect backgroundRect( iOwner ? windowRect : iExtension->GetBackgroundRect( windowRect ) ); |
3043 |
4003 |
3044 // The added flag removes the white bg for transparency |
4004 // The added flag removes the white bg for transparency |
3045 TBool frameDrawn = AknsDrawUtils::Background( |
4005 TBool frameDrawn = AknsDrawUtils::Background( |
3046 skin, cc, this, gc, aRect, KAknsDrawParamNoClearUnderImage ); |
4006 skin, cc, this, gc, backgroundRect, KAknsDrawParamNoClearUnderImage ); |
3047 |
4007 |
3048 if ( aRect.Intersects( iExtension->iItemAreaRect ) ) |
4008 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3049 { |
4009 if ( transApi ) |
3050 iExtension->iFullRedraw = ETrue; |
4010 { |
3051 |
4011 transApi->StopDrawing(); |
3052 for ( TInt ii=0;ii<count;++ii ) |
4012 } |
3053 { |
4013 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
3054 if(!iExtension->iSctHighlighted && ii == iSelectedItem ) |
4014 |
3055 DrawItem( gc, ii, EDrawHighlight); |
4015 iExtension->iFullRedraw = ETrue; |
3056 else |
4016 |
3057 DrawItem( gc, ii, ENoHighlight); |
4017 for ( TInt ii=0;ii<count;++ii ) |
3058 } |
4018 { |
3059 |
4019 if(!iExtension->iSctHighlighted && ii == iSelectedItem ) |
3060 iExtension->iFullRedraw = EFalse; |
4020 DrawItem( gc, ii, EDrawHighlight); |
3061 } |
4021 else |
|
4022 DrawItem( gc, ii, ENoHighlight); |
|
4023 } |
|
4024 |
|
4025 iExtension->iFullRedraw = EFalse; |
3062 |
4026 |
3063 if ( iExtension->iSct ) |
4027 if ( iExtension->iSct ) |
3064 { |
4028 { |
|
4029 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
4030 if ( transApi ) |
|
4031 { |
|
4032 transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified ); |
|
4033 } |
|
4034 #endif |
3065 gc.CancelClippingRegion(); |
4035 gc.CancelClippingRegion(); |
3066 } |
4036 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
4037 if ( transApi ) |
|
4038 { |
|
4039 transApi->StopDrawing(); |
|
4040 } |
|
4041 #endif |
|
4042 } |
|
4043 |
|
4044 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
4045 if ( transApi ) |
|
4046 { |
|
4047 transApi->EndViewRedraw( aRect ); |
|
4048 iExtension->iGc->Deactivate(); |
|
4049 } |
|
4050 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
3067 } |
4051 } |
3068 |
4052 |
3069 |
4053 |
3070 // ----------------------------------------------------------------------------- |
4054 // ----------------------------------------------------------------------------- |
3071 // CEikMenuPane::ReportSelectionMadeL |
4055 // CEikMenuPane::ReportSelectionMadeL |
3391 TInt newHighlight = iSelectedItem; |
4368 TInt newHighlight = iSelectedItem; |
3392 TBool loopScrolling = ETrue; |
4369 TBool loopScrolling = ETrue; |
3393 TInt itemAfterLastItem = loopScrolling ? 0 : max; |
4370 TInt itemAfterLastItem = loopScrolling ? 0 : max; |
3394 TInt itemAfterFirstItem = loopScrolling ? max : 0; |
4371 TInt itemAfterFirstItem = loopScrolling ? max : 0; |
3395 |
4372 |
3396 // Scroll highlighted item so that it becomes visible, |
4373 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3397 // if it is not visible before (scrolling with scroll bar |
4374 CWindowGc& gc = iExtension->iGc ? *iExtension->iGc : SystemGc(); |
3398 // can cause highlighted item to go out of screen) |
4375 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( &gc ); |
3399 TInt topItem = iScroller->TopItemIndex(); |
4376 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
3400 TInt bottomItem = topItem + NumberOfItemsThatFitInView(); |
4377 |
3401 |
4378 if(iExtension->iIsPenEnable) |
3402 if ( iExtension->Offset() < 0 ) |
4379 { |
3403 { |
4380 _AKNTRACE( "[%s]", "iExtension->iIsPenEnable = TRUE" ); |
3404 // Extra bottom item when panning |
4381 // Scroll highlighted item so that it becomes visible, |
3405 bottomItem++; |
4382 // if it is not visible before (scrolling with scroll bar |
3406 } |
4383 // can cause highlighted item to go out of screen) |
3407 |
4384 TInt topItem = iScroller->TopItemIndex(); |
3408 if( bottomItem > NumberOfItemsInPane() ) |
4385 TInt bottomItem = topItem + NumberOfItemsThatFitInView(); |
3409 { |
4386 |
3410 bottomItem = NumberOfItemsInPane(); |
4387 if ( iExtension->Offset() < 0 ) |
3411 } |
4388 { |
3412 _AKNTRACE( "topItem = %d,bottomItem = %d", topItem,bottomItem ); |
4389 // Extra bottom item when panning |
3413 |
4390 bottomItem++; |
3414 if ( aType != EEventKeyDown && iSelectedItem != ENothingSelected && |
4391 } |
3415 !(iExtension->iSctHighlighted && topItem == 0) && |
4392 |
3416 (iSelectedItem < topItem || iSelectedItem > bottomItem - 1) ) |
4393 if( bottomItem > NumberOfItemsInPane() ) |
3417 { |
4394 { |
3418 _AKNTRACE( "[%s]", "ScrollToMakeItemVisible(iSelectedItem);" ); |
4395 bottomItem = NumberOfItemsInPane(); |
3419 ScrollToMakeItemVisible(iSelectedItem); |
4396 } |
3420 |
4397 _AKNTRACE( "topItem = %d,bottomItem = %d", topItem,bottomItem ); |
3421 ActivateGc(); |
4398 |
3422 CWindowGc& gc = SystemGc(); |
4399 if ( aType != EEventKeyDown && iSelectedItem != ENothingSelected && |
3423 PrepareGcForDrawingItems( gc ); |
4400 !(iExtension->iSctHighlighted && topItem == 0) && |
3424 |
4401 (iSelectedItem < topItem || iSelectedItem > bottomItem - 1) ) |
3425 // draw all items that are needed. |
4402 { |
3426 for( TInt i = 0; i < count; i++ ) |
4403 _AKNTRACE( "[%s]", "ScrollToMakeItemVisible(iSelectedItem);" ); |
3427 { |
4404 ScrollToMakeItemVisible(iSelectedItem); |
3428 if( i == iSelectedItem && !iExtension->iSctHighlighted) |
4405 |
3429 { |
4406 ActivateGc(); |
3430 DrawItem( gc, i, EDrawHighlight ); |
4407 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
4408 if ( transApi ) |
|
4409 { |
|
4410 iExtension->iGc->Activate( *DrawableWindow() ); |
3431 } |
4411 } |
3432 else |
4412 #else |
3433 { |
4413 CWindowGc& gc = SystemGc(); |
3434 DrawItem( gc, i, ERemoveHighlight ); |
4414 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
4415 PrepareGcForDrawingItems( gc ); |
|
4416 |
|
4417 // draw all items that are needed. |
|
4418 for( TInt i = 0; i < count; i++ ) |
|
4419 { |
|
4420 if( i == iSelectedItem && !iExtension->iSctHighlighted) |
|
4421 { |
|
4422 DrawItem( gc, i, EDrawHighlight ); |
|
4423 } |
|
4424 else |
|
4425 { |
|
4426 DrawItem( gc, i, ERemoveHighlight ); |
|
4427 } |
3435 } |
4428 } |
3436 } |
4429 |
3437 |
4430 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3438 DeactivateGc(); |
4431 if ( transApi ) |
3439 _AKNTRACE( "[%s]", "OfferKeyEventL return 9" ); |
4432 { |
3440 _AKNTRACE_FUNC_EXIT; |
4433 iExtension->iGc->Deactivate(); |
3441 return EKeyWasConsumed; |
4434 } |
|
4435 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
4436 DeactivateGc(); |
|
4437 _AKNTRACE( "[%s]", "OfferKeyEventL return 9" ); |
|
4438 _AKNTRACE_FUNC_EXIT; |
|
4439 return EKeyWasConsumed; |
|
4440 } |
3442 } |
4441 } |
3443 |
4442 |
3444 if ( iSelectedItem != ENothingSelected || iExtension->iSctHighlighted ) |
4443 if ( iSelectedItem != ENothingSelected || iExtension->iSctHighlighted ) |
3445 { |
4444 { |
3446 switch ( code ) |
4445 switch ( code ) |
3680 return; |
4693 return; |
3681 } |
4694 } |
3682 |
4695 |
3683 TInt count( NumberOfItemsInPane() ); |
4696 TInt count( NumberOfItemsInPane() ); |
3684 |
4697 |
3685 // Scroll highlighted item so that it becomes visible |
4698 if ( iExtension->iIsPenEnable ) |
3686 // if it is not visible before (scrolling with scroll bar |
4699 { |
3687 // can cause highlighted item to go out of screen). |
4700 // Scroll highlighted item so that it becomes visible |
3688 TInt topItem( iScroller->TopItemIndex() ); |
4701 // if it is not visible before (scrolling with scroll bar |
3689 TInt bottomItem( topItem + NumberOfItemsThatFitInView() ); |
4702 // can cause highlighted item to go out of screen). |
3690 if ( bottomItem > count ) |
4703 TInt topItem( iScroller->TopItemIndex() ); |
3691 { |
4704 TInt bottomItem( topItem + NumberOfItemsThatFitInView() ); |
3692 bottomItem = count; |
4705 if ( bottomItem > count ) |
3693 } |
4706 { |
3694 |
4707 bottomItem = count; |
3695 if ( iExtension->Offset() < 0 && |
4708 } |
3696 ( iSelectedItem == topItem || iSelectedItem == bottomItem ) ) |
4709 |
3697 { |
4710 if ( iExtension->Offset() < 0 && |
3698 // Restoring offset with "simulated" ok key event. |
4711 ( iSelectedItem == topItem || iSelectedItem == bottomItem ) ) |
3699 iExtension->RestoreOffset( EKeyOK ); |
4712 { |
3700 } |
4713 // Restoring offset with "simulated" ok key event. |
3701 else if ( iSelectedItem < topItem || |
4714 iExtension->RestoreOffset( EKeyOK ); |
3702 iSelectedItem > bottomItem - 1 ) |
4715 } |
3703 { |
4716 else if ( iSelectedItem < topItem || |
3704 if ( count > iSelectedItem ) |
4717 iSelectedItem > bottomItem - 1 ) |
3705 { |
4718 { |
3706 if ( iExtension->iSctHighlighted && iExtension->iSct ) |
4719 if ( count > iSelectedItem ) |
3707 { |
4720 { |
3708 TKeyEvent key; |
4721 if ( iExtension->iSctHighlighted && iExtension->iSct ) |
3709 key.iCode = EKeyOK; |
|
3710 key.iModifiers = 0; |
|
3711 |
|
3712 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
|
3713 TEventCode type( EEventNull ); |
|
3714 keyResponse = iExtension->iSct->OfferKeyEventL( key, |
|
3715 type ); |
|
3716 if ( keyResponse == EKeyWasConsumed ) |
|
3717 { |
4722 { |
3718 ReportSelectionMadeL(); |
4723 TKeyEvent key; |
|
4724 key.iCode = EKeyOK; |
|
4725 key.iModifiers = 0; |
|
4726 |
|
4727 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
|
4728 TEventCode type( EEventNull ); |
|
4729 keyResponse = iExtension->iSct->OfferKeyEventL( key, |
|
4730 type ); |
|
4731 if ( keyResponse == EKeyWasConsumed ) |
|
4732 { |
|
4733 ReportSelectionMadeL(); |
|
4734 } |
|
4735 _AKNTRACE( "[%s]" "ActivateCurrentItemL return 2" ); |
|
4736 _AKNTRACE_FUNC_EXIT; |
|
4737 return; |
3719 } |
4738 } |
3720 _AKNTRACE( "[%s]" "ActivateCurrentItemL return 2" ); |
|
3721 _AKNTRACE_FUNC_EXIT; |
|
3722 return; |
|
3723 } |
4739 } |
3724 } |
4740 |
3725 |
4741 iExtension->isUpdateScrollDirectly = ETrue; |
3726 iExtension->isUpdateScrollDirectly = ETrue; |
4742 ScrollToMakeItemVisible( iSelectedItem ); |
3727 ScrollToMakeItemVisible( iSelectedItem ); |
4743 iExtension->isUpdateScrollDirectly = EFalse; |
3728 iExtension->isUpdateScrollDirectly = EFalse; |
4744 |
3729 |
4745 ActivateGc(); |
3730 ActivateGc(); |
4746 |
3731 CWindowGc& gc = SystemGc(); |
4747 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3732 PrepareGcForDrawingItems( gc ); |
4748 |
3733 |
4749 MAknListBoxTfxInternal *transApi = |
3734 // Draw all items that are needed. |
4750 CAknListLoader::TfxApiInternal( iExtension->iGc ); |
3735 for ( TInt i = 0; i < count; i++ ) |
4751 if ( transApi ) |
3736 { |
4752 { |
3737 if ( i == iSelectedItem && !iExtension->iSctHighlighted ) |
4753 iExtension->iGc->Activate( *DrawableWindow() ); |
3738 { |
|
3739 DrawItem( gc, i, EDrawHighlight ); |
|
3740 } |
4754 } |
3741 else |
4755 CWindowGc& gc = transApi ? *iExtension->iGc : SystemGc(); |
3742 { |
4756 |
3743 DrawItem( gc, i, ERemoveHighlight ); |
4757 #else |
|
4758 |
|
4759 CWindowGc& gc = SystemGc(); |
|
4760 |
|
4761 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
4762 |
|
4763 PrepareGcForDrawingItems( gc ); |
|
4764 |
|
4765 // Draw all items that are needed. |
|
4766 for ( TInt i = 0; i < count; i++ ) |
|
4767 { |
|
4768 if ( i == iSelectedItem && !iExtension->iSctHighlighted ) |
|
4769 { |
|
4770 DrawItem( gc, i, EDrawHighlight ); |
|
4771 } |
|
4772 else |
|
4773 { |
|
4774 DrawItem( gc, i, ERemoveHighlight ); |
|
4775 } |
3744 } |
4776 } |
3745 } |
4777 |
3746 |
4778 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3747 DeactivateGc(); |
4779 |
3748 _AKNTRACE( "[%s]" "ActivateCurrentItemL return 3" ); |
4780 if ( transApi ) |
3749 _AKNTRACE_FUNC_EXIT; |
4781 { |
3750 return; |
4782 iExtension->iGc->Deactivate(); |
|
4783 } |
|
4784 |
|
4785 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
4786 |
|
4787 DeactivateGc(); |
|
4788 _AKNTRACE( "[%s]" "ActivateCurrentItemL return 3" ); |
|
4789 _AKNTRACE_FUNC_EXIT; |
|
4790 return; |
|
4791 } |
3751 } |
4792 } |
3752 |
4793 |
3753 if ( iCascadeMenuPane ) |
4794 if ( iCascadeMenuPane ) |
3754 { |
4795 { |
3755 iCascadeMenuPane->ActivateCurrentItemL(); |
4796 iCascadeMenuPane->ActivateCurrentItemL(); |
4050 { |
5101 { |
4051 iExtension->StopCascadeMenuTimer(); |
5102 iExtension->StopCascadeMenuTimer(); |
4052 iExtension->ResetPressedHighlight(); |
5103 iExtension->ResetPressedHighlight(); |
4053 } |
5104 } |
4054 |
5105 |
|
5106 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
5107 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( |
|
5108 iExtension->iGc ); |
|
5109 TBool effects = transApi && !transApi->EffectsDisabled(); |
|
5110 #endif |
|
5111 |
4055 switch (aPointerEvent.iType ) |
5112 switch (aPointerEvent.iType ) |
4056 { |
5113 { |
4057 case TPointerEvent::EButton1Up: |
5114 case TPointerEvent::EButton1Up: |
4058 { |
5115 { |
4059 _AKNTRACE( "[%s]", "TPointerEvent::EButton1Up" ); |
5116 _AKNTRACE( "[%s]", "TPointerEvent::EButton1Up" ); |
4060 if ( !innerRect.Contains( aPointerEvent.iPosition ) ) |
5117 if ( !innerRect.Contains( aPointerEvent.iPosition ) ) |
4061 { |
5118 { |
4062 TBool highlightWasEnabled = iExtension->HighlightEnabled(); |
|
4063 // remove highlight in case highlight is outside of menu pane |
5119 // remove highlight in case highlight is outside of menu pane |
4064 iExtension->EnableHighlight( EFalse ); |
5120 iExtension->EnableHighlight( EFalse ); |
4065 if ( iOwner ) |
5121 if ( iOwner ) |
4066 { |
5122 { |
4067 RepaintHighlight(); |
5123 RepaintHighlight(); |
4068 } |
5124 } |
4069 else if ( highlightWasEnabled && !iCascadeMenuPane ) |
|
4070 { |
|
4071 DrawItem( SelectedItem(), ENoHighlight ); |
|
4072 } |
|
4073 } |
5125 } |
4074 if ( iOwner && |
5126 if ( iOwner && |
4075 !innerRect.Contains( aPointerEvent.iPosition ) && |
5127 !innerRect.Contains( aPointerEvent.iPosition ) && |
4076 !iExtension->iDownOnMenuArea ) |
5128 !iExtension->iDownOnMenuArea ) |
4077 { |
5129 { |
4078 iExtension->CalculateParentEvent( aPointerEvent, parentEvent); |
5130 iExtension->CalculateParentEvent( aPointerEvent, parentEvent); |
4079 _AKNTRACE( "[%s]", "HandlePointerEventL return 6" ); |
5131 _AKNTRACE( "[%s]", "HandlePointerEventL return 6" ); |
4080 _AKNTRACE_FUNC_EXIT; |
5132 _AKNTRACE_FUNC_EXIT; |
4081 return iOwner->HandlePointerEventL( parentEvent ); |
5133 return iOwner->HandlePointerEventL( parentEvent ); |
4082 } |
5134 } |
|
5135 iExtension->iDownOnMenuArea = EFalse; |
4083 |
5136 |
4084 iExtension->iPanningActive = EFalse; |
5137 iExtension->iPanningActive = EFalse; |
4085 if ( !(iExtension->iSct && iExtension->iSct->Rect().Contains( iExtension->iStartPoint ) ) |
5138 if ( !(iExtension->iSct && iExtension->iSct->Rect().Contains( iExtension->iStartPoint ) ) ) |
4086 && iExtension->iDownOnMenuArea ) |
|
4087 { |
5139 { |
4088 TPoint drag = iExtension->iStartPoint - aPointerEvent.iPosition; |
5140 TPoint drag = iExtension->iStartPoint - aPointerEvent.iPosition; |
4089 if ( iExtension->iPhysics->StartPhysics( |
5141 if ( iExtension->iPhysics->StartPhysics( |
4090 drag, iExtension->iStartTime ) ) |
5142 drag, iExtension->iStartTime ) ) |
4091 { |
5143 { |
4092 iExtension->iFlickActive = ETrue; |
5144 iExtension->iFlickActive = ETrue; |
4093 iExtension->ResetPressedHighlight(); |
5145 iExtension->ResetPressedHighlight(); |
4094 } |
5146 } |
4095 } |
5147 } |
4096 iExtension->iDownOnMenuArea = EFalse; |
|
4097 if ( iExtension->HighlightTimerActive() && |
5148 if ( iExtension->HighlightTimerActive() && |
4098 !iExtension->iPressedDown ) |
5149 !iExtension->iPressedDown ) |
4099 { |
5150 { |
4100 // Complete the timer here if it's still running |
5151 // Complete the timer here if it's still running |
4101 // when up event is received. |
5152 // when up event is received. |
4310 // from sct to normal menu item |
5354 // from sct to normal menu item |
4311 iExtension->iSctHighlighted = EFalse; |
5355 iExtension->iSctHighlighted = EFalse; |
4312 iExtension->iSct->HighlightSctRow( iExtension->iSctHighlighted ); |
5356 iExtension->iSct->HighlightSctRow( iExtension->iSctHighlighted ); |
4313 } |
5357 } |
4314 |
5358 |
|
5359 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
5360 if ( effects ) |
|
5361 { |
|
5362 transApi->SetMoveType( MAknListBoxTfxInternal::EListTap ); |
|
5363 } |
|
5364 #endif |
4315 iExtension->iPressedDown = ETrue; |
5365 iExtension->iPressedDown = ETrue; |
4316 |
5366 |
4317 // Start timer for pressed highlight |
5367 // Start timer for pressed highlight |
4318 if ( !noSelection ) |
5368 if ( !noSelection ) |
4319 { |
5369 { |
4320 iExtension->ImmediateFeedback( ETouchFeedbackList ); |
5370 iExtension->ImmediateFeedback( ETouchFeedbackBasicItem ); |
4321 iExtension->StartHighlightTimerL(); |
5371 iExtension->StartHighlightTimerL(); |
4322 } |
5372 } |
4323 iExtension->iNextHighlightItem = ii; |
5373 iExtension->iNextHighlightItem = ii; |
4324 iExtension->iButtonDownItem = ii; |
5374 iExtension->iButtonDownItem = ii; |
4325 |
5375 |
4326 // down even on already highlighted item => list feedback |
5376 // down even on already highlighted item => list feedback |
4327 if ( iExtension->iButtonDownItem == iSelectedItem ) |
5377 if ( iExtension->iButtonDownItem == iSelectedItem ) |
4328 { |
5378 { |
4329 iExtension->ImmediateFeedback( ETouchFeedbackList ); |
5379 iExtension->ImmediateFeedback( ETouchFeedbackBasicItem ); |
4330 } |
5380 } |
4331 if ( noSelection ) |
5381 if ( noSelection ) |
4332 { |
5382 { |
4333 iExtension->iButtonDownItem = KErrNotFound; |
5383 iExtension->iButtonDownItem = KErrNotFound; |
4334 } |
5384 } |
4335 |
5385 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
5386 if ( effects ) |
|
5387 { |
|
5388 transApi->Draw( Rect() ); |
|
5389 } |
|
5390 #endif |
4336 // if new item has submenu, show it |
5391 // if new item has submenu, show it |
4337 if ( item->iData.iCascadeId ) |
5392 if ( item->iData.iCascadeId ) |
4338 { |
5393 { |
4339 if ( !iExtension->IsCascadeMenuTimerActive() ) |
5394 if ( !iExtension->IsCascadeMenuTimerActive() ) |
4340 { |
5395 { |
4349 } |
5404 } |
4350 } |
5405 } |
4351 else |
5406 else |
4352 { |
5407 { |
4353 // Clicked out side submenu, parent handles this |
5408 // Clicked out side submenu, parent handles this |
4354 iExtension->iDownOnMenuArea = EFalse; |
|
4355 if ( iOwner ) |
5409 if ( iOwner ) |
4356 { |
5410 { |
4357 iExtension->CalculateParentEvent(aPointerEvent, parentEvent); |
5411 iExtension->CalculateParentEvent(aPointerEvent, parentEvent); |
4358 _AKNTRACE( "[%s]", "HandlePointerEventL return 12" ); |
5412 _AKNTRACE( "[%s]", "HandlePointerEventL return 12" ); |
4359 _AKNTRACE_FUNC_EXIT; |
5413 _AKNTRACE_FUNC_EXIT; |
4360 return iOwner->HandlePointerEventL( parentEvent ); |
5414 return iOwner->HandlePointerEventL( parentEvent ); |
4361 } |
5415 } |
4362 else |
5416 else |
4363 { |
5417 { |
4364 // For finger usability, extend to the right. |
5418 if ( iExtension->iIsPenEnable ) |
4365 TRect innerToRightRect; |
|
4366 if ( AknLayoutUtils::LayoutMirrored() ) |
|
4367 { |
5419 { |
4368 innerToRightRect = TRect( Rect().iTl, innerRect.iBr ); |
5420 // For finger usability, extend to the right. |
|
5421 TRect innerToRightRect; |
|
5422 if ( AknLayoutUtils::LayoutMirrored() ) |
|
5423 { |
|
5424 innerToRightRect = TRect( Rect().iTl, innerRect.iBr ); |
|
5425 } |
|
5426 else |
|
5427 { |
|
5428 innerToRightRect = TRect( innerRect.iTl, Rect().iBr ); |
|
5429 } |
|
5430 // Keep opened |
|
5431 if ( innerToRightRect.Contains( aPointerEvent.iPosition ) ) |
|
5432 { |
|
5433 break; |
|
5434 } |
4369 } |
5435 } |
4370 else |
|
4371 { |
|
4372 innerToRightRect = TRect( innerRect.iTl, Rect().iBr ); |
|
4373 } |
|
4374 // Keep opened |
|
4375 if ( innerToRightRect.Contains( aPointerEvent.iPosition ) ) |
|
4376 { |
|
4377 break; |
|
4378 } |
|
4379 |
|
4380 // clicked outside, then close menu case by case |
5436 // clicked outside, then close menu case by case |
4381 if ( iCascadeMenuPane ) |
5437 if ( iCascadeMenuPane ) |
4382 { |
5438 { |
4383 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
5439 if( AknLayoutUtils::PenEnabled() ) |
4384 { |
5440 { |
4385 iExtension->ImmediateFeedback( ETouchFeedbackSubMenuClosed ); |
5441 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
4386 } |
5442 { |
4387 else |
5443 iExtension->ImmediateFeedback( ETouchFeedbackPopupClose ); |
4388 { |
5444 } |
4389 iExtension->ImmediateFeedback( ETouchFeedbackPopUp ); |
5445 else |
|
5446 { |
|
5447 iExtension->ImmediateFeedback( ETouchFeedbackPopUp ); |
|
5448 } |
4390 } |
5449 } |
4391 iExtension->iShowCascadeTransition = ETrue; |
5450 iExtension->iShowCascadeTransition = ETrue; |
4392 CloseCascadeMenu(); //Just close sub menu. |
5451 CloseCascadeMenu(); //Just close sub menu. |
4393 // Submenu of submenu was closed |
5452 iExtension->EnableHighlight( EFalse ); |
4394 if ( iCascadeMenuPane ) |
5453 RepaintHighlight(); |
4395 { |
|
4396 iCascadeMenuPane->iExtension->EnableHighlight( EFalse ); |
|
4397 iCascadeMenuPane->RepaintHighlight(); |
|
4398 } |
|
4399 else |
|
4400 { |
|
4401 iExtension->EnableHighlight( EFalse ); |
|
4402 RepaintHighlight(); |
|
4403 } |
|
4404 IgnoreEventsUntilNextPointerUp(); |
5454 IgnoreEventsUntilNextPointerUp(); |
4405 } |
5455 } |
4406 else |
5456 else |
4407 { |
5457 { |
4408 _AKNTRACE( "[%s]", "HandlePointerEventL return 12.5" ); |
5458 ReportCanceled(); //Close main menu. |
4409 _AKNTRACE_FUNC_EXIT; |
|
4410 return; |
|
4411 } |
5459 } |
4412 } |
5460 } |
4413 } |
5461 } |
4414 |
5462 |
4415 } |
5463 } |
4486 // if submenu open and touched item is not the one which opened submenu, then close submenu |
5541 // if submenu open and touched item is not the one which opened submenu, then close submenu |
4487 if ( (ii != iSelectedItem) |
5542 if ( (ii != iSelectedItem) |
4488 && !cascadeMenuRect.Contains( |
5543 && !cascadeMenuRect.Contains( |
4489 aPointerEvent.iPosition ) ) |
5544 aPointerEvent.iPosition ) ) |
4490 { |
5545 { |
4491 if ( CAknTransitionUtils::TransitionsEnabled( |
5546 if ( AknLayoutUtils::PenEnabled() ) |
4492 AknTransEffect::EComponentTransitionsOff ) ) |
|
4493 { |
5547 { |
4494 iExtension->ImmediateFeedback( |
5548 if ( CAknTransitionUtils::TransitionsEnabled( |
4495 ETouchFeedbackSubMenuClosed ); |
5549 AknTransEffect::EComponentTransitionsOff ) ) |
4496 } |
5550 { |
4497 else |
5551 iExtension->ImmediateFeedback( |
4498 { |
5552 ETouchFeedbackPopupClose ); |
4499 iExtension->ImmediateFeedback( |
5553 } |
4500 ETouchFeedbackPopUp ); |
5554 else |
|
5555 { |
|
5556 iExtension->ImmediateFeedback( |
|
5557 ETouchFeedbackPopUp ); |
|
5558 } |
4501 } |
5559 } |
4502 iExtension->iShowCascadeTransition = ETrue; |
5560 iExtension->iShowCascadeTransition = ETrue; |
4503 CloseCascadeMenu(); |
5561 CloseCascadeMenu(); |
4504 } |
5562 } |
|
5563 } |
|
5564 else |
|
5565 { |
|
5566 TInt oldSelected = iSelectedItem; |
|
5567 // update highlight to new item |
|
5568 if ( oldSelected != ii ) |
|
5569 { |
|
5570 iExtension->iPressedDown = EFalse; |
|
5571 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
5572 if ( effects |
|
5573 && !iExtension->iShowCascadeTransition ) |
|
5574 { |
|
5575 transApi->SetMoveType( |
|
5576 MAknListBoxTfxInternal::EListDrag ); |
|
5577 } |
|
5578 #endif |
|
5579 } |
|
5580 TRect screenRect( TPoint( KMinTInt, KMinTInt ), |
|
5581 TPoint( KMaxTInt, KMaxTInt ) ); |
|
5582 TRect repeatRect( screenRect.iTl.iX, item->iPos, |
|
5583 screenRect.iBr.iX, item->iPos |
|
5584 + iItemHeight ); |
4505 } |
5585 } |
4506 // item found, break |
5586 // item found, break |
4507 break; |
5587 break; |
4508 } |
5588 } |
4509 } |
5589 } |
4942 |
6036 |
4943 case EEikScrollPageDown: |
6037 case EEikScrollPageDown: |
4944 { |
6038 { |
4945 _AKNTRACE( "[%s]", "EEikScrollPageDown"); |
6039 _AKNTRACE( "[%s]", "EEikScrollPageDown"); |
4946 _AKNTRACE( "bottomItem = %d", bottomItem); |
6040 _AKNTRACE( "bottomItem = %d", bottomItem); |
4947 update = ETrue; |
6041 // if last item is not visible |
|
6042 if ( bottomItem < countOfItems) |
|
6043 { |
|
6044 // move menu to show one site down or then downmost items. |
|
6045 newTopItem = (bottomItem <= (countOfItems - itemsThatFitToView)) ? (topItem + itemsThatFitToView) : (countOfItems - itemsThatFitToView); |
|
6046 } |
|
6047 else |
|
6048 { |
|
6049 update = EFalse; |
|
6050 } |
|
6051 _AKNTRACE( "newTopItem = %d", newTopItem); |
4948 _AKNTRACE( "update = %d", update); |
6052 _AKNTRACE( "update = %d", update); |
4949 } |
6053 } |
4950 break; |
6054 break; |
4951 |
6055 |
4952 case EEikScrollThumbDragVert: |
6056 case EEikScrollThumbDragVert: |
4953 { |
6057 { |
4954 _AKNTRACE( "[%s]", "EEikScrollThumbDragVert"); |
6058 _AKNTRACE( "[%s]", "EEikScrollThumbDragVert"); |
|
6059 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
6060 |
|
6061 if ( effects ) |
|
6062 { |
|
6063 MAknListBoxTfx* tfxApi = CAknListLoader::TfxApi( iExtension->iGc ); |
|
6064 |
|
6065 if ( tfxApi ) |
|
6066 { |
|
6067 tfxApi->EnableEffects( EFalse ); |
|
6068 effects = EFalse; |
|
6069 } |
|
6070 } |
|
6071 #endif |
4955 // new thumb position |
6072 // new thumb position |
4956 TInt thumb = aScrollBar->ThumbPosition(); |
6073 TInt thumb = aScrollBar->ThumbPosition(); |
4957 _AKNTRACE( "thumb = %d", thumb); |
6074 _AKNTRACE( "thumb = %d", thumb); |
4958 update = ETrue; |
6075 |
|
6076 // did dragging cause scrolling |
|
6077 if ( thumb != topItem ) |
|
6078 { |
|
6079 newTopItem = thumb; |
|
6080 } |
|
6081 else |
|
6082 { |
|
6083 update = EFalse; |
|
6084 } |
|
6085 _AKNTRACE( "newTopItem = %d", newTopItem); |
4959 _AKNTRACE( "update = %d", update); |
6086 _AKNTRACE( "update = %d", update); |
4960 } |
6087 } |
4961 break; |
6088 break; |
4962 |
6089 |
|
6090 case EEikScrollThumbReleaseVert: |
|
6091 { |
|
6092 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
6093 MAknListBoxTfx* tfxApi = CAknListLoader::TfxApi( iExtension->iGc ); |
|
6094 |
|
6095 if ( tfxApi ) |
|
6096 { |
|
6097 tfxApi->EnableEffects( ETrue ); |
|
6098 } |
|
6099 #endif |
|
6100 } |
|
6101 return; |
|
6102 |
4963 default: |
6103 default: |
4964 update = EFalse; |
6104 update = EFalse; |
4965 break; |
6105 break; |
4966 } |
6106 } |
4967 |
6107 |
4968 // if topItem changed, then draw menu again. |
6108 // if topItem changed, then draw menu again. |
4969 if ( newTopItem != topItem || update ) |
6109 if ( newTopItem != topItem ) |
4970 { |
6110 { |
|
6111 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
6112 if ( effects ) |
|
6113 { |
|
6114 transApi->SetMoveType( newTopItem > topItem ? |
|
6115 MAknListBoxTfxInternal::EListScrollDown : |
|
6116 MAknListBoxTfxInternal::EListScrollUp ); |
|
6117 } |
|
6118 #endif |
|
6119 |
|
6120 |
4971 iExtension->iListTopIndex = aScrollBar->ThumbPosition(); |
6121 iExtension->iListTopIndex = aScrollBar->ThumbPosition(); |
4972 TPoint newPosition( iExtension->iViewPosition.iX, |
6122 |
4973 iExtension->iListTopIndex + iExtension->iViewHeight / 2 ); |
6123 iExtension->iViewPosition.iY = |
4974 |
6124 iExtension->iListTopIndex + iExtension->iViewHeight / 2; |
4975 iExtension->iFlags.Set( CEikMenuPaneExtension::ESkipScrollbarUpdate ); |
6125 |
4976 iExtension->ViewPositionChanged( newPosition ); |
6126 iExtension->ViewPositionChanged( iExtension->iViewPosition ); |
4977 iExtension->iFlags.Clear( CEikMenuPaneExtension::ESkipScrollbarUpdate ); |
6127 |
4978 } |
6128 } |
4979 } |
6129 } |
4980 _AKNTRACE_FUNC_EXIT; |
6130 _AKNTRACE_FUNC_EXIT; |
4981 } |
6131 } |
4982 |
|
4983 |
6132 |
4984 // ----------------------------------------------------------------------------- |
6133 // ----------------------------------------------------------------------------- |
4985 // CEikMenuPane::CreateScrollBarFrame |
6134 // CEikMenuPane::CreateScrollBarFrame |
4986 // ----------------------------------------------------------------------------- |
6135 // ----------------------------------------------------------------------------- |
4987 // |
6136 // |
5062 TEikScrollBarFrameLayout layout; |
6219 TEikScrollBarFrameLayout layout; |
5063 layout.SetClientMargin( 0 ); |
6220 layout.SetClientMargin( 0 ); |
5064 layout.SetInclusiveMargin( 0 ); |
6221 layout.SetInclusiveMargin( 0 ); |
5065 layout.iTilingMode = TEikScrollBarFrameLayout::EClientRectConstant; |
6222 layout.iTilingMode = TEikScrollBarFrameLayout::EClientRectConstant; |
5066 |
6223 |
5067 CEikScrollBarFrame::TScrollBarVisibility visibility = |
6224 // For main menupane scrollbar is always shown, for submenu only when needed |
5068 iSBFrame->ScrollBarVisibility( CEikScrollBar::EVertical ); |
6225 if ( !iOwner ) |
5069 |
6226 { |
5070 // scrollbar is shown only if needed |
6227 iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn ); |
5071 if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOn |
6228 } |
5072 && visibility == CEikScrollBarFrame::EOff ) |
6229 else |
5073 { |
6230 { |
5074 iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
6231 TInt maxItems = NumberOfItemsThatFitInView(); |
5075 CEikScrollBarFrame::EOn ); |
6232 TInt count = iItemArray->Count(); |
5076 iExtension->iScrollBarRect = iSBFrame->VerticalScrollBar()->Rect(); |
6233 iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
5077 } |
6234 (count > maxItems) ? CEikScrollBarFrame::EOn : CEikScrollBarFrame::EOff ); |
5078 else if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOff |
6235 } |
5079 && visibility == CEikScrollBarFrame::EOn ) |
6236 |
5080 { |
|
5081 iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
|
5082 CEikScrollBarFrame::EOff ); |
|
5083 iExtension->iScrollBarRect = TRect::EUninitialized; |
|
5084 } |
|
5085 |
|
5086 TAknLayoutRect scrollLayoutRect; |
6237 TAknLayoutRect scrollLayoutRect; |
5087 scrollLayoutRect.LayoutRect( clientRect, |
6238 if ( !iOwner ) |
5088 AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
6239 { |
5089 scrollBarInclusiveRect = scrollLayoutRect.Rect(); |
6240 TAknWindowLineLayout listScrollPaneLayout( |
5090 scrollBarClientRect = scrollBarInclusiveRect; |
6241 AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() ); |
5091 |
6242 if ( iExtension ) |
5092 AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, scrollBarClientRect, |
6243 { |
5093 AknLayoutScalable_Avkon::scroll_pane_cp4().LayoutLine()); |
6244 iExtension->AdjustPopupLayoutData( listScrollPaneLayout ); |
|
6245 } |
|
6246 scrollLayoutRect.LayoutRect( clientRect, listScrollPaneLayout ); |
|
6247 scrollBarInclusiveRect = scrollLayoutRect.Rect(); |
|
6248 scrollBarClientRect = scrollBarInclusiveRect; |
|
6249 |
|
6250 AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, scrollBarClientRect, |
|
6251 AknLayoutScalable_Avkon::scroll_pane_cp25(0).LayoutLine() ); |
|
6252 } |
|
6253 else |
|
6254 { |
|
6255 scrollLayoutRect.LayoutRect( clientRect, |
|
6256 AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
|
6257 scrollBarInclusiveRect = scrollLayoutRect.Rect(); |
|
6258 scrollBarClientRect = scrollBarInclusiveRect; |
|
6259 |
|
6260 AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, scrollBarClientRect, |
|
6261 AknLayoutScalable_Avkon::scroll_pane_cp4().LayoutLine()); |
|
6262 } |
5094 |
6263 |
5095 iSBFrame->TileL( &hDsSbarModel, &vDsSbarModel, scrollBarClientRect, scrollBarInclusiveRect, layout ); |
6264 iSBFrame->TileL( &hDsSbarModel, &vDsSbarModel, scrollBarClientRect, scrollBarInclusiveRect, layout ); |
5096 iSBFrame->SetVFocusPosToThumbPos( vDsSbarModel.FocusPosition() ); |
6265 iSBFrame->SetVFocusPosToThumbPos( vDsSbarModel.FocusPosition() ); |
|
6266 |
|
6267 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
6268 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iExtension->iGc ); |
|
6269 if ( iSBFrame->VerticalScrollBar() && |
|
6270 iSBFrame->VScrollBarVisibility() == CEikScrollBarFrame::EOn ) |
|
6271 { |
|
6272 iExtension->iScrollBarRect = iSBFrame->VerticalScrollBar()->Rect(); |
|
6273 } |
|
6274 else |
|
6275 { |
|
6276 iExtension->iScrollBarRect = TRect::EUninitialized; |
|
6277 } |
|
6278 if ( transApi ) |
|
6279 { |
|
6280 transApi->ResetNonDrawingRects(); |
|
6281 transApi->AddNonDrawingRect( iExtension->iScrollBarRect ); |
|
6282 transApi->AddNonDrawingRect( iExtension->iSctRect ); |
|
6283 } |
|
6284 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
6285 if ( iSBFrame->VerticalScrollBar() && |
|
6286 iSBFrame->VScrollBarVisibility() == CEikScrollBarFrame::EOn ) |
|
6287 { |
|
6288 iExtension->iSBRect = iSBFrame->VerticalScrollBar()->Rect(); |
|
6289 } |
|
6290 else |
|
6291 { |
|
6292 iExtension->iSBRect = TRect::EUninitialized; |
|
6293 } |
5097 _AKNTRACE_FUNC_EXIT; |
6294 _AKNTRACE_FUNC_EXIT; |
5098 } |
6295 } |
5099 |
6296 |
5100 |
|
5101 // ----------------------------------------------------------------------------- |
6297 // ----------------------------------------------------------------------------- |
5102 // CEikMenuPane::UpdateScrollBarThumbs |
6298 // CEikMenuPane::UpdateScrollBarThumbs |
5103 // ----------------------------------------------------------------------------- |
6299 // ----------------------------------------------------------------------------- |
5104 // |
6300 // |
5105 void CEikMenuPane::UpdateScrollBarThumbs() |
6301 void CEikMenuPane::UpdateScrollBarThumbs() |
5192 newTop = Max( 0, newTop ); |
6386 newTop = Max( 0, newTop ); |
5193 newTop = Min( newTop, count - NumberOfItemsThatFitInView() ); |
6387 newTop = Min( newTop, count - NumberOfItemsThatFitInView() ); |
5194 iScroller->SetTopItemIndex( newTop ); |
6388 iScroller->SetTopItemIndex( newTop ); |
5195 _AKNTRACE( "newTop = %d", newTop ); |
6389 _AKNTRACE( "newTop = %d", newTop ); |
5196 |
6390 |
|
6391 // Menu moved with keys, update panning/flicking data |
5197 iExtension->iListTopIndex = iScroller->TopItemIndex() * iItemHeight; |
6392 iExtension->iListTopIndex = iScroller->TopItemIndex() * iItemHeight; |
5198 TPoint newPosition( iExtension->iViewPosition ); |
6393 iExtension->iViewPosition.iY = |
5199 newPosition.iY = iExtension->iListTopIndex + iExtension->iViewHeight / 2; |
6394 iExtension->iListTopIndex + iExtension->iViewHeight / 2; |
5200 |
6395 |
5201 iExtension->SetOffset( 0 ); |
6396 iExtension->SetOffset( 0 ); |
5202 iExtension->ViewPositionChanged( newPosition ); |
6397 |
5203 |
|
5204 _AKNTRACE( "iExtension->iListTopIndex = %d", iExtension->iListTopIndex ); |
6398 _AKNTRACE( "iExtension->iListTopIndex = %d", iExtension->iListTopIndex ); |
5205 _AKNTRACE( "iExtension->iViewPosition.iY = %d", iExtension->iViewPosition.iY ); |
6399 _AKNTRACE( "iExtension->iViewPosition.iY = %d", iExtension->iViewPosition.iY ); |
5206 _AKNTRACE( "[%s]", "iExtension->SetOffset( 0 )" ); |
6400 _AKNTRACE( "[%s]", "iExtension->SetOffset( 0 )" ); |
5207 |
6401 |
5208 _AKNTRACE_FUNC_EXIT; |
6402 _AKNTRACE_FUNC_EXIT; |
5209 return; |
6403 return; |
5210 } |
6404 } |
5211 |
6405 |
5212 |
|
5213 // ----------------------------------------------------------------------------- |
6406 // ----------------------------------------------------------------------------- |
5214 // CEikMenuPane::ViewRect |
6407 // CEikMenuPane::ViewRect |
5215 // ----------------------------------------------------------------------------- |
6408 // ----------------------------------------------------------------------------- |
5216 // |
6409 // |
5217 TRect CEikMenuPane::ViewRect() const |
6410 TRect CEikMenuPane::ViewRect() const |
5218 { |
6411 { |
5219 return Rect(); |
6412 return Rect(); |
5220 } |
6413 } |
5221 |
|
5222 |
6414 |
5223 // ----------------------------------------------------------------------------- |
6415 // ----------------------------------------------------------------------------- |
5224 // CEikMenuPane::NumberOfItemsThatFitInView |
6416 // CEikMenuPane::NumberOfItemsThatFitInView |
5225 // ----------------------------------------------------------------------------- |
6417 // ----------------------------------------------------------------------------- |
5226 // |
6418 // |
5851 |
7064 |
5852 // CEikMenuPane rect contains empty space. We want the popup content |
7065 // CEikMenuPane rect contains empty space. We want the popup content |
5853 // to be in correct place - so we calculate correct position for |
7066 // to be in correct place - so we calculate correct position for |
5854 // background and move control rect to match new background top left |
7067 // background and move control rect to match new background top left |
5855 // position. |
7068 // position. |
|
7069 TRect backgroundRect( iExtension->GetBackgroundRect( parentMenuRect ) ); |
5856 TPoint backgroundRectPos( |
7070 TPoint backgroundRectPos( |
5857 AknPopupUtils::Position( parentMenuRect.Size(), ETrue ) ); |
7071 AknPopupUtils::Position( backgroundRect.Size(), ETrue ) ); |
5858 |
7072 |
5859 retVal = parentMenuRect; |
7073 retVal = parentMenuRect; |
5860 retVal.Move( backgroundRectPos - parentMenuRect.iTl ); |
7074 retVal.Move( backgroundRectPos - backgroundRect.iTl ); |
5861 |
7075 |
5862 // Set embedded cba rect |
7076 // Set embedded cba rect |
5863 if ( iExtension->iCba ) |
7077 if ( iExtension->iCba ) |
5864 { |
7078 { |
5865 // There is hidden extra touch space for scroll bar in landscape |
7079 // There is hidden extra touch space for scroll bar in landscape |
5866 TInt xOffset = parentMenuRect.iTl.iX - parentMenuRect.iTl.iX ; |
7080 TInt xOffset = backgroundRect.iTl.iX - parentMenuRect.iTl.iX ; |
5867 iExtension->iCba->SetRect( TRect( |
7081 iExtension->iCba->SetRect( TRect( |
5868 xOffset, |
7082 xOffset, |
5869 menuRect.Height(), |
7083 menuRect.Height(), |
5870 parentMenuRect.Width() + xOffset, |
7084 backgroundRect.Width() + xOffset, |
5871 menuRect.Height() + cbaRect.Rect().Height() ) ); |
7085 menuRect.Height() + cbaRect.Rect().Height() ) ); |
5872 } |
7086 } |
5873 |
7087 |
5874 iExtension->iMenuPaneRect = TRect( retVal.iTl, |
7088 iExtension->iMenuPaneRect = TRect( retVal.iTl, |
5875 TSize ( menuRect.Size() ) ); |
7089 TSize ( menuRect.Size() ) ); |
5876 |
7090 |
5877 TInt variety = 4; |
|
5878 |
|
5879 // reserve area for scrollbar only if it's shown |
|
5880 if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOn ) |
|
5881 { |
|
5882 variety = 0; |
|
5883 } |
|
5884 |
|
5885 TAknLayoutRect layoutRect; |
|
5886 layoutRect.LayoutRect( TRect( iExtension->iMenuPaneRect.Size() ), |
|
5887 AknLayoutScalable_Avkon::listscroll_popup_sub_pane( 0 ) ); |
|
5888 |
|
5889 iExtension->iMenuAreaRect = layoutRect.Rect(); |
|
5890 |
|
5891 layoutRect.LayoutRect( iExtension->iMenuAreaRect, |
|
5892 AknLayoutScalable_Avkon::list_menu_pane( variety ) ); |
|
5893 |
|
5894 iExtension->iItemAreaRect = layoutRect.Rect(); |
|
5895 |
|
5896 _AKNTRACE( "[%s]", "the layout of main menu return" ); |
7091 _AKNTRACE( "[%s]", "the layout of main menu return" ); |
5897 _AKNTRACE_FUNC_EXIT; |
7092 _AKNTRACE_FUNC_EXIT; |
5898 return retVal; |
7093 return retVal; |
5899 } |
7094 } |
5900 |
7095 |
5932 textWidth = font->TextWidthInPixels( item->iData.iText ); |
7134 textWidth = font->TextWidthInPixels( item->iData.iText ); |
5933 maxTextWidth = Max( maxTextWidth, textWidth ); |
7135 maxTextWidth = Max( maxTextWidth, textWidth ); |
5934 } |
7136 } |
5935 |
7137 |
5936 // find the suitable item width, so that the text would be visible |
7138 // find the suitable item width, so that the text would be visible |
5937 TInt submenuVariety = 1; |
|
5938 |
|
5939 if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOn ) |
|
5940 { |
|
5941 submenuVariety = 0; |
|
5942 } |
|
5943 |
|
5944 for ( ii = 6; ii < KAlternativeSubmenuWidths + 6; ++ii ) |
7139 for ( ii = 6; ii < KAlternativeSubmenuWidths + 6; ++ii ) |
5945 { |
7140 { |
5946 TAknWindowLineLayout submenuLayout( AknLayoutScalable_Avkon::popup_submenu_window( ii ).LayoutLine() ); |
7141 TAknWindowLineLayout submenuLayout( AknLayoutScalable_Avkon::popup_submenu_window( ii ).LayoutLine() ); |
5947 TAknLayoutRect submenuRect; |
7142 TAknLayoutRect submenuRect; |
5948 submenuRect.LayoutRect( parentListScrollLayoutRect.Rect(), submenuLayout ); |
7143 submenuRect.LayoutRect( parentListScrollLayoutRect.Rect(), submenuLayout ); |
5949 |
7144 |
5950 TAknWindowLineLayout listScrollPaneLayout( AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
7145 TAknWindowLineLayout listScrollPaneLayout( AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
5951 TAknLayoutRect listScrollPaneRect; |
7146 TAknLayoutRect listScrollPaneRect; |
5952 listScrollPaneRect.LayoutRect( submenuRect.Rect(), listScrollPaneLayout ); |
7147 listScrollPaneRect.LayoutRect( submenuRect.Rect(), listScrollPaneLayout ); |
5953 |
7148 |
5954 TAknWindowLineLayout listSubmenuPaneLayout( AknLayoutScalable_Avkon::list_submenu_pane( submenuVariety ).LayoutLine() ); |
7149 TAknWindowLineLayout listSubmenuPaneLayout( AknLayoutScalable_Avkon::list_submenu_pane( !hasDoubleSpanScrollBar ).LayoutLine() ); |
5955 TAknLayoutRect listSubmenuPaneRect; |
7150 TAknLayoutRect listSubmenuPaneRect; |
5956 listSubmenuPaneRect.LayoutRect( listScrollPaneRect.Rect(), listSubmenuPaneLayout ); |
7151 listSubmenuPaneRect.LayoutRect( listScrollPaneRect.Rect(), listSubmenuPaneLayout ); |
5957 |
7152 |
5958 TAknLayoutText textIconLayout; |
7153 TAknLayoutText textIconLayout; |
5959 textIconLayout.LayoutText( listSubmenuPaneRect.Rect(), subMenuIconText); |
7154 textIconLayout.LayoutText( listSubmenuPaneRect.Rect(), subMenuIconText); |
6141 // TopItemIndex. Which results in negative index. This "fix" prevents from |
7329 // TopItemIndex. Which results in negative index. This "fix" prevents from |
6142 // crashing the menu. |
7330 // crashing the menu. |
6143 if( index < 0 ) |
7331 if( index < 0 ) |
6144 index = 0; |
7332 index = 0; |
6145 |
7333 |
|
7334 // It is possible that this method is called when iItemArray is NULL. In |
|
7335 // that case we fake numItems as 1 to make layout code work. |
|
7336 TInt maxItems = NumberOfItemsThatFitInView(); |
|
7337 TInt numItems = Min( Max( 1, iItemArray->Count() ), maxItems ); |
|
7338 if( !iItemArray ) |
|
7339 numItems = 1; |
|
7340 |
6146 // When physics is enabled highlight can be moved to partially visible |
7341 // When physics is enabled highlight can be moved to partially visible |
6147 // item which is at the bottom of menu. This causes layout panic and to |
7342 // item which is at the bottom of menu. This causes layout panic and to |
6148 // avoid that we reduce index by one. |
7343 // avoid that we reduce index by one. |
6149 if ( index == NumberOfItemsThatFitInView() ) |
7344 if ( index == maxItems ) |
6150 { |
7345 { |
6151 index--; |
7346 index--; |
6152 } |
7347 } |
6153 |
7348 |
6154 return ItemRect( index ); |
7349 TRect windowRect = Rect(); |
|
7350 |
|
7351 TAknWindowLineLayout menuPane( AKN_LAYOUT_WINDOW_list_menu_pane( 0 , 0 ) ); |
|
7352 TAknWindowLineLayout singleMenuPane( AKN_LAYOUT_WINDOW_list_single_popup_menu_pane( index ) ); |
|
7353 TAknLayoutRect menuPaneRect; |
|
7354 TAknLayoutRect singleMenuPaneRect; |
|
7355 |
|
7356 TBool hasDoubleSpanScrollBar = EFalse; |
|
7357 |
|
7358 if ( iSBFrame && iSBFrame->VScrollBarVisibility() ) |
|
7359 { |
|
7360 hasDoubleSpanScrollBar = ETrue; |
|
7361 } |
|
7362 |
|
7363 if ( !iOwner ) |
|
7364 { |
|
7365 TAknWindowLineLayout listScrollPaneLayout( |
|
7366 AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() ); |
|
7367 if ( iExtension ) |
|
7368 { |
|
7369 iExtension->AdjustPopupLayoutData( listScrollPaneLayout ); |
|
7370 } |
|
7371 TAknLayoutRect listScrollPaneRect; |
|
7372 listScrollPaneRect.LayoutRect( windowRect, listScrollPaneLayout ); |
|
7373 |
|
7374 menuPane = AknLayoutScalable_Avkon::list_menu_pane( 0 ).LayoutLine(); |
|
7375 menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), menuPane ); |
|
7376 |
|
7377 singleMenuPane = AknLayoutScalable_Avkon::list_single_pane_cp2( index ).LayoutLine(); |
|
7378 singleMenuPaneRect.LayoutRect( menuPaneRect.Rect(), singleMenuPane ); |
|
7379 } |
|
7380 else // Submenu |
|
7381 { |
|
7382 TAknWindowLineLayout listScrollPaneLayout( AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
|
7383 TAknLayoutRect listScrollPaneRect; |
|
7384 listScrollPaneRect.LayoutRect( windowRect, listScrollPaneLayout ); |
|
7385 |
|
7386 menuPane = AknLayoutScalable_Avkon::list_submenu_pane( !hasDoubleSpanScrollBar ).LayoutLine(); |
|
7387 menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), menuPane ); |
|
7388 |
|
7389 singleMenuPane = AknLayoutScalable_Avkon::list_single_popup_submenu_pane( index ).LayoutLine(); |
|
7390 singleMenuPaneRect.LayoutRect( menuPaneRect.Rect(), singleMenuPane ); |
|
7391 } |
|
7392 |
|
7393 // Compared to normal DrawItem the highlight rect step is omitted because |
|
7394 // it would shift the highlight towards left. |
|
7395 |
|
7396 return singleMenuPaneRect.Rect(); |
6155 } |
7397 } |
6156 |
7398 |
6157 |
7399 |
6158 // ----------------------------------------------------------------------------- |
7400 // ----------------------------------------------------------------------------- |
6159 // CEikMenuPane::PrepareHighlightFrame |
7401 // CEikMenuPane::PrepareHighlightFrame |
6307 __ASSERT_ALWAYS( iExtension, Panic( EEikPanicNullPointer ) ); |
7552 __ASSERT_ALWAYS( iExtension, Panic( EEikPanicNullPointer ) ); |
6308 return iExtension; |
7553 return iExtension; |
6309 } |
7554 } |
6310 |
7555 |
6311 |
7556 |
6312 // ----------------------------------------------------------------------------- |
|
6313 // CEikMenuPane::CheckCreateExtensionL |
|
6314 // ----------------------------------------------------------------------------- |
|
6315 // |
|
6316 void CEikMenuPane::CheckCreateExtensionL() |
7557 void CEikMenuPane::CheckCreateExtensionL() |
6317 { |
7558 { |
6318 if ( !iExtension ) |
7559 if ( !iExtension ) |
6319 { |
7560 { |
6320 iExtension = new (ELeave) CEikMenuPaneExtension; |
7561 iExtension = new (ELeave) CEikMenuPaneExtension; |
6321 iExtension->ConstructL( this ); |
7562 iExtension->ConstructL( this ); |
6322 } |
7563 } |
6323 } |
|
6324 |
|
6325 |
|
6326 // ----------------------------------------------------------------------------- |
|
6327 // CEikMenuPane::ItemRect |
|
6328 // ----------------------------------------------------------------------------- |
|
6329 // |
|
6330 TRect CEikMenuPane::ItemRect( TInt aItemIndex ) const |
|
6331 { |
|
6332 // this method is valid for the main menu only |
|
6333 TInt lastRow = AknLayoutScalable_Avkon::list_single_pane_cp2_ParamLimits().LastRow(); |
|
6334 aItemIndex = Min( aItemIndex, lastRow ); |
|
6335 |
|
6336 TAknLayoutRect layoutRect; |
|
6337 layoutRect.LayoutRect( iExtension->iItemAreaRect, |
|
6338 AknLayoutScalable_Avkon::list_single_pane_cp2( aItemIndex ) ); |
|
6339 |
|
6340 return layoutRect.Rect(); |
|
6341 } |
|
6342 |
|
6343 |
|
6344 // ----------------------------------------------------------------------------- |
|
6345 // CEikMenuPane::CalculateItemHeight |
|
6346 // ----------------------------------------------------------------------------- |
|
6347 // |
|
6348 TInt CEikMenuPane::CalculateItemHeight() const |
|
6349 { |
|
6350 TAknWindowLineLayout menuLineLayout; |
|
6351 |
|
6352 if ( iOwner ) // submenu |
|
6353 { |
|
6354 menuLineLayout = |
|
6355 AknLayoutScalable_Avkon::list_single_popup_submenu_pane( 0 ).LayoutLine(); |
|
6356 } |
|
6357 else |
|
6358 { |
|
6359 menuLineLayout = |
|
6360 AknLayoutScalable_Avkon::list_single_pane_cp2( 0 ).LayoutLine(); |
|
6361 } |
|
6362 |
|
6363 TAknLayoutRect menuLayoutRect; |
|
6364 menuLayoutRect.LayoutRect( Rect(), menuLineLayout ); |
|
6365 |
|
6366 return menuLayoutRect.Rect().Height(); |
|
6367 } |
7564 } |
6368 |
7565 |
6369 |
7566 |
6370 // ----------------------------------------------------------------------------- |
7567 // ----------------------------------------------------------------------------- |
6371 // CEikMenuPane::ConstructMenuSctRowL |
7568 // CEikMenuPane::ConstructMenuSctRowL |
6526 |
7710 |
6527 //iExtension->StartCascadeMenuDisappearTransition(); |
7711 //iExtension->StartCascadeMenuDisappearTransition(); |
6528 if ( iCascadeMenuPane->IsVisible() ) |
7712 if ( iCascadeMenuPane->IsVisible() ) |
6529 { |
7713 { |
6530 okToDraw = AknsUtils::SkinInstance() != NULL; |
7714 okToDraw = AknsUtils::SkinInstance() != NULL; |
|
7715 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
7716 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iExtension->iGc ); |
|
7717 if ( transApi && okToDraw ) |
|
7718 { |
|
7719 iCascadeMenuPane->SetFocus( EFalse, EDrawNow ); |
|
7720 } |
|
7721 #endif |
6531 // Stop ongoing comp. transitions, this is mostly for fast clicking |
7722 // Stop ongoing comp. transitions, this is mostly for fast clicking |
6532 // cases to make sure that no "scrap" is left behind. |
7723 // cases to make sure that no "scrap" is left behind. |
6533 GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort ); |
7724 GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort ); |
6534 |
|
6535 // cascade menu "cancel" animation. This does not apply |
7725 // cascade menu "cancel" animation. This does not apply |
6536 // when something is chosen from the menu |
7726 // when something is chosen from the menu |
6537 if ( iExtension->iShowCascadeTransition && okToDraw ) |
7727 |
6538 { |
7728 if( iExtension->iShowCascadeTransition && okToDraw ) |
6539 iCascadeMenuPane->SetParent( this ); |
7729 { |
6540 |
7730 iCascadeMenuPane->SetParent( this ); |
6541 GfxTransEffect::Begin( iCascadeMenuPane, KGfxControlDisappearAction ); |
7731 |
6542 GfxTransEffect::SetDemarcation( iCascadeMenuPane, iExtension->iCascadeDRect ); |
7732 GfxTransEffect::Begin( iCascadeMenuPane, KGfxControlDisappearAction ); |
6543 iCascadeMenuPane->MakeVisible( EFalse ); |
7733 GfxTransEffect::SetDemarcation( iCascadeMenuPane, iExtension->iCascadeDRect ); |
6544 GfxTransEffect::End( iCascadeMenuPane ); |
7734 |
|
7735 iCascadeMenuPane->MakeVisible( EFalse ); |
|
7736 |
|
7737 GfxTransEffect::End( iCascadeMenuPane ); |
|
7738 |
6545 } |
7739 } |
6546 } |
7740 } |
6547 |
7741 |
6548 // deregister right away since cascade menu is deleted |
7742 // deregister right away since cascade menu is deleted |
6549 GfxTransEffect::Deregister( iCascadeMenuPane ); |
7743 GfxTransEffect::Deregister( iCascadeMenuPane ); |
6583 return menuPane; |
7777 return menuPane; |
6584 } |
7778 } |
6585 |
7779 |
6586 |
7780 |
6587 // ----------------------------------------------------------------------------- |
7781 // ----------------------------------------------------------------------------- |
6588 // CEikMenuPane::SetItemCommandsStateL |
7782 // CEikMenuPane::SetItemCommandsDimmed |
6589 // ----------------------------------------------------------------------------- |
7783 // ----------------------------------------------------------------------------- |
6590 // |
7784 // |
6591 void CEikMenuPane::SetItemCommandsStateL( TBool aDimmed ) |
7785 void CEikMenuPane::SetItemCommandsDimmed() |
6592 { |
7786 { |
6593 if ( iExtension && iExtension->iFlags.IsSet( |
7787 if ( iExtension && iExtension->iFlags.IsSet( |
6594 CEikMenuPaneExtension::ESingleClickEnabled ) ) |
7788 CEikMenuPaneExtension::ESingleClickEnabled ) ) |
6595 { |
7789 { |
6596 if ( aDimmed ) |
7790 iExtension->iFlags.Set( |
6597 { |
7791 CEikMenuPaneExtension::EHideItemSpecificCommands ); |
6598 iExtension->iFlags.Set( |
|
6599 CEikMenuPaneExtension::EHideItemSpecificCommands ); |
|
6600 } |
|
6601 else |
|
6602 { |
|
6603 iExtension->iFlags.Set( |
|
6604 CEikMenuPaneExtension::EHideViewSpecificCommands ); |
|
6605 } |
|
6606 for ( TInt i = 0; i < iItemArray->Count(); ++i ) |
7792 for ( TInt i = 0; i < iItemArray->Count(); ++i ) |
6607 { |
7793 { |
6608 CEikMenuPaneItem* item = iItemArray->At( i ); |
7794 CEikMenuPaneItem* item = iItemArray->At( i ); |
6609 TBool itemSpecificItem( |
7795 if ( item->iData.iFlags & EEikMenuItemAction |
6610 item->iData.iFlags & EEikMenuItemAction |
|
6611 || item->iData.iFlags & EEikMenuItemSpecific |
7796 || item->iData.iFlags & EEikMenuItemSpecific |
6612 || item->iData.iFlags & EEikMenuItemSpecificListQuery ); |
7797 || item->iData.iFlags & EEikMenuItemSpecificListQuery ) |
6613 // Dim item specific items |
|
6614 if ( aDimmed && itemSpecificItem ) |
|
6615 { |
7798 { |
6616 item->iData.iFlags |= EEikMenuItemDimmed; |
7799 item->iData.iFlags |= EEikMenuItemDimmed; |
6617 } |
7800 } |
6618 // Dim items not item specific |
7801 } |
6619 else if ( !aDimmed |
7802 } |
6620 && ( !itemSpecificItem |
7803 } |
6621 || item->iData.iFlags & EEikMenuItemAction ) ) |
7804 |
6622 { |
|
6623 item->iData.iFlags |= EEikMenuItemDimmed; |
|
6624 if ( item->iData.iCascadeId ) |
|
6625 { |
|
6626 // i is not updated in AddCascadeMenuItemsToMenuL so going |
|
6627 // through added items again here. Then it goes through |
|
6628 // also submenus of submenus. |
|
6629 AddCascadeMenuItemsToMenuL( |
|
6630 item->iData.iCascadeId, ETrue, EFalse, NULL, i ); |
|
6631 } |
|
6632 } |
|
6633 } |
|
6634 } |
|
6635 } |
|
6636 |
|
6637 // ----------------------------------------------------------------------------- |
|
6638 // CEikMenuPane::SetItemActionsStateL |
|
6639 // ----------------------------------------------------------------------------- |
|
6640 // |
|
6641 void CEikMenuPane::SetItemActionsStateL( TBool aDimmed ) |
|
6642 { |
|
6643 if ( iExtension && iExtension->iFlags.IsSet( |
|
6644 CEikMenuPaneExtension::ESingleClickEnabled ) ) |
|
6645 { |
|
6646 if ( aDimmed ) |
|
6647 { |
|
6648 iExtension->iFlags.Set( |
|
6649 CEikMenuPaneExtension::EHideItemActionCommands ); |
|
6650 } |
|
6651 |
|
6652 for ( TInt i = 0; i < iItemArray->Count(); ++i ) |
|
6653 { |
|
6654 CEikMenuPaneItem* item = iItemArray->At( i ); |
|
6655 TBool itemActionItem( |
|
6656 item->iData.iFlags & EEikMenuItemAction ); |
|
6657 // Dim item specific items |
|
6658 if ( aDimmed && itemActionItem ) |
|
6659 { |
|
6660 item->iData.iFlags |= EEikMenuItemDimmed; |
|
6661 } |
|
6662 } |
|
6663 } |
|
6664 } |
|
6665 |
7805 |
6666 // ----------------------------------------------------------------------------- |
7806 // ----------------------------------------------------------------------------- |
6667 // CEikMenuPane::AddMenuItemsToItemActionMenuL |
7807 // CEikMenuPane::AddMenuItemsToItemActionMenuL |
6668 // ----------------------------------------------------------------------------- |
7808 // ----------------------------------------------------------------------------- |
6669 // |
7809 // |
6700 // If item is not item specific, add its item specific cascade menu |
7840 // If item is not item specific, add its item specific cascade menu |
6701 // items if the item itself isn't dimmed. |
7841 // items if the item itself isn't dimmed. |
6702 else if ( item->iData.iCascadeId && |
7842 else if ( item->iData.iCascadeId && |
6703 !( item->iData.iFlags & EEikMenuItemDimmed ) ) |
7843 !( item->iData.iFlags & EEikMenuItemDimmed ) ) |
6704 { |
7844 { |
6705 AddCascadeMenuItemsToMenuL( |
7845 AddCascadeMenuItemsToActionMenuL( |
6706 item->iData.iCascadeId, ETrue, ETrue, &aMenuData ); |
7846 item->iData.iCascadeId, ETrue, aMenuData ); |
6707 } |
7847 } |
6708 } |
7848 } |
6709 } |
7849 } |
6710 |
7850 |
6711 |
7851 |
6712 // ----------------------------------------------------------------------------- |
7852 // ----------------------------------------------------------------------------- |
6713 // CEikMenuPane::AddCascadeMenuItemsToMenuL |
7853 // CEikMenuPane::AddCascadeMenuItemsToActionMenuL |
6714 // ----------------------------------------------------------------------------- |
7854 // ----------------------------------------------------------------------------- |
6715 // |
7855 // |
6716 void CEikMenuPane::AddCascadeMenuItemsToMenuL( |
7856 void CEikMenuPane::AddCascadeMenuItemsToActionMenuL( |
6717 TInt aCascadeId, |
7857 TInt aCascadeId, |
6718 TBool aItemSpecific, |
7858 TBool aItemSpecific, |
6719 TBool aAddToItemActionMenu, |
7859 CAknItemActionMenuData& aMenuData ) |
6720 CAknItemActionMenuData* aMenuData, |
|
6721 TInt aItemIndex ) |
|
6722 { |
7860 { |
6723 if ( aCascadeId && iCoeEnv->IsResourceAvailableL( aCascadeId ) ) |
7861 if ( aCascadeId && iCoeEnv->IsResourceAvailableL( aCascadeId ) ) |
6724 { |
7862 { |
6725 CEikMenuPane* cascadeMenu = |
7863 CEikMenuPane* cascadeMenu = |
6726 CEikMenuPane::NewItemCommandMenuL( iMenuObserver ); |
7864 CEikMenuPane::NewItemCommandMenuL( iMenuObserver ); |