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> |
|
50 #include <skinlayout.cdl.h> |
49 #include <skinlayout.cdl.h> |
51 #include <aknlayoutscalable_avkon.cdl.h> |
50 #include <aknlayoutscalable_avkon.cdl.h> |
52 #include <AknLayoutFont.h> |
51 #include <AknLayoutFont.h> |
53 |
52 |
54 #include <AknsUtils.h> |
53 #include <AknsUtils.h> |
55 #include <AknIconUtils.h> |
54 #include <AknIconUtils.h> |
56 #include <aknappui.h> |
55 #include <aknappui.h> |
57 |
56 |
58 #include <AknsEffectAnim.h> |
|
59 #include <systemwarninglevels.hrh> |
|
60 #include <layoutmetadata.cdl.h> |
57 #include <layoutmetadata.cdl.h> |
61 #include <AknStatuspaneUtils.h> |
58 #include <AknStatuspaneUtils.h> |
62 #include <aknCharMap.h> |
59 #include <aknCharMap.h> |
63 #include <gfxtranseffect/gfxtranseffect.h> //For transition effects |
60 #include <gfxtranseffect/gfxtranseffect.h> //For transition effects |
64 #include <akntranseffect.h> //For transition effects |
61 #include <akntranseffect.h> //For transition effects |
65 #include <akntransitionutils.h> // SetAllParents method |
62 #include <akntransitionutils.h> // SetAllParents method |
66 #include <featmgr.h> |
63 #include <featmgr.h> |
67 #include <hal.h> |
|
68 #include <avkondomainpskeys.h> |
64 #include <avkondomainpskeys.h> |
69 #include <e32property.h> |
65 #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 |
|
76 |
66 |
77 #include <touchfeedback.h> |
67 #include <touchfeedback.h> |
78 #include <AknTasHook.h> |
68 #include <AknTasHook.h> |
79 #include <aknphysics.h> |
69 #include <aknphysics.h> |
80 #include <aknphysicsobserveriface.h> |
70 #include <aknphysicsobserveriface.h> |
165 TBool HighlightTimerActive() const; |
130 TBool HighlightTimerActive() const; |
166 |
131 |
167 void ChangePosition( TPointerEvent& aPointerEvent ); |
132 void ChangePosition( TPointerEvent& aPointerEvent ); |
168 void CalculateParentEvent( const TPointerEvent& aPointerEvent, |
133 void CalculateParentEvent( const TPointerEvent& aPointerEvent, |
169 TPointerEvent& aParentEvent ); |
134 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 ); |
|
181 void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); |
135 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 ); |
|
193 public: |
136 public: |
194 void ImmediateFeedback( TTouchLogicalFeedback aType, |
137 void ImmediateFeedback( TTouchLogicalFeedback aType, |
195 TTouchFeedbackType aFbType ); |
138 TTouchFeedbackType aFbType ); |
196 |
139 |
197 public: |
140 public: |
198 void StartCascadeMenuAppearTransition(); |
141 void StartCascadeMenuAppearTransition(); |
199 |
|
200 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
201 void CalcItemSize( MAknListBoxTfxInternal* transApi ) const; |
|
202 #endif |
|
203 |
142 |
204 /** |
143 /** |
205 * Prepares cascade menu for item specific commands. |
144 * Prepares cascade menu for item specific commands. |
206 */ |
145 */ |
207 void PrepareCascadeForItemCommands(); |
146 void PrepareCascadeForItemCommands(); |
234 /** |
173 /** |
235 * Is highlight enabled |
174 * Is highlight enabled |
236 * |
175 * |
237 * @return ETrue if highlight is enabled |
176 * @return ETrue if highlight is enabled |
238 */ |
177 */ |
239 TBool HighlightEnabled(); |
178 TBool HighlightEnabled(); |
240 |
179 |
241 /** |
180 /** |
242 * Sets the default highlight to options menu |
181 * Sets the default highlight to options menu |
243 * |
182 * |
244 */ |
183 */ |
245 void SetDefaultHighlight(); |
184 void SetDefaultHighlight(); |
246 |
185 |
247 public: // Data |
186 public: // Data |
248 TBool iHasIcon; |
|
249 TBool iIsPenEnable; |
|
250 CFbsBitmap* iCascadeBitmap; |
187 CFbsBitmap* iCascadeBitmap; |
251 CFbsBitmap* iCascadeBitmapMask; |
188 CFbsBitmap* iCascadeBitmapMask; |
252 CAknsFrameBackgroundControlContext* iBgContext; |
189 CAknsFrameBackgroundControlContext* iBgContext; |
253 TInt iSubMenuWidthIndex; // index for submenu layout which depends on the text length |
190 TInt iSubMenuWidthIndex; // index for submenu layout which depends on the text length |
254 CFbsBitmap* iCheckMarkBitmap; // bitmap to be drawn if the item has check box set on |
191 CFbsBitmap* iCheckMarkBitmap; // bitmap to be drawn if the item has check box set on |
255 CFbsBitmap* iCheckMarkBitmapMask; // mask for the above bitmap |
192 CFbsBitmap* iCheckMarkBitmapMask; // mask for the above bitmap |
256 CFbsBitmap* iRadioButtonBitmap; // bitmap to be drawn if the item has radio button set on |
193 CFbsBitmap* iRadioButtonBitmap; // bitmap to be drawn if the item has radio button set on |
257 CFbsBitmap* iRadioButtonBitmapMask; // mask for the above bitmap |
194 CFbsBitmap* iRadioButtonBitmapMask; // mask for the above bitmap |
258 TBool iHasRadioGroup; // is ETrue if submenu contains radio button group. |
195 TBool iHasRadioGroup; // is ETrue if submenu contains radio button group. |
259 TInt iSelectedRadioButtonItem; // index of the radio button item which is currently selected (one must be selected) |
196 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 |
|
261 CEikMenuPane* iControl; |
197 CEikMenuPane* iControl; |
262 CAknsEffectAnim* iAnimation; |
|
263 /** |
|
264 * Stored flags are explained in enumeration TFlags. |
|
265 */ |
|
266 TBitFlags32 iAnimFlags; |
|
267 |
|
268 CAknCharMap* iSct; // Menu SCT row, created only when needed. |
198 CAknCharMap* iSct; // Menu SCT row, created only when needed. |
269 TBool iSctHighlighted; // No "normal" menu item can be highlighted if ETrue |
199 TBool iSctHighlighted; // No "normal" menu item can be highlighted if ETrue |
270 |
200 |
271 // Pen event related flag indicating whether the (sub)menu pane has |
201 // Pen event related flag indicating whether the (sub)menu pane has |
272 // already consumed EButton1Down or not. If false, |
202 // already consumed EButton1Down or not. If false, |
275 TBool iSpecialCharPointed; |
205 TBool iSpecialCharPointed; |
276 // transition demarcation rectangle for cascaded submenu |
206 // transition demarcation rectangle for cascaded submenu |
277 // needs to be mutable since we need to get information from Draw methods |
207 // needs to be mutable since we need to get information from Draw methods |
278 // (that are declared const) |
208 // (that are declared const) |
279 mutable TRect iCascadeDRect; |
209 mutable TRect iCascadeDRect; |
280 TBool iTransitionsOn; // Transitions FtMgr flag on |
|
281 TBool iShowCascadeTransition; |
210 TBool iShowCascadeTransition; |
282 // For later deletion of cascade menu, this allows the transition system |
211 // For later deletion of cascade menu, this allows the transition system |
283 // to correctly handle the aborted transitions |
212 // to correctly handle the aborted transitions |
284 CEikMenuPane* iCascadeMenuObject; |
213 CEikMenuPane* iCascadeMenuObject; |
285 TBool iDraggedOutside; |
214 TBool iDraggedOutside; |
286 TPointerEvent iLastPointerEvent; |
215 TPointerEvent iLastPointerEvent; |
287 |
|
288 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
289 CWindowGc* iGc; |
|
290 #endif |
|
291 TInt iItemsThatFitInView; |
216 TInt iItemsThatFitInView; |
292 TRect iScrollBarRect; |
217 TRect iScrollBarRect; |
293 TRect iSctRect; |
218 TRect iSctRect; |
294 TInt iTotalNumberOfItemsInView; // this value includes partial items |
|
295 |
|
296 |
|
297 CIdle* iTaskSwapIdle; |
219 CIdle* iTaskSwapIdle; |
298 CRedirectionListener* iRedirectionListener; |
220 CRedirectionListener* iRedirectionListener; |
299 TRect iSBRect; |
|
300 RWindow* iMenuPaneWindow; // Not own, used by SCT |
221 RWindow* iMenuPaneWindow; // Not own, used by SCT |
301 TBool iLaunchCascadeMenu; |
222 TBool iLaunchCascadeMenu; |
302 TBool isUpdateScrollDirectly; |
223 TBool isUpdateScrollDirectly; |
303 TBool iPressedDown; // ETrue if pointer is down, otherwise. |
224 TBool iPressedDown; // ETrue if pointer is down, otherwise. |
304 |
225 |
946 iCheckMarkBitmapMask( NULL ), |
871 iCheckMarkBitmapMask( NULL ), |
947 iRadioButtonBitmap( NULL ), |
872 iRadioButtonBitmap( NULL ), |
948 iRadioButtonBitmapMask( NULL ), |
873 iRadioButtonBitmapMask( NULL ), |
949 iHasRadioGroup( EFalse ), |
874 iHasRadioGroup( EFalse ), |
950 iSelectedRadioButtonItem( KNoSelectedRadioButtonItem ), |
875 iSelectedRadioButtonItem( KNoSelectedRadioButtonItem ), |
951 iGrabbingCBAComponent( NULL ), |
|
952 iControl( NULL ), |
876 iControl( NULL ), |
953 iAnimation( NULL ), |
|
954 iAnimFlags ( 0 ), |
|
955 iSct( NULL ), |
877 iSct( NULL ), |
956 iSctHighlighted( EFalse ), |
878 iSctHighlighted( EFalse ), |
957 iSpecialCharPointed( EFalse ) |
879 iSpecialCharPointed( EFalse ) |
958 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
959 ,iGc ( NULL ) |
|
960 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
961 ,iVerticalOffset( 0 ) |
880 ,iVerticalOffset( 0 ) |
962 ,iPhysics( NULL ) |
881 ,iPhysics( NULL ) |
963 ,iListTopIndex( 0 ) |
882 ,iListTopIndex( 0 ) |
964 ,iViewHeight( 0 ) |
883 ,iViewHeight( 0 ) |
965 ,iFlickActive( EFalse ) |
884 ,iFlickActive( EFalse ) |
966 ,iPanningActive( EFalse ) |
885 ,iPanningActive( EFalse ) |
967 ,iFeedback( MTouchFeedback::Instance() ) |
886 ,iFeedback( MTouchFeedback::Instance() ) |
968 ,iLastFeedbackTopItemIndex( 0 ) |
887 ,iLastFeedbackTopItemIndex( 0 ) |
969 { |
888 { |
970 iIsPenEnable = AknLayoutUtils::PenEnabled(); |
889 iItemsReadyForPenSelection = !AknLayoutUtils::PenEnabled(); |
971 iItemsReadyForPenSelection = !iIsPenEnable; |
|
972 iNextHighlightItem = KErrNotFound; |
890 iNextHighlightItem = KErrNotFound; |
|
891 iHighlightedItem = KErrNotFound; |
973 } |
892 } |
974 |
893 |
975 // ----------------------------------------------------------------------------- |
894 // ----------------------------------------------------------------------------- |
976 // CEikMenuPaneExtension::~CEikMenuPaneExtension |
895 // CEikMenuPaneExtension::~CEikMenuPaneExtension |
977 // Destructor for extension class |
896 // Destructor for extension class |
978 // ----------------------------------------------------------------------------- |
897 // ----------------------------------------------------------------------------- |
979 // |
898 // |
980 CEikMenuPaneExtension::~CEikMenuPaneExtension() |
899 CEikMenuPaneExtension::~CEikMenuPaneExtension() |
981 { |
900 { |
982 _AKNTRACE_FUNC_ENTER; |
901 _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 ); |
|
994 |
902 |
995 delete iCascadeBitmap; |
903 delete iCascadeBitmap; |
996 iCascadeBitmap = NULL; |
904 iCascadeBitmap = NULL; |
997 |
905 |
998 delete iCascadeBitmapMask; |
906 delete iCascadeBitmapMask; |
1082 |
980 |
1083 iBgContext = CAknsFrameBackgroundControlContext::NewL( |
981 iBgContext = CAknsFrameBackgroundControlContext::NewL( |
1084 KAknsIIDQsnFrPopup, TRect( 0, 0, 1, 1 ), TRect( 0, 0, 1, 1 ), EFalse ); |
982 KAknsIIDQsnFrPopup, TRect( 0, 0, 1, 1 ), TRect( 0, 0, 1, 1 ), EFalse ); |
1085 } |
983 } |
1086 |
984 |
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 } |
|
1136 |
985 |
1137 // ----------------------------------------------------------------------------- |
986 // ----------------------------------------------------------------------------- |
1138 // CEikMenuPaneExtension::StartCascadeMenuTimerL |
987 // CEikMenuPaneExtension::StartCascadeMenuTimerL |
1139 // Starts the timer for the sub menu launch. Timer is constructed when used for |
988 // Starts the timer for the sub menu launch. Timer is constructed when used for |
1140 // the first time |
989 // the first time |
1361 // |
1213 // |
1362 void CEikMenuPaneExtension::CalculateParentEvent( const TPointerEvent& aPointerEvent, |
1214 void CEikMenuPaneExtension::CalculateParentEvent( const TPointerEvent& aPointerEvent, |
1363 TPointerEvent& aParentEvent ) |
1215 TPointerEvent& aParentEvent ) |
1364 { |
1216 { |
1365 aParentEvent.iModifiers = aPointerEvent.iModifiers; |
1217 aParentEvent.iModifiers = aPointerEvent.iModifiers; |
1366 TPoint subPos = iControl->PositionRelativeToScreen(); |
1218 TPoint subPos = iControl->Position(); |
1367 TPoint ownerPos = iControl->iOwner->PositionRelativeToScreen(); |
1219 TPoint ownerPos = iControl->iOwner->Position(); |
1368 aParentEvent.iPosition.SetXY ( |
1220 aParentEvent.iPosition.SetXY ( |
1369 aPointerEvent.iPosition.iX + subPos.iX - ownerPos.iX, |
1221 aPointerEvent.iPosition.iX + subPos.iX - ownerPos.iX, |
1370 aPointerEvent.iPosition.iY + subPos.iY - ownerPos.iY); |
1222 aPointerEvent.iPosition.iY + subPos.iY - ownerPos.iY); |
1371 aParentEvent.iType = aPointerEvent.iType; |
1223 aParentEvent.iType = aPointerEvent.iType; |
1372 } |
1224 } |
1373 |
1225 |
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 } |
|
1518 |
1226 |
1519 // ----------------------------------------------------------------------------- |
1227 // ----------------------------------------------------------------------------- |
1520 // CEikMenuPaneExtension::MenuClosed |
1228 // CEikMenuPaneExtension::MenuClosed |
1521 // ----------------------------------------------------------------------------- |
1229 // ----------------------------------------------------------------------------- |
1522 // |
1230 // |
1523 void CEikMenuPaneExtension::MenuClosed() |
1231 void CEikMenuPaneExtension::MenuClosed() |
1524 { |
1232 { |
1525 _AKNTRACE_FUNC_ENTER; |
1233 _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 |
|
1534 delete iSct; |
1234 delete iSct; |
1535 iSct = NULL; |
1235 iSct = NULL; |
1536 iSctHighlighted = EFalse; |
1236 iSctHighlighted = EFalse; |
1537 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
1538 iSctRect = TRect::EUninitialized; |
|
1539 #endif |
|
1540 |
1237 |
1541 if ( iCba ) |
1238 if ( iCba ) |
1542 { |
1239 { |
1543 iCba = NULL; |
1240 iCba = NULL; |
1544 } |
1241 } |
1552 iFlags.Clear( EContextSensitive ); |
1249 iFlags.Clear( EContextSensitive ); |
1553 iFlags.Clear( EHighlightEnabled ); |
1250 iFlags.Clear( EHighlightEnabled ); |
1554 _AKNTRACE_FUNC_EXIT; |
1251 _AKNTRACE_FUNC_EXIT; |
1555 } |
1252 } |
1556 |
1253 |
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 } |
|
1743 |
1254 |
1744 // ----------------------------------------------------------------------------- |
1255 // ----------------------------------------------------------------------------- |
1745 // CEikMenuPaneExtension::ConstructMenuSctRowL |
1256 // CEikMenuPaneExtension::ConstructMenuSctRowL |
1746 // Creates a special characters row to be used in edit menu. |
1257 // Creates a special characters row to be used in edit menu. |
1747 // ----------------------------------------------------------------------------- |
1258 // ----------------------------------------------------------------------------- |
2360 iEditMenuObserver = aEditMenuObserver; |
1862 iEditMenuObserver = aEditMenuObserver; |
2361 |
1863 |
2362 CheckCreateScrollerL(); |
1864 CheckCreateScrollerL(); |
2363 CheckCreateExtensionL(); |
1865 CheckCreateExtensionL(); |
2364 |
1866 |
2365 iExtension->iTransitionsOn = FeatureManager::FeatureSupported( KFeatureIdUiTransitionEffects ); |
|
2366 |
|
2367 CreateWindowL( iCoeEnv->RootWin() ); |
1867 CreateWindowL( iCoeEnv->RootWin() ); |
2368 EnableWindowTransparency(); |
1868 EnableWindowTransparency(); |
2369 SetAllowStrayPointers(); |
1869 SetAllowStrayPointers(); |
2370 EnableDragEvents(); |
1870 EnableDragEvents(); |
2371 |
1871 |
2372 TAknWindowLineLayout menuLineLayout; |
1872 iItemHeight = CalculateItemHeight(); |
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(); |
|
2386 |
1873 |
2387 if ( iExtension->iSct ) |
1874 if ( iExtension->iSct ) |
2388 { |
1875 { |
2389 RWindow* window = (RWindow*)this->DrawableWindow(); |
1876 RWindow* window = (RWindow*)this->DrawableWindow(); |
2390 iExtension->iMenuPaneWindow = window; |
1877 iExtension->iMenuPaneWindow = window; |
2391 iExtension->iSct->SetContainerWindowL( *this ); |
1878 iExtension->iSct->SetContainerWindowL( *this ); |
2392 |
1879 |
2393 if ( AknLayoutUtils::PenEnabled() ) |
1880 // This is effectively the same as CCoeControl::EnableDragEvents() |
2394 { |
1881 // which is protected. |
2395 // This is effectively the same as CCoeControl::EnableDragEvents() |
1882 window->PointerFilter( EPointerFilterDrag, 0 ); |
2396 // which is protected. |
1883 iExtension->iSct->SetGloballyCapturing( ETrue ); |
2397 window->PointerFilter( EPointerFilterDrag, 0 ); |
1884 iExtension->iSct->SetPointerCapture( ETrue ); |
2398 iExtension->iSct->SetGloballyCapturing( ETrue ); |
1885 iExtension->iSct->SetObserver(iExtension); |
2399 iExtension->iSct->SetPointerCapture( ETrue ); |
|
2400 iExtension->iSct->SetObserver(iExtension); |
|
2401 } |
|
2402 } |
1886 } |
2403 |
1887 |
2404 if ( iOwner ) // submenu |
1888 if ( iOwner ) // submenu |
2405 { |
1889 { |
2406 SetPointerCapture( ETrue ); |
1890 SetPointerCapture( ETrue ); |
3084 PrepareHighlightFrame(); |
2517 PrepareHighlightFrame(); |
3085 |
2518 |
3086 if ( previousTopItem == topItem && aNewSelectedItem >= 0 ) |
2519 if ( previousTopItem == topItem && aNewSelectedItem >= 0 ) |
3087 { |
2520 { |
3088 // then only previuosly and currently selected items should be redrawn |
2521 // then only previuosly and currently selected items should be redrawn |
3089 DrawItem( gc, previousSelectedItem, ERemoveHighlight ); |
2522 if ( iExtension->iHighlightedItem != KErrNotFound ) |
|
2523 { |
|
2524 DrawItem( gc, previousSelectedItem, ERemoveHighlight ); |
|
2525 } |
3090 |
2526 |
3091 if ( !iExtension->iSctHighlighted ) |
2527 if ( !iExtension->iSctHighlighted ) |
3092 { |
2528 { |
3093 DrawItem( gc, aNewSelectedItem, EDrawHighlight ); |
2529 DrawItem( gc, aNewSelectedItem, EDrawHighlight ); |
3094 } |
2530 } |
3095 } |
2531 } |
3096 else |
2532 else |
3097 { |
2533 { |
3098 TBool skipHighlight = EFalse; |
2534 /*TBool skipHighlight = EFalse; |
|
2535 |
3099 if (iExtension && iExtension->iSct && aNewSelectedItem == 0 && |
2536 if (iExtension && iExtension->iSct && aNewSelectedItem == 0 && |
3100 previousSelectedItem > 1) |
2537 previousSelectedItem > 1) |
3101 { |
2538 { |
3102 skipHighlight = ETrue; |
2539 skipHighlight = ETrue; |
3103 } |
2540 } |
|
2541 |
3104 for( TInt i = topItem; i<bottomItem; i++ ) |
2542 for( TInt i = topItem; i<bottomItem; i++ ) |
3105 { |
2543 { |
3106 if( i == aNewSelectedItem && !skipHighlight) |
2544 if( i == aNewSelectedItem && !skipHighlight) |
3107 { |
2545 { |
3108 DrawItem( gc, i, EDrawHighlight ); |
2546 DrawItem( gc, i, EDrawHighlight ); |
3109 } |
2547 } |
3110 else |
2548 else |
3111 { |
2549 { |
3112 DrawItem( gc, i, ERemoveHighlight ); |
2550 DrawItem( gc, i, ERemoveHighlight ); |
3113 } |
2551 } |
3114 } |
2552 }*/ |
3115 } |
2553 |
3116 |
2554 // update the whole menu area |
3117 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2555 iExtension->ViewPositionChanged( iExtension->iViewPosition ); |
3118 if ( transApi ) |
2556 // UpdateScrollBarThumbs(); |
3119 { |
2557 } |
3120 iExtension->iGc->Deactivate(); |
2558 |
3121 } |
|
3122 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
3123 DeactivateGc(); |
2559 DeactivateGc(); |
3124 |
2560 |
3125 UpdateScrollBarThumbs(); |
|
3126 |
|
3127 // Updating view position here prevents some flickering |
|
3128 iExtension->ViewPositionChanged( iExtension->iViewPosition ); |
|
3129 |
|
3130 _AKNTRACE_FUNC_EXIT; |
2561 _AKNTRACE_FUNC_EXIT; |
3131 } |
2562 } |
3132 |
2563 |
3133 // ----------------------------------------------------------------------------- |
2564 // ----------------------------------------------------------------------------- |
3134 // CEikMenuPane::PrepareGcForDrawingItems |
2565 // CEikMenuPane::PrepareGcForDrawingItems |
3135 // ----------------------------------------------------------------------------- |
2566 // ----------------------------------------------------------------------------- |
3136 // |
2567 // |
3137 void CEikMenuPane::PrepareGcForDrawingItems(CGraphicsContext& aGc) const |
2568 void CEikMenuPane::PrepareGcForDrawingItems(CGraphicsContext& aGc) const |
3138 { |
2569 { |
3139 |
|
3140 // BIDI |
2570 // BIDI |
3141 /* |
2571 /* |
3142 * get the fonts from the LAF! |
2572 * get the fonts from the LAF! |
3143 * Do we need to get them here? - nope - moved to DrawItem() |
2573 * Do we need to get them here? - nope - moved to DrawItem() |
3144 */ |
2574 */ |
3145 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2575 aGc.SetPenColor( iEikonEnv->ControlColor( EColorMenuPaneText, *this) ); |
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 |
|
3157 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
2576 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
3158 aGc.SetBrushColor( iEikonEnv->ControlColor( EColorMenuPaneBackground,*this ) ); |
2577 aGc.SetBrushColor( iEikonEnv->ControlColor( EColorMenuPaneBackground,*this ) ); |
3159 #endif |
2578 } |
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 |
|
3310 |
2579 |
3311 |
2580 |
3312 // --------------------------------------------------------------------------- |
2581 // --------------------------------------------------------------------------- |
3313 // CEikMenuPane::DrawItem |
2582 // CEikMenuPane::DrawItem |
3314 // --------------------------------------------------------------------------- |
2583 // --------------------------------------------------------------------------- |
3315 // |
2584 // |
3316 void CEikMenuPane::DrawItem( TInt aItem, THighlightType aHighlight ) const |
2585 void CEikMenuPane::DrawItem( TInt aItem, THighlightType aHighlight ) const |
3317 { |
2586 { |
3318 ActivateGc(); |
2587 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 |
|
3330 CWindowGc& gc = SystemGc(); |
2588 CWindowGc& gc = SystemGc(); |
3331 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
3332 PrepareGcForDrawingItems( gc ); |
2589 PrepareGcForDrawingItems( gc ); |
3333 DrawItem( gc, aItem, aHighlight ); |
2590 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 |
|
3341 DeactivateGc(); |
2591 DeactivateGc(); |
3342 } |
2592 } |
3343 |
2593 |
3344 |
2594 |
3345 // --------------------------------------------------------------------------- |
2595 // --------------------------------------------------------------------------- |
3419 if ( index < 0 || index >= maxNumberOfItems || (iExtension->iSct && index==0)) |
2664 if ( index < 0 || index >= maxNumberOfItems || (iExtension->iSct && index==0)) |
3420 { |
2665 { |
3421 return; // only interested in drawing visible items |
2666 return; // only interested in drawing visible items |
3422 } |
2667 } |
3423 |
2668 |
3424 // Collect all of the information from the Layout DLL. Initialise these |
2669 TAknTextLineLayout menuTextLayout; |
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; |
|
3432 TAknLayoutRect singleMenuPaneRect; |
2670 TAknLayoutRect singleMenuPaneRect; |
3433 |
2671 |
3434 if ( !iOwner ) |
2672 if ( !iOwner ) // main menu |
3435 { |
2673 { |
3436 TAknWindowLineLayout listScrollPaneLayout( |
2674 singleMenuPaneRect.LayoutRect( iExtension->iItemAreaRect, |
3437 AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() ); |
2675 AknLayoutScalable_Avkon::list_single_pane_cp2( index ).LayoutLine() ); |
3438 if ( iExtension ) |
2676 menuTextLayout = |
3439 { |
2677 AknLayoutScalable_Avkon::list_single_pane_t1_cp2( cascade ? 1 : 0 ).LayoutLine(); |
3440 iExtension->AdjustPopupLayoutData( listScrollPaneLayout ); |
2678 } |
3441 } |
2679 else // submenu |
3442 TAknLayoutRect listScrollPaneRect; |
2680 { |
3443 listScrollPaneRect.LayoutRect( windowRect, listScrollPaneLayout ); |
2681 singleMenuPaneRect.LayoutRect( iExtension->iItemAreaRect, |
3444 |
2682 AknLayoutScalable_Avkon::list_single_popup_submenu_pane( index ).LayoutLine() ); |
3445 menuPane = AknLayoutScalable_Avkon::list_menu_pane( 0 ).LayoutLine(); |
2683 |
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 |
|
3473 if ( hasIcon ) |
2684 if ( hasIcon ) |
3474 { |
2685 { |
3475 menuTextLayout = TAknTextLineLayout( AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 1 ).LayoutLine() ); |
2686 menuTextLayout = |
|
2687 TAknTextLineLayout( |
|
2688 AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 1 ).LayoutLine() ); |
|
2689 } |
|
2690 else |
|
2691 { |
|
2692 menuTextLayout = |
|
2693 TAknTextLineLayout( |
|
2694 AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 0 ).LayoutLine() ); |
3476 } |
2695 } |
3477 } |
2696 } |
3478 |
2697 |
3479 TRect itemRect( singleMenuPaneRect.Rect() ); |
2698 TRect itemRect( singleMenuPaneRect.Rect() ); |
3480 |
2699 |
3514 if( iExtension ) |
2727 if( iExtension ) |
3515 { |
2728 { |
3516 cc = iExtension->iBgContext; |
2729 cc = iExtension->iBgContext; |
3517 } |
2730 } |
3518 TBool background( ETrue ); |
2731 TBool background( ETrue ); |
3519 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2732 |
3520 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc ); |
2733 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
3521 if ( transApi && !transApi->EffectsDisabled() ) |
2734 aGc.SetBrushColor( singleMenuPaneRect.Color() ); |
3522 { |
2735 |
3523 iExtension->iGc->Activate( *DrawableWindow() ); |
2736 // there can be partial items, so clip drawing on menu pane's item area |
3524 } |
2737 aGc.SetClippingRect( iExtension->iItemAreaRect ); |
3525 #endif |
2738 |
3526 |
2739 if (!iExtension->iFullRedraw) |
3527 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2740 { |
3528 if ( !transApi || transApi->EffectsDisabled() ) |
2741 background = AknsDrawUtils::Background( |
3529 { |
2742 skin, cc, this, aGc, itemRect, |
3530 #endif |
2743 KAknsDrawParamNoClearUnderImage ); |
|
2744 } |
|
2745 |
|
2746 if ( !background ) |
|
2747 { |
3531 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
2748 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
3532 aGc.SetBrushColor( singleMenuPaneRect.Color() ); |
2749 aGc.SetPenStyle( CGraphicsContext::ENullPen ); |
3533 |
2750 aGc.SetPenColor( singleMenuPaneRect.Color() ); |
3534 if(!iExtension->iFullRedraw) |
2751 aGc.SetBrushColor( singleMenuPaneRect.Color() ); |
3535 { |
2752 aGc.DrawRect( itemRect ); |
3536 background = AknsDrawUtils::Background( |
2753 } |
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 |
|
3552 |
2754 |
3553 if ( !iExtension->HighlightEnabled() ) |
2755 if ( !iExtension->HighlightEnabled() ) |
3554 { |
2756 { |
3555 aHighlight = ENoHighlight; |
2757 aHighlight = ENoHighlight; |
3556 } |
2758 } |
3557 |
2759 |
3558 switch ( aHighlight ) |
2760 switch ( aHighlight ) |
3559 { |
2761 { |
3560 case EDrawHighlight : |
2762 case EDrawHighlight : |
3561 { |
2763 { |
3562 if ( !iExtension->iSctHighlighted ) |
2764 if ( !iExtension->iSctHighlighted ) |
3563 { |
2765 { |
3564 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2766 iExtension->iHighlightedItem = aItem; |
3565 if ( transApi ) |
2767 |
3566 { |
2768 // Because of transparency, background must be drawn here as well |
3567 // This will remove the old bitmap |
2769 // (as frame may be see-through) |
3568 transApi->Invalidate( MAknListBoxTfxInternal::EListHighlight ); |
2770 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
3569 |
2771 aGc.SetBrushColor( singleMenuPaneRect.Color() ); |
3570 transApi->BeginRedraw( MAknListBoxTfxInternal::EListHighlight, |
2772 |
3571 itemRect ); |
2773 AknsDrawUtils::Background( |
3572 transApi->StartDrawing( MAknListBoxTfxInternal::EListHighlight ); |
2774 skin, cc, this, aGc, itemRect, |
3573 } |
2775 KAknsDrawParamNoClearUnderImage ); |
3574 #endif |
2776 |
3575 |
2777 TAknLayoutRect highlightTopLeft; |
3576 // Partial items, so prevent drawing over the edge of menu pane |
2778 TAknLayoutRect highlightBottomRight; |
3577 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2779 |
3578 if ( !transApi || ( transApi && transApi->EffectsDisabled() ) ) |
2780 highlightTopLeft.LayoutRect(itemRect, |
3579 { |
2781 SkinLayout::List_highlight_skin_placing__popup_windows__Line_2() ); |
3580 aGc.SetClippingRect(menuPaneRect.Rect()); |
2782 highlightBottomRight.LayoutRect(itemRect, |
3581 } |
2783 SkinLayout::List_highlight_skin_placing__popup_windows__Line_5() ); |
3582 #else |
2784 TRect outerRect( highlightTopLeft.Rect().iTl, highlightBottomRight.Rect().iBr ); |
3583 aGc.SetClippingRect(menuPaneRect.Rect()); |
2785 TRect innerRect( highlightTopLeft.Rect().iBr, highlightBottomRight.Rect().iTl ); |
3584 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
2786 |
3585 |
2787 TBool drawOk = AknsDrawUtils::DrawFrame( skin, |
3586 TBool drawOk = EFalse; |
2788 aGc, |
3587 if( iExtension->iAnimation ) // Draw animated highlight |
2789 outerRect, |
3588 { |
2790 innerRect, |
3589 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2791 KAknsIIDQsnFrList, |
3590 if ( transApi && transApi->VerifyKml() == KErrNone ) |
2792 KAknsIIDDefault ); |
3591 { |
2793 |
3592 Extension()->UseNoAnimation(); |
2794 // skinned highlight drawing has failed |
3593 } |
2795 if ( !drawOk ) |
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 ) |
|
3649 { |
2796 { |
3650 TAknLayoutRect shadowRect; |
2797 TAknLayoutRect shadowRect; |
3651 TAknLayoutRect highlightRect; |
2798 TAknLayoutRect highlightRect; |
3652 shadowRect.LayoutRect( itemRect, |
2799 shadowRect.LayoutRect( itemRect, |
3653 AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_1( itemRect ) ); |
2800 AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_1( itemRect ) ); |
3844 TRect cascRect( textRect.TextRect() ); |
2969 TRect cascRect( textRect.TextRect() ); |
3845 cascRect.Move( position ); |
2970 cascRect.Move( position ); |
3846 iExtension->iCascadeDRect.SetRect( cascRect.iTl, cascRect.iBr ); |
2971 iExtension->iCascadeDRect.SetRect( cascRect.iTl, cascRect.iBr ); |
3847 } |
2972 } |
3848 |
2973 |
3849 if(iExtension->iIsPenEnable) |
2974 TAknLayoutRect highlightRect; |
3850 { |
2975 highlightRect.LayoutRect( itemRect, |
3851 TAknLayoutRect highlightRect; |
2976 AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_2( itemRect ) ); |
3852 highlightRect.LayoutRect( itemRect, |
2977 |
3853 AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_2( itemRect ) ); |
2978 // store the calculated y-position to the menu item, |
3854 |
2979 // so that it can be used in HandlePointerEventL() |
3855 // store the calculated y-position to the menu item, |
2980 item->iPos = highlightRect.Rect().iTl.iY; |
3856 // so that it can be used in HandlePointerEventL() |
2981 |
3857 item->iPos = highlightRect.Rect().iTl.iY; |
2982 // don't draw separator line for the last item |
3858 aGc.DiscardFont(); |
2983 if ( drawSeparator ) |
3859 } |
2984 { |
3860 |
2985 AknListUtils::DrawSeparator( aGc, itemRect, textColor ); |
3861 if ( !drawingInitiated ) |
2986 } |
|
2987 |
|
2988 if ( !drawingInitiated && !iExtension->iFullRedraw ) |
3862 { |
2989 { |
3863 Window().EndRedraw(); |
2990 Window().EndRedraw(); |
3864 } |
2991 } |
3865 |
2992 |
3866 aGc.CancelClippingRect(); |
2993 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 |
|
3876 } |
2994 } |
3877 |
2995 |
3878 |
2996 |
3879 // ----------------------------------------------------------------------------- |
2997 // ----------------------------------------------------------------------------- |
3880 // CEikMenuPane::Draw |
2998 // CEikMenuPane::Draw |
3881 // ----------------------------------------------------------------------------- |
2999 // ----------------------------------------------------------------------------- |
3882 // |
3000 // |
3883 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3884 EXPORT_C void CEikMenuPane::Draw( const TRect& aRect ) const |
3001 EXPORT_C void CEikMenuPane::Draw( const TRect& aRect ) const |
3885 { |
3002 { |
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() ); |
|
3913 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
3003 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
3914 MAknsControlContext* cc = NULL; |
3004 MAknsControlContext* cc = NULL; |
3915 |
3005 |
3916 if( iExtension ) |
3006 if( iExtension ) |
3917 { |
3007 { |
3918 cc = iExtension->iBgContext; |
3008 cc = iExtension->iBgContext; |
3919 } |
3009 } |
3920 |
3010 |
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 |
|
3928 CWindowGc& gc = SystemGc(); |
3011 CWindowGc& gc = SystemGc(); |
3929 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
3930 PrepareGcForDrawingItems( gc ); |
3012 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 } |
|
3950 |
3013 |
3951 TInt count=0; |
3014 TInt count=0; |
|
3015 |
3952 if( iItemArray ) |
3016 if( iItemArray ) |
3953 { |
3017 { |
3954 count=iItemArray->Count(); |
3018 count=iItemArray->Count(); |
3955 } |
3019 } |
3956 |
3020 |
3957 // Give the topmost menu item's rect to SCT if needed. |
3021 // Give the topmost menu item's rect to SCT if needed. |
3958 if ( iExtension->iSct ) |
3022 if ( iExtension->iSct ) |
3959 { |
3023 { |
3960 TAknLayoutRect listScrollPaneRect; |
3024 iExtension->iSct->SetMenuSctRect( ItemRect( 0 ) ); |
3961 TAknLayoutRect menuPaneRect; |
3025 |
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 { |
|
3996 TRegionFix<4> region; |
3026 TRegionFix<4> region; |
3997 region.AddRect( Rect() ); |
3027 region.AddRect( aRect ); |
3998 region.SubRect( iExtension->iSct->Rect() ); |
3028 region.SubRect( iExtension->iSct->Rect() ); |
3999 gc.SetClippingRegion( region ); |
3029 gc.SetClippingRegion( region ); |
4000 } |
3030 } |
4001 |
|
4002 TRect backgroundRect( iOwner ? windowRect : iExtension->GetBackgroundRect( windowRect ) ); |
|
4003 |
3031 |
4004 // The added flag removes the white bg for transparency |
3032 // The added flag removes the white bg for transparency |
4005 TBool frameDrawn = AknsDrawUtils::Background( |
3033 TBool frameDrawn = AknsDrawUtils::Background( |
4006 skin, cc, this, gc, backgroundRect, KAknsDrawParamNoClearUnderImage ); |
3034 skin, cc, this, gc, aRect, KAknsDrawParamNoClearUnderImage ); |
4007 |
3035 |
4008 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3036 if ( aRect.Intersects( iExtension->iItemAreaRect ) ) |
4009 if ( transApi ) |
3037 { |
4010 { |
3038 iExtension->iFullRedraw = ETrue; |
4011 transApi->StopDrawing(); |
3039 |
4012 } |
3040 for ( TInt ii=0;ii<count;++ii ) |
4013 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
3041 { |
4014 |
3042 if(!iExtension->iSctHighlighted && ii == iSelectedItem ) |
4015 iExtension->iFullRedraw = ETrue; |
3043 DrawItem( gc, ii, EDrawHighlight); |
4016 |
3044 else |
4017 for ( TInt ii=0;ii<count;++ii ) |
3045 DrawItem( gc, ii, ENoHighlight); |
4018 { |
3046 } |
4019 if(!iExtension->iSctHighlighted && ii == iSelectedItem ) |
3047 |
4020 DrawItem( gc, ii, EDrawHighlight); |
3048 iExtension->iFullRedraw = EFalse; |
4021 else |
3049 } |
4022 DrawItem( gc, ii, ENoHighlight); |
|
4023 } |
|
4024 |
|
4025 iExtension->iFullRedraw = EFalse; |
|
4026 |
3050 |
4027 if ( iExtension->iSct ) |
3051 if ( iExtension->iSct ) |
4028 { |
3052 { |
4029 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
4030 if ( transApi ) |
|
4031 { |
|
4032 transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified ); |
|
4033 } |
|
4034 #endif |
|
4035 gc.CancelClippingRegion(); |
3053 gc.CancelClippingRegion(); |
4036 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3054 } |
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 |
|
4051 } |
3055 } |
4052 |
3056 |
4053 |
3057 |
4054 // ----------------------------------------------------------------------------- |
3058 // ----------------------------------------------------------------------------- |
4055 // CEikMenuPane::ReportSelectionMadeL |
3059 // CEikMenuPane::ReportSelectionMadeL |
4368 TInt newHighlight = iSelectedItem; |
3351 TInt newHighlight = iSelectedItem; |
4369 TBool loopScrolling = ETrue; |
3352 TBool loopScrolling = ETrue; |
4370 TInt itemAfterLastItem = loopScrolling ? 0 : max; |
3353 TInt itemAfterLastItem = loopScrolling ? 0 : max; |
4371 TInt itemAfterFirstItem = loopScrolling ? max : 0; |
3354 TInt itemAfterFirstItem = loopScrolling ? max : 0; |
4372 |
3355 |
4373 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3356 // Scroll highlighted item so that it becomes visible, |
4374 CWindowGc& gc = iExtension->iGc ? *iExtension->iGc : SystemGc(); |
3357 // if it is not visible before (scrolling with scroll bar |
4375 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( &gc ); |
3358 // can cause highlighted item to go out of screen) |
4376 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
3359 TInt topItem = iScroller->TopItemIndex(); |
4377 |
3360 TInt bottomItem = topItem + NumberOfItemsThatFitInView(); |
4378 if(iExtension->iIsPenEnable) |
3361 |
4379 { |
3362 if ( iExtension->Offset() < 0 ) |
4380 _AKNTRACE( "[%s]", "iExtension->iIsPenEnable = TRUE" ); |
3363 { |
4381 // Scroll highlighted item so that it becomes visible, |
3364 // Extra bottom item when panning |
4382 // if it is not visible before (scrolling with scroll bar |
3365 bottomItem++; |
4383 // can cause highlighted item to go out of screen) |
3366 } |
4384 TInt topItem = iScroller->TopItemIndex(); |
3367 |
4385 TInt bottomItem = topItem + NumberOfItemsThatFitInView(); |
3368 if( bottomItem > NumberOfItemsInPane() ) |
4386 |
3369 { |
4387 if ( iExtension->Offset() < 0 ) |
3370 bottomItem = NumberOfItemsInPane(); |
4388 { |
3371 } |
4389 // Extra bottom item when panning |
3372 _AKNTRACE( "topItem = %d,bottomItem = %d", topItem,bottomItem ); |
4390 bottomItem++; |
3373 |
4391 } |
3374 if ( aType != EEventKeyDown && iSelectedItem != ENothingSelected && |
4392 |
3375 !(iExtension->iSctHighlighted && topItem == 0) && |
4393 if( bottomItem > NumberOfItemsInPane() ) |
3376 (iSelectedItem < topItem || iSelectedItem > bottomItem - 1) ) |
4394 { |
3377 { |
4395 bottomItem = NumberOfItemsInPane(); |
3378 _AKNTRACE( "[%s]", "ScrollToMakeItemVisible(iSelectedItem);" ); |
4396 } |
3379 ScrollToMakeItemVisible(iSelectedItem); |
4397 _AKNTRACE( "topItem = %d,bottomItem = %d", topItem,bottomItem ); |
3380 |
4398 |
3381 ActivateGc(); |
4399 if ( aType != EEventKeyDown && iSelectedItem != ENothingSelected && |
3382 CWindowGc& gc = SystemGc(); |
4400 !(iExtension->iSctHighlighted && topItem == 0) && |
3383 PrepareGcForDrawingItems( gc ); |
4401 (iSelectedItem < topItem || iSelectedItem > bottomItem - 1) ) |
3384 |
4402 { |
3385 // draw all items that are needed. |
4403 _AKNTRACE( "[%s]", "ScrollToMakeItemVisible(iSelectedItem);" ); |
3386 for( TInt i = 0; i < count; i++ ) |
4404 ScrollToMakeItemVisible(iSelectedItem); |
3387 { |
4405 |
3388 if( i == iSelectedItem && !iExtension->iSctHighlighted) |
4406 ActivateGc(); |
3389 { |
4407 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3390 DrawItem( gc, i, EDrawHighlight ); |
4408 if ( transApi ) |
|
4409 { |
|
4410 iExtension->iGc->Activate( *DrawableWindow() ); |
|
4411 } |
3391 } |
4412 #else |
3392 else |
4413 CWindowGc& gc = SystemGc(); |
3393 { |
4414 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
3394 DrawItem( gc, i, ERemoveHighlight ); |
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 } |
|
4428 } |
3395 } |
4429 |
3396 } |
4430 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3397 |
4431 if ( transApi ) |
3398 DeactivateGc(); |
4432 { |
3399 _AKNTRACE( "[%s]", "OfferKeyEventL return 9" ); |
4433 iExtension->iGc->Deactivate(); |
3400 _AKNTRACE_FUNC_EXIT; |
4434 } |
3401 return EKeyWasConsumed; |
4435 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
4436 DeactivateGc(); |
|
4437 _AKNTRACE( "[%s]", "OfferKeyEventL return 9" ); |
|
4438 _AKNTRACE_FUNC_EXIT; |
|
4439 return EKeyWasConsumed; |
|
4440 } |
|
4441 } |
3402 } |
4442 |
3403 |
4443 if ( iSelectedItem != ENothingSelected || iExtension->iSctHighlighted ) |
3404 if ( iSelectedItem != ENothingSelected || iExtension->iSctHighlighted ) |
4444 { |
3405 { |
4445 switch ( code ) |
3406 switch ( code ) |
4693 return; |
3640 return; |
4694 } |
3641 } |
4695 |
3642 |
4696 TInt count( NumberOfItemsInPane() ); |
3643 TInt count( NumberOfItemsInPane() ); |
4697 |
3644 |
4698 if ( iExtension->iIsPenEnable ) |
3645 // Scroll highlighted item so that it becomes visible |
4699 { |
3646 // if it is not visible before (scrolling with scroll bar |
4700 // Scroll highlighted item so that it becomes visible |
3647 // can cause highlighted item to go out of screen). |
4701 // if it is not visible before (scrolling with scroll bar |
3648 TInt topItem( iScroller->TopItemIndex() ); |
4702 // can cause highlighted item to go out of screen). |
3649 TInt bottomItem( topItem + NumberOfItemsThatFitInView() ); |
4703 TInt topItem( iScroller->TopItemIndex() ); |
3650 if ( bottomItem > count ) |
4704 TInt bottomItem( topItem + NumberOfItemsThatFitInView() ); |
3651 { |
4705 if ( bottomItem > count ) |
3652 bottomItem = count; |
4706 { |
3653 } |
4707 bottomItem = count; |
3654 |
4708 } |
3655 if ( iExtension->Offset() < 0 && |
4709 |
3656 ( iSelectedItem == topItem || iSelectedItem == bottomItem ) ) |
4710 if ( iExtension->Offset() < 0 && |
3657 { |
4711 ( iSelectedItem == topItem || iSelectedItem == bottomItem ) ) |
3658 // Restoring offset with "simulated" ok key event. |
4712 { |
3659 iExtension->RestoreOffset( EKeyOK ); |
4713 // Restoring offset with "simulated" ok key event. |
3660 } |
4714 iExtension->RestoreOffset( EKeyOK ); |
3661 else if ( iSelectedItem < topItem || |
4715 } |
3662 iSelectedItem > bottomItem - 1 ) |
4716 else if ( iSelectedItem < topItem || |
3663 { |
4717 iSelectedItem > bottomItem - 1 ) |
3664 if ( count > iSelectedItem ) |
4718 { |
3665 { |
4719 if ( count > iSelectedItem ) |
3666 if ( iExtension->iSctHighlighted && iExtension->iSct ) |
4720 { |
3667 { |
4721 if ( iExtension->iSctHighlighted && iExtension->iSct ) |
3668 TKeyEvent key; |
|
3669 key.iCode = EKeyOK; |
|
3670 key.iModifiers = 0; |
|
3671 |
|
3672 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
|
3673 TEventCode type( EEventNull ); |
|
3674 keyResponse = iExtension->iSct->OfferKeyEventL( key, |
|
3675 type ); |
|
3676 if ( keyResponse == EKeyWasConsumed ) |
4722 { |
3677 { |
4723 TKeyEvent key; |
3678 ReportSelectionMadeL(); |
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; |
|
4738 } |
3679 } |
|
3680 _AKNTRACE( "[%s]" "ActivateCurrentItemL return 2" ); |
|
3681 _AKNTRACE_FUNC_EXIT; |
|
3682 return; |
4739 } |
3683 } |
4740 |
3684 } |
4741 iExtension->isUpdateScrollDirectly = ETrue; |
3685 |
4742 ScrollToMakeItemVisible( iSelectedItem ); |
3686 iExtension->isUpdateScrollDirectly = ETrue; |
4743 iExtension->isUpdateScrollDirectly = EFalse; |
3687 ScrollToMakeItemVisible( iSelectedItem ); |
4744 |
3688 iExtension->isUpdateScrollDirectly = EFalse; |
4745 ActivateGc(); |
3689 |
4746 |
3690 ActivateGc(); |
4747 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3691 CWindowGc& gc = SystemGc(); |
4748 |
3692 PrepareGcForDrawingItems( gc ); |
4749 MAknListBoxTfxInternal *transApi = |
3693 |
4750 CAknListLoader::TfxApiInternal( iExtension->iGc ); |
3694 // Draw all items that are needed. |
4751 if ( transApi ) |
3695 for ( TInt i = 0; i < count; i++ ) |
4752 { |
3696 { |
4753 iExtension->iGc->Activate( *DrawableWindow() ); |
3697 if ( i == iSelectedItem && !iExtension->iSctHighlighted ) |
|
3698 { |
|
3699 DrawItem( gc, i, EDrawHighlight ); |
4754 } |
3700 } |
4755 CWindowGc& gc = transApi ? *iExtension->iGc : SystemGc(); |
3701 else |
4756 |
3702 { |
4757 #else |
3703 DrawItem( gc, i, ERemoveHighlight ); |
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 } |
|
4776 } |
3704 } |
4777 |
3705 } |
4778 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3706 |
4779 |
3707 DeactivateGc(); |
4780 if ( transApi ) |
3708 _AKNTRACE( "[%s]" "ActivateCurrentItemL return 3" ); |
4781 { |
3709 _AKNTRACE_FUNC_EXIT; |
4782 iExtension->iGc->Deactivate(); |
3710 return; |
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 } |
|
4792 } |
3711 } |
4793 |
3712 |
4794 if ( iCascadeMenuPane ) |
3713 if ( iCascadeMenuPane ) |
4795 { |
3714 { |
4796 iCascadeMenuPane->ActivateCurrentItemL(); |
3715 iCascadeMenuPane->ActivateCurrentItemL(); |
5413 _AKNTRACE_FUNC_EXIT; |
4290 _AKNTRACE_FUNC_EXIT; |
5414 return iOwner->HandlePointerEventL( parentEvent ); |
4291 return iOwner->HandlePointerEventL( parentEvent ); |
5415 } |
4292 } |
5416 else |
4293 else |
5417 { |
4294 { |
5418 if ( iExtension->iIsPenEnable ) |
4295 // For finger usability, extend to the right. |
|
4296 TRect innerToRightRect; |
|
4297 if ( AknLayoutUtils::LayoutMirrored() ) |
5419 { |
4298 { |
5420 // For finger usability, extend to the right. |
4299 innerToRightRect = TRect( Rect().iTl, innerRect.iBr ); |
5421 TRect innerToRightRect; |
4300 } |
5422 if ( AknLayoutUtils::LayoutMirrored() ) |
4301 else |
|
4302 { |
|
4303 innerToRightRect = TRect( innerRect.iTl, Rect().iBr ); |
|
4304 } |
|
4305 // Keep opened |
|
4306 if ( innerToRightRect.Contains( aPointerEvent.iPosition ) ) |
|
4307 { |
|
4308 break; |
|
4309 } |
|
4310 |
|
4311 // clicked outside, then close menu case by case |
|
4312 if ( iCascadeMenuPane ) |
|
4313 { |
|
4314 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
5423 { |
4315 { |
5424 innerToRightRect = TRect( Rect().iTl, innerRect.iBr ); |
4316 iExtension->ImmediateFeedback( ETouchFeedbackDecreasingPopUp ); |
5425 } |
4317 } |
5426 else |
4318 else |
5427 { |
4319 { |
5428 innerToRightRect = TRect( innerRect.iTl, Rect().iBr ); |
4320 iExtension->ImmediateFeedback( ETouchFeedbackPopUp ); |
5429 } |
|
5430 // Keep opened |
|
5431 if ( innerToRightRect.Contains( aPointerEvent.iPosition ) ) |
|
5432 { |
|
5433 break; |
|
5434 } |
|
5435 } |
|
5436 // clicked outside, then close menu case by case |
|
5437 if ( iCascadeMenuPane ) |
|
5438 { |
|
5439 if( AknLayoutUtils::PenEnabled() ) |
|
5440 { |
|
5441 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
|
5442 { |
|
5443 iExtension->ImmediateFeedback( ETouchFeedbackDecreasingPopUp ); |
|
5444 } |
|
5445 else |
|
5446 { |
|
5447 iExtension->ImmediateFeedback( ETouchFeedbackPopUp ); |
|
5448 } |
|
5449 } |
4321 } |
5450 iExtension->iShowCascadeTransition = ETrue; |
4322 iExtension->iShowCascadeTransition = ETrue; |
5451 CloseCascadeMenu(); //Just close sub menu. |
4323 CloseCascadeMenu(); //Just close sub menu. |
5452 iExtension->EnableHighlight( EFalse ); |
4324 iExtension->EnableHighlight( EFalse ); |
5453 RepaintHighlight(); |
4325 RepaintHighlight(); |
6036 |
4874 |
6037 case EEikScrollPageDown: |
4875 case EEikScrollPageDown: |
6038 { |
4876 { |
6039 _AKNTRACE( "[%s]", "EEikScrollPageDown"); |
4877 _AKNTRACE( "[%s]", "EEikScrollPageDown"); |
6040 _AKNTRACE( "bottomItem = %d", bottomItem); |
4878 _AKNTRACE( "bottomItem = %d", bottomItem); |
6041 // if last item is not visible |
4879 update = ETrue; |
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); |
|
6052 _AKNTRACE( "update = %d", update); |
4880 _AKNTRACE( "update = %d", update); |
6053 } |
4881 } |
6054 break; |
4882 break; |
6055 |
4883 |
6056 case EEikScrollThumbDragVert: |
4884 case EEikScrollThumbDragVert: |
6057 { |
4885 { |
6058 _AKNTRACE( "[%s]", "EEikScrollThumbDragVert"); |
4886 _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 |
|
6072 // new thumb position |
4887 // new thumb position |
6073 TInt thumb = aScrollBar->ThumbPosition(); |
4888 TInt thumb = aScrollBar->ThumbPosition(); |
6074 _AKNTRACE( "thumb = %d", thumb); |
4889 _AKNTRACE( "thumb = %d", thumb); |
6075 |
4890 update = ETrue; |
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); |
|
6086 _AKNTRACE( "update = %d", update); |
4891 _AKNTRACE( "update = %d", update); |
6087 } |
4892 } |
6088 break; |
4893 break; |
6089 |
4894 |
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 |
|
6103 default: |
4895 default: |
6104 update = EFalse; |
4896 update = EFalse; |
6105 break; |
4897 break; |
6106 } |
4898 } |
6107 |
4899 |
6108 |
4900 // if topItem changed, then draw menu again. |
6109 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
4901 if ( newTopItem != topItem || update ) |
6110 if ( effects ) |
4902 { |
6111 { |
4903 iExtension->iListTopIndex = aScrollBar->ThumbPosition(); |
6112 transApi->SetMoveType( newTopItem > topItem ? |
4904 TPoint newPosition( iExtension->iViewPosition.iX, |
6113 MAknListBoxTfxInternal::EListScrollDown : |
4905 iExtension->iListTopIndex + iExtension->iViewHeight / 2 ); |
6114 MAknListBoxTfxInternal::EListScrollUp ); |
|
6115 } |
|
6116 #endif |
|
6117 |
|
6118 |
4906 |
6119 iExtension->iListTopIndex = aScrollBar->ThumbPosition(); |
4907 iExtension->iFlags.Set( CEikMenuPaneExtension::ESkipScrollbarUpdate ); |
6120 |
4908 iExtension->ViewPositionChanged( newPosition ); |
6121 iExtension->iViewPosition.iY = |
4909 iExtension->iFlags.Clear( CEikMenuPaneExtension::ESkipScrollbarUpdate ); |
6122 iExtension->iListTopIndex + iExtension->iViewHeight / 2; |
4910 } |
6123 |
|
6124 iExtension->ViewPositionChanged( iExtension->iViewPosition ); |
|
6125 |
|
6126 } |
4911 } |
6127 _AKNTRACE_FUNC_EXIT; |
4912 _AKNTRACE_FUNC_EXIT; |
6128 } |
4913 } |
|
4914 |
6129 |
4915 |
6130 // ----------------------------------------------------------------------------- |
4916 // ----------------------------------------------------------------------------- |
6131 // CEikMenuPane::CreateScrollBarFrame |
4917 // CEikMenuPane::CreateScrollBarFrame |
6132 // ----------------------------------------------------------------------------- |
4918 // ----------------------------------------------------------------------------- |
6133 // |
4919 // |
6216 TEikScrollBarFrameLayout layout; |
4994 TEikScrollBarFrameLayout layout; |
6217 layout.SetClientMargin( 0 ); |
4995 layout.SetClientMargin( 0 ); |
6218 layout.SetInclusiveMargin( 0 ); |
4996 layout.SetInclusiveMargin( 0 ); |
6219 layout.iTilingMode = TEikScrollBarFrameLayout::EClientRectConstant; |
4997 layout.iTilingMode = TEikScrollBarFrameLayout::EClientRectConstant; |
6220 |
4998 |
6221 // For main menupane scrollbar is always shown, for submenu only when needed |
4999 CEikScrollBarFrame::TScrollBarVisibility visibility = |
6222 if ( !iOwner ) |
5000 iSBFrame->ScrollBarVisibility( CEikScrollBar::EVertical ); |
6223 { |
5001 |
6224 iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn ); |
5002 // scrollbar is shown only if needed |
6225 } |
5003 if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOn |
6226 else |
5004 && visibility == CEikScrollBarFrame::EOff ) |
6227 { |
5005 { |
6228 TInt maxItems = NumberOfItemsThatFitInView(); |
5006 iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
6229 TInt count = iItemArray->Count(); |
5007 CEikScrollBarFrame::EOn ); |
6230 iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
5008 iExtension->iScrollBarRect = iSBFrame->VerticalScrollBar()->Rect(); |
6231 (count > maxItems) ? CEikScrollBarFrame::EOn : CEikScrollBarFrame::EOff ); |
5009 } |
6232 } |
5010 else if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOff |
6233 |
5011 && visibility == CEikScrollBarFrame::EOn ) |
|
5012 { |
|
5013 iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
|
5014 CEikScrollBarFrame::EOff ); |
|
5015 iExtension->iScrollBarRect = TRect::EUninitialized; |
|
5016 } |
|
5017 |
6234 TAknLayoutRect scrollLayoutRect; |
5018 TAknLayoutRect scrollLayoutRect; |
6235 if ( !iOwner ) |
5019 scrollLayoutRect.LayoutRect( clientRect, |
6236 { |
5020 AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
6237 TAknWindowLineLayout listScrollPaneLayout( |
5021 scrollBarInclusiveRect = scrollLayoutRect.Rect(); |
6238 AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() ); |
5022 scrollBarClientRect = scrollBarInclusiveRect; |
6239 if ( iExtension ) |
5023 |
6240 { |
5024 AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, scrollBarClientRect, |
6241 iExtension->AdjustPopupLayoutData( listScrollPaneLayout ); |
5025 AknLayoutScalable_Avkon::scroll_pane_cp4().LayoutLine()); |
6242 } |
|
6243 scrollLayoutRect.LayoutRect( clientRect, listScrollPaneLayout ); |
|
6244 scrollBarInclusiveRect = scrollLayoutRect.Rect(); |
|
6245 scrollBarClientRect = scrollBarInclusiveRect; |
|
6246 |
|
6247 AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, scrollBarClientRect, |
|
6248 AknLayoutScalable_Avkon::scroll_pane_cp25(0).LayoutLine() ); |
|
6249 } |
|
6250 else |
|
6251 { |
|
6252 scrollLayoutRect.LayoutRect( clientRect, |
|
6253 AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
|
6254 scrollBarInclusiveRect = scrollLayoutRect.Rect(); |
|
6255 scrollBarClientRect = scrollBarInclusiveRect; |
|
6256 |
|
6257 AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, scrollBarClientRect, |
|
6258 AknLayoutScalable_Avkon::scroll_pane_cp4().LayoutLine()); |
|
6259 } |
|
6260 |
5026 |
6261 iSBFrame->TileL( &hDsSbarModel, &vDsSbarModel, scrollBarClientRect, scrollBarInclusiveRect, layout ); |
5027 iSBFrame->TileL( &hDsSbarModel, &vDsSbarModel, scrollBarClientRect, scrollBarInclusiveRect, layout ); |
6262 iSBFrame->SetVFocusPosToThumbPos( vDsSbarModel.FocusPosition() ); |
5028 iSBFrame->SetVFocusPosToThumbPos( vDsSbarModel.FocusPosition() ); |
6263 |
|
6264 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
6265 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iExtension->iGc ); |
|
6266 if ( iSBFrame->VerticalScrollBar() && |
|
6267 iSBFrame->VScrollBarVisibility() == CEikScrollBarFrame::EOn ) |
|
6268 { |
|
6269 iExtension->iScrollBarRect = iSBFrame->VerticalScrollBar()->Rect(); |
|
6270 } |
|
6271 else |
|
6272 { |
|
6273 iExtension->iScrollBarRect = TRect::EUninitialized; |
|
6274 } |
|
6275 if ( transApi ) |
|
6276 { |
|
6277 transApi->ResetNonDrawingRects(); |
|
6278 transApi->AddNonDrawingRect( iExtension->iScrollBarRect ); |
|
6279 transApi->AddNonDrawingRect( iExtension->iSctRect ); |
|
6280 } |
|
6281 #endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
6282 if ( iSBFrame->VerticalScrollBar() && |
|
6283 iSBFrame->VScrollBarVisibility() == CEikScrollBarFrame::EOn ) |
|
6284 { |
|
6285 iExtension->iSBRect = iSBFrame->VerticalScrollBar()->Rect(); |
|
6286 } |
|
6287 else |
|
6288 { |
|
6289 iExtension->iSBRect = TRect::EUninitialized; |
|
6290 } |
|
6291 _AKNTRACE_FUNC_EXIT; |
5029 _AKNTRACE_FUNC_EXIT; |
6292 } |
5030 } |
6293 |
5031 |
|
5032 |
6294 // ----------------------------------------------------------------------------- |
5033 // ----------------------------------------------------------------------------- |
6295 // CEikMenuPane::UpdateScrollBarThumbs |
5034 // CEikMenuPane::UpdateScrollBarThumbs |
6296 // ----------------------------------------------------------------------------- |
5035 // ----------------------------------------------------------------------------- |
6297 // |
5036 // |
6298 void CEikMenuPane::UpdateScrollBarThumbs() |
5037 void CEikMenuPane::UpdateScrollBarThumbs() |
7061 |
5784 |
7062 // CEikMenuPane rect contains empty space. We want the popup content |
5785 // CEikMenuPane rect contains empty space. We want the popup content |
7063 // to be in correct place - so we calculate correct position for |
5786 // to be in correct place - so we calculate correct position for |
7064 // background and move control rect to match new background top left |
5787 // background and move control rect to match new background top left |
7065 // position. |
5788 // position. |
7066 TRect backgroundRect( iExtension->GetBackgroundRect( parentMenuRect ) ); |
|
7067 TPoint backgroundRectPos( |
5789 TPoint backgroundRectPos( |
7068 AknPopupUtils::Position( backgroundRect.Size(), ETrue ) ); |
5790 AknPopupUtils::Position( parentMenuRect.Size(), ETrue ) ); |
7069 |
5791 |
7070 retVal = parentMenuRect; |
5792 retVal = parentMenuRect; |
7071 retVal.Move( backgroundRectPos - backgroundRect.iTl ); |
5793 retVal.Move( backgroundRectPos - parentMenuRect.iTl ); |
7072 |
5794 |
7073 // Set embedded cba rect |
5795 // Set embedded cba rect |
7074 if ( iExtension->iCba ) |
5796 if ( iExtension->iCba ) |
7075 { |
5797 { |
7076 // There is hidden extra touch space for scroll bar in landscape |
5798 // There is hidden extra touch space for scroll bar in landscape |
7077 TInt xOffset = backgroundRect.iTl.iX - parentMenuRect.iTl.iX ; |
5799 TInt xOffset = parentMenuRect.iTl.iX - parentMenuRect.iTl.iX ; |
7078 iExtension->iCba->SetRect( TRect( |
5800 iExtension->iCba->SetRect( TRect( |
7079 xOffset, |
5801 xOffset, |
7080 menuRect.Height(), |
5802 menuRect.Height(), |
7081 backgroundRect.Width() + xOffset, |
5803 parentMenuRect.Width() + xOffset, |
7082 menuRect.Height() + cbaRect.Rect().Height() ) ); |
5804 menuRect.Height() + cbaRect.Rect().Height() ) ); |
7083 } |
5805 } |
7084 |
5806 |
7085 iExtension->iMenuPaneRect = TRect( retVal.iTl, |
5807 iExtension->iMenuPaneRect = TRect( retVal.iTl, |
7086 TSize ( menuRect.Size() ) ); |
5808 TSize ( menuRect.Size() ) ); |
7087 |
5809 |
|
5810 TInt variety = 4; |
|
5811 |
|
5812 // reserve area for scrollbar only if it's shown |
|
5813 if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOn ) |
|
5814 { |
|
5815 variety = 0; |
|
5816 } |
|
5817 |
|
5818 TAknLayoutRect layoutRect; |
|
5819 layoutRect.LayoutRect( TRect( iExtension->iMenuPaneRect.Size() ), |
|
5820 AknLayoutScalable_Avkon::listscroll_popup_sub_pane( 0 ) ); |
|
5821 |
|
5822 iExtension->iMenuAreaRect = layoutRect.Rect(); |
|
5823 |
|
5824 layoutRect.LayoutRect( iExtension->iMenuAreaRect, |
|
5825 AknLayoutScalable_Avkon::list_menu_pane( variety ) ); |
|
5826 |
|
5827 iExtension->iItemAreaRect = layoutRect.Rect(); |
|
5828 |
7088 _AKNTRACE( "[%s]", "the layout of main menu return" ); |
5829 _AKNTRACE( "[%s]", "the layout of main menu return" ); |
7089 _AKNTRACE_FUNC_EXIT; |
5830 _AKNTRACE_FUNC_EXIT; |
7090 return retVal; |
5831 return retVal; |
7091 } |
5832 } |
7092 |
5833 |
7131 textWidth = font->TextWidthInPixels( item->iData.iText ); |
5865 textWidth = font->TextWidthInPixels( item->iData.iText ); |
7132 maxTextWidth = Max( maxTextWidth, textWidth ); |
5866 maxTextWidth = Max( maxTextWidth, textWidth ); |
7133 } |
5867 } |
7134 |
5868 |
7135 // find the suitable item width, so that the text would be visible |
5869 // find the suitable item width, so that the text would be visible |
|
5870 TInt submenuVariety = 1; |
|
5871 |
|
5872 if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOn ) |
|
5873 { |
|
5874 submenuVariety = 0; |
|
5875 } |
|
5876 |
7136 for ( ii = 6; ii < KAlternativeSubmenuWidths + 6; ++ii ) |
5877 for ( ii = 6; ii < KAlternativeSubmenuWidths + 6; ++ii ) |
7137 { |
5878 { |
7138 TAknWindowLineLayout submenuLayout( AknLayoutScalable_Avkon::popup_submenu_window( ii ).LayoutLine() ); |
5879 TAknWindowLineLayout submenuLayout( AknLayoutScalable_Avkon::popup_submenu_window( ii ).LayoutLine() ); |
7139 TAknLayoutRect submenuRect; |
5880 TAknLayoutRect submenuRect; |
7140 submenuRect.LayoutRect( parentListScrollLayoutRect.Rect(), submenuLayout ); |
5881 submenuRect.LayoutRect( parentListScrollLayoutRect.Rect(), submenuLayout ); |
7141 |
5882 |
7142 TAknWindowLineLayout listScrollPaneLayout( AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
5883 TAknWindowLineLayout listScrollPaneLayout( AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
7143 TAknLayoutRect listScrollPaneRect; |
5884 TAknLayoutRect listScrollPaneRect; |
7144 listScrollPaneRect.LayoutRect( submenuRect.Rect(), listScrollPaneLayout ); |
5885 listScrollPaneRect.LayoutRect( submenuRect.Rect(), listScrollPaneLayout ); |
7145 |
5886 |
7146 TAknWindowLineLayout listSubmenuPaneLayout( AknLayoutScalable_Avkon::list_submenu_pane( !hasDoubleSpanScrollBar ).LayoutLine() ); |
5887 TAknWindowLineLayout listSubmenuPaneLayout( AknLayoutScalable_Avkon::list_submenu_pane( submenuVariety ).LayoutLine() ); |
7147 TAknLayoutRect listSubmenuPaneRect; |
5888 TAknLayoutRect listSubmenuPaneRect; |
7148 listSubmenuPaneRect.LayoutRect( listScrollPaneRect.Rect(), listSubmenuPaneLayout ); |
5889 listSubmenuPaneRect.LayoutRect( listScrollPaneRect.Rect(), listSubmenuPaneLayout ); |
7149 |
5890 |
7150 TAknLayoutText textIconLayout; |
5891 TAknLayoutText textIconLayout; |
7151 textIconLayout.LayoutText( listSubmenuPaneRect.Rect(), subMenuIconText); |
5892 textIconLayout.LayoutText( listSubmenuPaneRect.Rect(), subMenuIconText); |
7326 // TopItemIndex. Which results in negative index. This "fix" prevents from |
6074 // TopItemIndex. Which results in negative index. This "fix" prevents from |
7327 // crashing the menu. |
6075 // crashing the menu. |
7328 if( index < 0 ) |
6076 if( index < 0 ) |
7329 index = 0; |
6077 index = 0; |
7330 |
6078 |
7331 // It is possible that this method is called when iItemArray is NULL. In |
|
7332 // that case we fake numItems as 1 to make layout code work. |
|
7333 TInt maxItems = NumberOfItemsThatFitInView(); |
|
7334 TInt numItems = Min( Max( 1, iItemArray->Count() ), maxItems ); |
|
7335 if( !iItemArray ) |
|
7336 numItems = 1; |
|
7337 |
|
7338 // When physics is enabled highlight can be moved to partially visible |
6079 // When physics is enabled highlight can be moved to partially visible |
7339 // item which is at the bottom of menu. This causes layout panic and to |
6080 // item which is at the bottom of menu. This causes layout panic and to |
7340 // avoid that we reduce index by one. |
6081 // avoid that we reduce index by one. |
7341 if ( index == maxItems ) |
6082 if ( index == NumberOfItemsThatFitInView() ) |
7342 { |
6083 { |
7343 index--; |
6084 index--; |
7344 } |
6085 } |
7345 |
6086 |
7346 TRect windowRect = Rect(); |
6087 return ItemRect( index ); |
7347 |
|
7348 TAknWindowLineLayout menuPane( AKN_LAYOUT_WINDOW_list_menu_pane( 0 , 0 ) ); |
|
7349 TAknWindowLineLayout singleMenuPane( AKN_LAYOUT_WINDOW_list_single_popup_menu_pane( index ) ); |
|
7350 TAknLayoutRect menuPaneRect; |
|
7351 TAknLayoutRect singleMenuPaneRect; |
|
7352 |
|
7353 TBool hasDoubleSpanScrollBar = EFalse; |
|
7354 |
|
7355 if ( iSBFrame && iSBFrame->VScrollBarVisibility() ) |
|
7356 { |
|
7357 hasDoubleSpanScrollBar = ETrue; |
|
7358 } |
|
7359 |
|
7360 if ( !iOwner ) |
|
7361 { |
|
7362 TAknWindowLineLayout listScrollPaneLayout( |
|
7363 AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() ); |
|
7364 if ( iExtension ) |
|
7365 { |
|
7366 iExtension->AdjustPopupLayoutData( listScrollPaneLayout ); |
|
7367 } |
|
7368 TAknLayoutRect listScrollPaneRect; |
|
7369 listScrollPaneRect.LayoutRect( windowRect, listScrollPaneLayout ); |
|
7370 |
|
7371 menuPane = AknLayoutScalable_Avkon::list_menu_pane( 0 ).LayoutLine(); |
|
7372 menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), menuPane ); |
|
7373 |
|
7374 singleMenuPane = AknLayoutScalable_Avkon::list_single_pane_cp2( index ).LayoutLine(); |
|
7375 singleMenuPaneRect.LayoutRect( menuPaneRect.Rect(), singleMenuPane ); |
|
7376 } |
|
7377 else // Submenu |
|
7378 { |
|
7379 TAknWindowLineLayout listScrollPaneLayout( AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() ); |
|
7380 TAknLayoutRect listScrollPaneRect; |
|
7381 listScrollPaneRect.LayoutRect( windowRect, listScrollPaneLayout ); |
|
7382 |
|
7383 menuPane = AknLayoutScalable_Avkon::list_submenu_pane( !hasDoubleSpanScrollBar ).LayoutLine(); |
|
7384 menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), menuPane ); |
|
7385 |
|
7386 singleMenuPane = AknLayoutScalable_Avkon::list_single_popup_submenu_pane( index ).LayoutLine(); |
|
7387 singleMenuPaneRect.LayoutRect( menuPaneRect.Rect(), singleMenuPane ); |
|
7388 } |
|
7389 |
|
7390 // Compared to normal DrawItem the highlight rect step is omitted because |
|
7391 // it would shift the highlight towards left. |
|
7392 |
|
7393 return singleMenuPaneRect.Rect(); |
|
7394 } |
6088 } |
7395 |
6089 |
7396 |
6090 |
7397 // ----------------------------------------------------------------------------- |
6091 // ----------------------------------------------------------------------------- |
7398 // CEikMenuPane::PrepareHighlightFrame |
6092 // CEikMenuPane::PrepareHighlightFrame |
7549 __ASSERT_ALWAYS( iExtension, Panic( EEikPanicNullPointer ) ); |
6240 __ASSERT_ALWAYS( iExtension, Panic( EEikPanicNullPointer ) ); |
7550 return iExtension; |
6241 return iExtension; |
7551 } |
6242 } |
7552 |
6243 |
7553 |
6244 |
|
6245 // ----------------------------------------------------------------------------- |
|
6246 // CEikMenuPane::CheckCreateExtensionL |
|
6247 // ----------------------------------------------------------------------------- |
|
6248 // |
7554 void CEikMenuPane::CheckCreateExtensionL() |
6249 void CEikMenuPane::CheckCreateExtensionL() |
7555 { |
6250 { |
7556 if ( !iExtension ) |
6251 if ( !iExtension ) |
7557 { |
6252 { |
7558 iExtension = new (ELeave) CEikMenuPaneExtension; |
6253 iExtension = new (ELeave) CEikMenuPaneExtension; |
7559 iExtension->ConstructL( this ); |
6254 iExtension->ConstructL( this ); |
7560 } |
6255 } |
|
6256 } |
|
6257 |
|
6258 |
|
6259 // ----------------------------------------------------------------------------- |
|
6260 // CEikMenuPane::ItemRect |
|
6261 // ----------------------------------------------------------------------------- |
|
6262 // |
|
6263 TRect CEikMenuPane::ItemRect( TInt aItemIndex ) const |
|
6264 { |
|
6265 // this method is valid for the main menu only |
|
6266 TInt lastRow = AknLayoutScalable_Avkon::list_single_pane_cp2_ParamLimits().LastRow(); |
|
6267 aItemIndex = Min( aItemIndex, lastRow ); |
|
6268 |
|
6269 TAknLayoutRect layoutRect; |
|
6270 layoutRect.LayoutRect( iExtension->iItemAreaRect, |
|
6271 AknLayoutScalable_Avkon::list_single_pane_cp2( aItemIndex ) ); |
|
6272 |
|
6273 return layoutRect.Rect(); |
|
6274 } |
|
6275 |
|
6276 |
|
6277 // ----------------------------------------------------------------------------- |
|
6278 // CEikMenuPane::CalculateItemHeight |
|
6279 // ----------------------------------------------------------------------------- |
|
6280 // |
|
6281 TInt CEikMenuPane::CalculateItemHeight() const |
|
6282 { |
|
6283 TAknWindowLineLayout menuLineLayout; |
|
6284 |
|
6285 if ( iOwner ) // submenu |
|
6286 { |
|
6287 menuLineLayout = |
|
6288 AknLayoutScalable_Avkon::list_single_popup_submenu_pane( 0 ).LayoutLine(); |
|
6289 } |
|
6290 else |
|
6291 { |
|
6292 menuLineLayout = |
|
6293 AknLayoutScalable_Avkon::list_single_pane_cp2( 0 ).LayoutLine(); |
|
6294 } |
|
6295 |
|
6296 TAknLayoutRect menuLayoutRect; |
|
6297 menuLayoutRect.LayoutRect( Rect(), menuLineLayout ); |
|
6298 |
|
6299 return menuLayoutRect.Rect().Height(); |
7561 } |
6300 } |
7562 |
6301 |
7563 |
6302 |
7564 // ----------------------------------------------------------------------------- |
6303 // ----------------------------------------------------------------------------- |
7565 // CEikMenuPane::ConstructMenuSctRowL |
6304 // CEikMenuPane::ConstructMenuSctRowL |
7707 |
6446 |
7708 //iExtension->StartCascadeMenuDisappearTransition(); |
6447 //iExtension->StartCascadeMenuDisappearTransition(); |
7709 if ( iCascadeMenuPane->IsVisible() ) |
6448 if ( iCascadeMenuPane->IsVisible() ) |
7710 { |
6449 { |
7711 okToDraw = AknsUtils::SkinInstance() != NULL; |
6450 okToDraw = AknsUtils::SkinInstance() != NULL; |
7712 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
7713 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iExtension->iGc ); |
|
7714 if ( transApi && okToDraw ) |
|
7715 { |
|
7716 iCascadeMenuPane->SetFocus( EFalse, EDrawNow ); |
|
7717 } |
|
7718 #endif |
|
7719 // Stop ongoing comp. transitions, this is mostly for fast clicking |
6451 // Stop ongoing comp. transitions, this is mostly for fast clicking |
7720 // cases to make sure that no "scrap" is left behind. |
6452 // cases to make sure that no "scrap" is left behind. |
7721 GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort ); |
6453 GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort ); |
|
6454 |
7722 // cascade menu "cancel" animation. This does not apply |
6455 // cascade menu "cancel" animation. This does not apply |
7723 // when something is chosen from the menu |
6456 // when something is chosen from the menu |
7724 |
6457 if ( iExtension->iShowCascadeTransition && okToDraw ) |
7725 if( iExtension->iShowCascadeTransition && okToDraw ) |
6458 { |
7726 { |
6459 iCascadeMenuPane->SetParent( this ); |
7727 iCascadeMenuPane->SetParent( this ); |
6460 |
7728 |
6461 GfxTransEffect::Begin( iCascadeMenuPane, KGfxControlDisappearAction ); |
7729 GfxTransEffect::Begin( iCascadeMenuPane, KGfxControlDisappearAction ); |
6462 GfxTransEffect::SetDemarcation( iCascadeMenuPane, iExtension->iCascadeDRect ); |
7730 GfxTransEffect::SetDemarcation( iCascadeMenuPane, iExtension->iCascadeDRect ); |
6463 iCascadeMenuPane->MakeVisible( EFalse ); |
7731 |
6464 GfxTransEffect::End( iCascadeMenuPane ); |
7732 iCascadeMenuPane->MakeVisible( EFalse ); |
|
7733 |
|
7734 GfxTransEffect::End( iCascadeMenuPane ); |
|
7735 |
|
7736 } |
6465 } |
7737 } |
6466 } |
7738 |
6467 |
7739 // deregister right away since cascade menu is deleted |
6468 // deregister right away since cascade menu is deleted |
7740 GfxTransEffect::Deregister( iCascadeMenuPane ); |
6469 GfxTransEffect::Deregister( iCascadeMenuPane ); |