uifw/EikStd/coctlsrc/EIKMENUP.CPP
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
child 72 a5e7a4f63858
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
     1 /*
     1 /*
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    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>
   113  * CEikmenuPane is responsible for data members of this class.
   103  * CEikmenuPane is responsible for data members of this class.
   114  *
   104  *
   115  * Extension now contains menu/submenu highlight animation functionality.
   105  * Extension now contains menu/submenu highlight animation functionality.
   116  */
   106  */
   117 NONSHARABLE_CLASS( CEikMenuPaneExtension ):
   107 NONSHARABLE_CLASS( CEikMenuPaneExtension ):
   118     public CActive,
   108     public CBase,
   119     public MCoeForegroundObserver,
       
   120     public MAknsEffectAnimObserver,
       
   121     public MCoeControlObserver,
   109     public MCoeControlObserver,
   122     public MAknPhysicsObserver    
   110     public MAknPhysicsObserver    
   123     {
   111     {
   124 public:
   112 public:
   125     enum TFlag
       
   126         {
       
   127         /**
       
   128         * If set, animation creation is attempted. If not set, animation will
       
   129         * never be created.
       
   130         */
       
   131         EFlagUseAnimation = 0
       
   132         };
       
   133         
       
   134     enum TScreen
       
   135         {
       
   136         EQhdHeight = 360,
       
   137         EQhdWidth = 640        
       
   138         };        
       
   139 
       
   140     CEikMenuPaneExtension();
   113     CEikMenuPaneExtension();
   141     ~CEikMenuPaneExtension();
   114     ~CEikMenuPaneExtension();
   142 
   115 
   143     void ConstructL( CEikMenuPane* aControl );
   116     void ConstructL( CEikMenuPane* aControl );
   144     void CreateAnimation();
       
   145     void NoAnimIfError( TInt aError );
       
   146     void UseNoAnimation();
       
   147     void FocusGained();
       
   148     void FocusLost();
       
   149 
       
   150     void HandleLayoutSwitch();
       
   151     void ChangeHighlightBackground();
       
   152     void MenuClosed();
   117     void MenuClosed();
   153 
   118 
   154     void ConstructMenuSctRowL( TDes& aSpecialChars, TInt aResourceId );
   119     void ConstructMenuSctRowL( TDes& aSpecialChars, TInt aResourceId );
   155     void ConstructMenuSctRowFromDialogL( TDes& aSpecialChars, TInt aResourceId );
   120     void ConstructMenuSctRowFromDialogL( TDes& aSpecialChars, TInt aResourceId );
   156     
   121     
   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 
   142 
   200 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
   201     void CalcItemSize( MAknListBoxTfxInternal* transApi ) const;
       
   202 #endif
       
   203 
       
   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 PrepareCascadeForItemCommandsL();
   208 
   147 
   209     /**
   148     /**
   210      * Returns ETrue if this menu pane belongs to a CS menu.
   149      * Returns ETrue if this menu pane belongs to a CS menu.
   211      * 
   150      * 
   212      * @return ETrue if this menu pane belongs to a CS menu.
   151      * @return ETrue if this menu pane belongs to a CS menu.
   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 
   313     enum TCEikMenuPaneExtensionFlags
   234     enum TCEikMenuPaneExtensionFlags
   314         {
   235         {
   315         ESingleClickEnabled,
   236         ESingleClickEnabled,
   316         EHideItemSpecificCommands,
   237         EHideItemSpecificCommands,
   317         EContextSensitive,
   238         EContextSensitive,
   318         EHighlightEnabled
   239         ESkipScrollbarUpdate,
       
   240         EHighlightEnabled,
       
   241         EHideViewSpecificCommands, 
       
   242         EHideMarkAndUnmark,
       
   243         EHideItemActionCommands
   319         };
   244         };
   320 
   245 
   321     /**
   246     /**
   322      * Menu pane extension flags.
   247      * Menu pane extension flags.
   323      */
   248      */
   324     TBitFlags iFlags;
   249     TBitFlags iFlags;
       
   250     
       
   251     /**
       
   252      * Cached rectangle occupied by menu items (excluding scrollbar's area).
       
   253      */
       
   254     TRect iItemAreaRect;
       
   255     
       
   256     /**
       
   257      * Cached rectangle occupied by menu items and scrollbar.
       
   258      */
       
   259     TRect iMenuAreaRect;
       
   260     
       
   261     /**
       
   262      * Index of the item were highlight was previously drawn to.
       
   263      * Can be KErrNotFound.
       
   264      */
       
   265     TInt iHighlightedItem;
       
   266     
       
   267     /**
       
   268      * Scrollbar's desired visibility. This is calculated in conjunction with
       
   269      * menu pane's size and used later on when calculating scrollbar's layout.
       
   270      */
       
   271     CEikScrollBarFrame::TScrollBarVisibility iScrollbarVisibility;
   325 
   272 
   326 private: // Data
   273 private: // Data
   327     CPeriodic* iTimer; // timer to launch submenu, own
   274     CPeriodic* iTimer; // timer to launch submenu, own
   328     CPeriodic* iHighlightTimer; // Timer to adjust pressed down highlight
   275     CPeriodic* iHighlightTimer; // Timer to adjust pressed down highlight
   329     TInt iVerticalOffset; // Panning offset
   276     TInt iVerticalOffset; // Panning offset
   451     { return iTopItemIndex; }
   398     { return iTopItemIndex; }
   452 
   399 
   453 inline void CEikMenuPane::CMenuScroller::SetTopItemIndex(TInt aIndex)
   400 inline void CEikMenuPane::CMenuScroller::SetTopItemIndex(TInt aIndex)
   454     { 
   401     { 
   455     iTopItemIndex=aIndex;
   402     iTopItemIndex=aIndex;
   456 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
   457     if ( iMenuPane.iExtension )
       
   458         {
       
   459         iTopItemIndex = aIndex;
       
   460         }
       
   461 #endif
       
   462     }
   403     }
   463 
   404 
   464 inline CIdle* CEikMenuPane::CMenuScroller::Idle() const
   405 inline CIdle* CEikMenuPane::CMenuScroller::Idle() const
   465     { return iIdle; }
   406     { return iIdle; }
   466 
   407 
   472     iVerticalOffset = 0;
   413     iVerticalOffset = 0;
   473     iListTopIndex = 0;
   414     iListTopIndex = 0;
   474     iLastFeedbackTopItemIndex = 0;
   415     iLastFeedbackTopItemIndex = 0;
   475     iPressedDown = EFalse;
   416     iPressedDown = EFalse;
   476     iFlickActive = EFalse;
   417     iFlickActive = EFalse;
   477     
   418 
   478     TRect rect;
   419     TRect rect( iMenuPaneRect );
   479     if ( !iControl->iOwner )
       
   480         {
       
   481         rect = iMenuPaneRect;    
       
   482         }
       
   483     else
       
   484         {
       
   485         rect = iControl->Rect();    
       
   486         }    
       
   487     
   420     
   488     TInt itemHeight = iControl->iItemHeight;
   421     TInt itemHeight = iControl->iItemHeight;
   489     TInt itemsInRect = rect.Height() / itemHeight;
   422     TInt itemsInRect = rect.Height() / itemHeight;
   490     TInt totalItemHeight = iControl->TotalItemHeight();
   423     TInt totalItemHeight = iControl->TotalItemHeight();
   491 
   424 
   535 // ---------------------------------------------------------------------------
   468 // ---------------------------------------------------------------------------
   536 //
   469 //
   537 void CEikMenuPaneExtension::ViewPositionChanged( const TPoint& aNewPosition,
   470 void CEikMenuPaneExtension::ViewPositionChanged( const TPoint& aNewPosition,
   538                                                  TBool aDrawNow,
   471                                                  TBool aDrawNow,
   539                                                  TUint /*aFlags*/ )
   472                                                  TUint /*aFlags*/ )
   540     {  
   473     {
   541     _AKNTRACE_FUNC_ENTER;
   474     _AKNTRACE_FUNC_ENTER;
   542     if ( !iControl->iItemArray )
   475     TInt delta = iViewPosition.iY - aNewPosition.iY;
       
   476 
       
   477     if ( !iControl->iItemArray || delta == 0 )
   543         {
   478         {
   544         return;
   479         return;
   545         }
   480         }
   546     
   481 
   547     iListTopIndex = aNewPosition.iY - iViewHeight / 2;  
   482     iListTopIndex = aNewPosition.iY - iViewHeight / 2;  
   548     
       
   549     iListBottomIndex = aNewPosition.iY + iViewHeight - iViewHeight / 2;
   483     iListBottomIndex = aNewPosition.iY + iViewHeight - iViewHeight / 2;
   550     
       
   551     TInt delta = iViewPosition.iY - aNewPosition.iY;
       
   552     
   484     
   553     DoOffset( delta );
   485     DoOffset( delta );
   554 
   486 
   555     iViewPosition = aNewPosition; 
   487     iViewPosition = aNewPosition; 
   556     _AKNTRACE( "iListTopIndex = %d",  iListTopIndex );
   488     _AKNTRACE( "iListTopIndex = %d",  iListTopIndex );
   557     _AKNTRACE( "iListBottomIndex = %d",  iListBottomIndex );
   489     _AKNTRACE( "iListBottomIndex = %d",  iListBottomIndex );
   558     _AKNTRACE( "delta = %d",  delta );
   490     _AKNTRACE( "delta = %d",  delta );
   559     _AKNTRACE( "iViewPosition(%d,%d)",  iViewPosition.iX, iViewPosition.iY );
   491     _AKNTRACE( "iViewPosition(%d,%d)",  iViewPosition.iX, iViewPosition.iY );
   560     
   492     
       
   493     //here checking the delta whether it is changed.
       
   494     //if it is changed,the view must be drawn using the below code.
       
   495     if ( delta != 0 )
       
   496         {
       
   497         aDrawNow = ETrue;
       
   498     	}
   561     if ( aDrawNow )
   499     if ( aDrawNow )
   562         {
   500         {
   563         TRAP_IGNORE( iControl->DoUpdateScrollBarL() );
   501         if ( iFlags.IsClear( ESkipScrollbarUpdate ) )
   564 
   502             {
   565         if ( iControl->iOwner ) // Submenu
   503             TRAP_IGNORE( iControl->DoUpdateScrollBarL() );
   566             {
   504             }
   567             iControl->DrawNow();
   505 
   568             }
   506         // Redraw only item area if scrollbar is invisible, otherwise include 
   569         else
   507         // also scrollbar's area in order to avoid drawdeferred.
   570             {
   508         TRect drawRect( iItemAreaRect );
   571             iControl->DrawNow( TRect( iMenuPaneRect.Size() ) );
   509         
   572             }        
   510         if ( iScrollbarVisibility == CEikScrollBarFrame::EOn )
       
   511             {
       
   512             drawRect = iMenuAreaRect;
       
   513             }
       
   514 
       
   515         iControl->DrawNow( drawRect );
   573         }
   516         }
   574     _AKNTRACE_FUNC_EXIT;
   517     _AKNTRACE_FUNC_EXIT;
   575     }
   518     }
   576 
   519 
   577 
   520 
   628         // in case there's flicking or panning ongoing and not doing
   571         // in case there's flicking or panning ongoing and not doing
   629         // bounce action
   572         // bounce action
   630         if ( iFlickActive || iPanningActive )
   573         if ( iFlickActive || iPanningActive )
   631             {
   574             {
   632             if ( ( aOffset>0 && iListTopIndex <= listBottomLimit && iListTopIndex >= -iViewHeight ) ||
   575             if ( ( aOffset>0 && iListTopIndex <= listBottomLimit && iListTopIndex >= -iViewHeight ) ||
   633             	  ( aOffset<0 && iListBottomIndex >= 0 && iListBottomIndex <= listBottomLimit+iViewHeight ) ) 
   576                   ( aOffset<0 && iListBottomIndex >= 0 && iListBottomIndex <= listBottomLimit+iViewHeight ) ) 
   634             	{
   577                 {
   635             	if ( iPhysics )
   578                 if ( iPhysics )
   636                     {
   579                     {
   637                     TTouchFeedbackType feedbackType = ETouchFeedbackVibra;
   580                     switch(iPhysics->OngoingPhysicsAction())
   638                     switch( iPhysics->OngoingPhysicsAction() )
       
   639                         {
   581                         {
       
   582                         case CAknPhysics::EAknPhysicsActionBouncing:
   640                         case CAknPhysics::EAknPhysicsActionDragging:
   583                         case CAknPhysics::EAknPhysicsActionDragging:
   641                             {
       
   642                             feedbackType = static_cast<TTouchFeedbackType> ( ETouchFeedbackVibra | ETouchFeedbackAudio );
       
   643                             }
       
   644                         case CAknPhysics::EAknPhysicsActionFlicking:
   584                         case CAknPhysics::EAknPhysicsActionFlicking:
   645                         case CAknPhysics::EAknPhysicsActionBouncing:
   585                             ImmediateFeedback( ETouchFeedbackSensitiveList,
   646                             {
   586                                     ETouchFeedbackVibra );
   647                             ImmediateFeedback( ETouchFeedbackSensitiveItem,
       
   648                                                feedbackType );
       
   649                             break;
   587                             break;
   650                             }
       
   651                         default:
   588                         default:
   652                             break;
   589                             break;
   653                         }
   590                         }
   654                     }
   591                     }
   655             	}
   592             	}
   734 
   671 
   735 void CEikMenuPaneExtension::PhysicEmulationEnded()
   672 void CEikMenuPaneExtension::PhysicEmulationEnded()
   736     {
   673     {
   737     _AKNTRACE_FUNC_ENTER;    
   674     _AKNTRACE_FUNC_ENTER;    
   738     iFlickActive = EFalse; 
   675     iFlickActive = EFalse; 
   739 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
   740     MAknListBoxTfx* tfxApi = CAknListLoader::TfxApi( iGc );
       
   741 
       
   742     if ( tfxApi )
       
   743         {
       
   744         tfxApi->EnableEffects( ETrue );
       
   745         }
       
   746 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
   747     _AKNTRACE_FUNC_EXIT;
   676     _AKNTRACE_FUNC_EXIT;
   748     }    
   677     }    
   749     
   678     
   750 TPoint CEikMenuPaneExtension::ViewPosition() const
   679 TPoint CEikMenuPaneExtension::ViewPosition() const
   751     {
   680     {
   934 // High CActive priority is well argumented because running the active object
   863 // High CActive priority is well argumented because running the active object
   935 // will result in animation deletion -> results in freeing resources.
   864 // will result in animation deletion -> results in freeing resources.
   936 // -----------------------------------------------------------------------------
   865 // -----------------------------------------------------------------------------
   937 //
   866 //
   938 CEikMenuPaneExtension::CEikMenuPaneExtension() :
   867 CEikMenuPaneExtension::CEikMenuPaneExtension() :
   939     CActive( EPriorityHigh ),
       
   940     // Initialise data members to zero
   868     // Initialise data members to zero
   941     iCascadeBitmap( NULL ),
   869     iCascadeBitmap( NULL ),
   942     iCascadeBitmapMask( NULL ),
   870     iCascadeBitmapMask( NULL ),
   943     iBgContext( NULL ),
   871     iBgContext( NULL ),
   944     iSubMenuWidthIndex( 1 ),
   872     iSubMenuWidthIndex( 1 ),
   946     iCheckMarkBitmapMask( NULL ),
   874     iCheckMarkBitmapMask( NULL ),
   947     iRadioButtonBitmap( NULL ),
   875     iRadioButtonBitmap( NULL ),
   948     iRadioButtonBitmapMask( NULL ),
   876     iRadioButtonBitmapMask( NULL ),
   949     iHasRadioGroup( EFalse ),
   877     iHasRadioGroup( EFalse ),
   950     iSelectedRadioButtonItem( KNoSelectedRadioButtonItem ),
   878     iSelectedRadioButtonItem( KNoSelectedRadioButtonItem ),
   951     iGrabbingCBAComponent( NULL ),
       
   952     iControl( NULL ),
   879     iControl( NULL ),
   953     iAnimation( NULL ),
       
   954     iAnimFlags ( 0 ),
       
   955     iSct( NULL ),
   880     iSct( NULL ),
   956     iSctHighlighted( EFalse ),
   881     iSctHighlighted( EFalse ),
   957     iSpecialCharPointed( EFalse )
   882     iSpecialCharPointed( EFalse )
   958 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
   959     ,iGc ( NULL )
       
   960 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
   961     ,iVerticalOffset( 0 )
   883     ,iVerticalOffset( 0 )
   962     ,iPhysics( NULL )
   884     ,iPhysics( NULL )
   963     ,iListTopIndex( 0 )
   885     ,iListTopIndex( 0 )
   964     ,iViewHeight( 0 )
   886     ,iViewHeight( 0 )
   965     ,iFlickActive( EFalse )
   887     ,iFlickActive( EFalse )
   966     ,iPanningActive( EFalse )
   888     ,iPanningActive( EFalse )
   967     ,iFeedback( MTouchFeedback::Instance() )
   889     ,iFeedback( MTouchFeedback::Instance() )
   968     ,iLastFeedbackTopItemIndex( 0 )
   890     ,iLastFeedbackTopItemIndex( 0 )
   969     {
   891     {
   970     iIsPenEnable = AknLayoutUtils::PenEnabled();
   892     iItemsReadyForPenSelection = !AknLayoutUtils::PenEnabled();
   971     iItemsReadyForPenSelection = !iIsPenEnable;
       
   972     iNextHighlightItem = KErrNotFound;
   893     iNextHighlightItem = KErrNotFound;
       
   894     iHighlightedItem = KErrNotFound;
   973     }
   895     }
   974 
   896 
   975 // -----------------------------------------------------------------------------
   897 // -----------------------------------------------------------------------------
   976 // CEikMenuPaneExtension::~CEikMenuPaneExtension
   898 // CEikMenuPaneExtension::~CEikMenuPaneExtension
   977 // Destructor for extension class
   899 // Destructor for extension class
   978 // -----------------------------------------------------------------------------
   900 // -----------------------------------------------------------------------------
   979 //
   901 //
   980 CEikMenuPaneExtension::~CEikMenuPaneExtension()
   902 CEikMenuPaneExtension::~CEikMenuPaneExtension()
   981     {
   903     {
   982     _AKNTRACE_FUNC_ENTER;
   904     _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 
   905 
   995     delete iCascadeBitmap;
   906     delete iCascadeBitmap;
   996     iCascadeBitmap = NULL;
   907     iCascadeBitmap = NULL;
   997 
   908 
   998     delete iCascadeBitmapMask;
   909     delete iCascadeBitmapMask;
  1012 
   923 
  1013     delete iRadioButtonBitmapMask;
   924     delete iRadioButtonBitmapMask;
  1014     iRadioButtonBitmapMask = NULL;
   925     iRadioButtonBitmapMask = NULL;
  1015 
   926 
  1016     iControl = NULL;
   927     iControl = NULL;
  1017 
       
  1018     delete iAnimation;
       
  1019     iAnimation = NULL;
       
  1020 
   928 
  1021     delete iSct;
   929     delete iSct;
  1022     iSct = NULL;
   930     iSct = NULL;
  1023 
   931 
  1024     delete iCascadeMenuObject;
   932     delete iCascadeMenuObject;
  1051 //
   959 //
  1052 void CEikMenuPaneExtension::ConstructL( CEikMenuPane* aControl )
   960 void CEikMenuPaneExtension::ConstructL( CEikMenuPane* aControl )
  1053     {
   961     {
  1054     ASSERT( aControl );
   962     ASSERT( aControl );
  1055     iControl = aControl;
   963     iControl = aControl;
  1056     iAnimFlags.Set( EFlagUseAnimation ); // Animations are created by default
       
  1057     CActiveScheduler::Add( this );
       
  1058     iDraggedOutside = EFalse;
   964     iDraggedOutside = EFalse;
  1059     iLaunchCascadeMenu = EFalse;
   965     iLaunchCascadeMenu = EFalse;
  1060     iButtonDownItem = KErrNotFound;
   966     iButtonDownItem = KErrNotFound;
  1061     iTaskSwapIdle = CIdle::NewL( CActive::EPriorityHigh );
   967     iTaskSwapIdle = CIdle::NewL( CActive::EPriorityHigh );
  1062     if ( aControl->iOwner == NULL && GfxTransEffect::IsRegistered( aControl ) )
   968     if ( aControl->iOwner == NULL && GfxTransEffect::IsRegistered( aControl ) )
  1063         {
   969         {
  1064         // Delays submenu opening during appear transitions
   970         // Delays submenu opening during appear transitions
  1065         iRedirectionListener = new ( ELeave ) CRedirectionListener( *this );
   971         iRedirectionListener = new ( ELeave ) CRedirectionListener( *this );
  1066         }
   972         }
  1067 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  1068         iGc = CAknListLoader::CreateTfxGc( *aControl,
       
  1069                                            iControl->iScroller->iTopItemIndex,
       
  1070                                            iTotalNumberOfItemsInView );
       
  1071 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  1072     if ( static_cast<CAknAppUi*>(
   973     if ( static_cast<CAknAppUi*>(
  1073             iControl->ControlEnv()->AppUi() )->IsSingleClickCompatible() )
   974             iControl->ControlEnv()->AppUi() )->IsSingleClickCompatible() )
  1074         {
   975         {
  1075         iFlags.Set( ESingleClickEnabled );
   976         iFlags.Set( ESingleClickEnabled );
  1076         }
   977         }
  1082     
   983     
  1083     iBgContext = CAknsFrameBackgroundControlContext::NewL(
   984     iBgContext = CAknsFrameBackgroundControlContext::NewL(
  1084         KAknsIIDQsnFrPopup, TRect( 0, 0, 1, 1 ), TRect( 0, 0, 1, 1 ), EFalse );
   985         KAknsIIDQsnFrPopup, TRect( 0, 0, 1, 1 ), TRect( 0, 0, 1, 1 ), EFalse );
  1085     }
   986     }
  1086 
   987 
  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 
   988 
  1137 // -----------------------------------------------------------------------------
   989 // -----------------------------------------------------------------------------
  1138 // CEikMenuPaneExtension::StartCascadeMenuTimerL
   990 // CEikMenuPaneExtension::StartCascadeMenuTimerL
  1139 // Starts the timer for the sub menu launch. Timer is constructed when used for
   991 // Starts the timer for the sub menu launch. Timer is constructed when used for
  1140 // the first time
   992 // the first time
  1154     iTimer->Start( KCascadeMenuOpenDelay,
  1006     iTimer->Start( KCascadeMenuOpenDelay,
  1155                    KCascadeMenuOpenDelay,
  1007                    KCascadeMenuOpenDelay,
  1156                    TCallBack ( CascadeMenuTimerCallBack, this ) );
  1008                    TCallBack ( CascadeMenuTimerCallBack, this ) );
  1157     _AKNTRACE_FUNC_EXIT;
  1009     _AKNTRACE_FUNC_EXIT;
  1158     }
  1010     }
       
  1011 
  1159 
  1012 
  1160 // -----------------------------------------------------------------------------
  1013 // -----------------------------------------------------------------------------
  1161 // CEikMenuPaneExtension::StopCascadeMenuTimer
  1014 // CEikMenuPaneExtension::StopCascadeMenuTimer
  1162 // Stops the timer for the sub menu launch
  1015 // Stops the timer for the sub menu launch
  1163 // -----------------------------------------------------------------------------
  1016 // -----------------------------------------------------------------------------
  1258         iControl->RepaintHighlight();    
  1111         iControl->RepaintHighlight();    
  1259         }
  1112         }
  1260     _AKNTRACE_FUNC_EXIT;
  1113     _AKNTRACE_FUNC_EXIT;
  1261     }
  1114     }
  1262 
  1115 
       
  1116 
  1263 // -----------------------------------------------------------------------------
  1117 // -----------------------------------------------------------------------------
  1264 // CEikMenuPaneExtension::HighlightTimerCallBack
  1118 // CEikMenuPaneExtension::HighlightTimerCallBack
  1265 // Callback function of the timer for pressed down highlight
  1119 // Callback function of the timer for pressed down highlight
  1266 // -----------------------------------------------------------------------------
  1120 // -----------------------------------------------------------------------------
  1267 //    
  1121 //    
  1309 //
  1163 //
  1310 void CEikMenuPaneExtension::ChangePosition( TPointerEvent& aPointerEvent )    
  1164 void CEikMenuPaneExtension::ChangePosition( TPointerEvent& aPointerEvent )    
  1311     {
  1165     {
  1312     if ( !iControl->iSBFrame )
  1166     if ( !iControl->iSBFrame )
  1313         {
  1167         {
  1314         iControl->CreateScrollBarFrame();
  1168         return;
  1315         }
  1169         }
  1316     TRect scrollBarRect = iControl->iSBFrame->VerticalScrollBar()->Rect();
  1170     
  1317     TPoint scrollerTl = scrollBarRect.iTl; 
  1171     TRect scrollBarRect( iControl->iSBFrame->VerticalScrollBar()->Rect() );
  1318     TPoint scrollerBr = scrollBarRect.iBr;
  1172     TPoint scrollerTl( scrollBarRect.iTl ); 
       
  1173     TPoint scrollerBr( scrollBarRect.iBr );
  1319     TRect gapRect;           
  1174     TRect gapRect;           
  1320     // For layout that left to right
  1175     // For layout that left to right
  1321     if ( !AknLayoutUtils::LayoutMirrored() )
  1176     if ( !AknLayoutUtils::LayoutMirrored() )
  1322         {
  1177         {
  1323         TPoint rectTl( scrollerBr.iX, iControl->Rect().iTl.iY );
  1178         TPoint rectTl( scrollerBr.iX, iControl->Rect().iTl.iY );
  1361 //
  1216 //
  1362 void CEikMenuPaneExtension::CalculateParentEvent( const TPointerEvent& aPointerEvent, 
  1217 void CEikMenuPaneExtension::CalculateParentEvent( const TPointerEvent& aPointerEvent, 
  1363                            TPointerEvent& aParentEvent )
  1218                            TPointerEvent& aParentEvent )
  1364     {
  1219     {
  1365     aParentEvent.iModifiers = aPointerEvent.iModifiers;
  1220     aParentEvent.iModifiers = aPointerEvent.iModifiers;
  1366     TPoint subPos = iControl->PositionRelativeToScreen();
  1221     TPoint subPos = iControl->Position();
  1367     TPoint ownerPos = iControl->iOwner->PositionRelativeToScreen();
  1222     TPoint ownerPos = iControl->iOwner->Position();
  1368     aParentEvent.iPosition.SetXY (
  1223     aParentEvent.iPosition.SetXY (
  1369         aPointerEvent.iPosition.iX + subPos.iX - ownerPos.iX,
  1224         aPointerEvent.iPosition.iX + subPos.iX - ownerPos.iX,
  1370         aPointerEvent.iPosition.iY + subPos.iY - ownerPos.iY);
  1225         aPointerEvent.iPosition.iY + subPos.iY - ownerPos.iY);
  1371     aParentEvent.iType = aPointerEvent.iType;    
  1226     aParentEvent.iType = aPointerEvent.iType;    
  1372     }
  1227     }
  1373 
  1228 
  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 
  1229 
  1519 // -----------------------------------------------------------------------------
  1230 // -----------------------------------------------------------------------------
  1520 // CEikMenuPaneExtension::MenuClosed
  1231 // CEikMenuPaneExtension::MenuClosed
  1521 // -----------------------------------------------------------------------------
  1232 // -----------------------------------------------------------------------------
  1522 //
  1233 //
  1523 void CEikMenuPaneExtension::MenuClosed()
  1234 void CEikMenuPaneExtension::MenuClosed()
  1524     {
  1235     {
  1525     _AKNTRACE_FUNC_ENTER;
  1236     _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;
  1237     delete iSct;
  1535     iSct = NULL;
  1238     iSct = NULL;
  1536     iSctHighlighted = EFalse;
  1239     iSctHighlighted = EFalse;
  1537 #ifdef RD_UI_TRANSITION_EFFECTS_LIST  
       
  1538     iSctRect = TRect::EUninitialized;
       
  1539 #endif
       
  1540 
  1240 
  1541     if ( iCba )
  1241     if ( iCba )
  1542         {
  1242         {
  1543         iCba = NULL;
  1243         iCba = NULL;
  1544         }
  1244         }
  1547         {
  1247         {
  1548         iRedirectionListener->Closing();
  1248         iRedirectionListener->Closing();
  1549         }
  1249         }
  1550 		
  1250 		
  1551     iFlags.Clear( EHideItemSpecificCommands );
  1251     iFlags.Clear( EHideItemSpecificCommands );
       
  1252     iFlags.Clear( EHideItemActionCommands );
  1552     iFlags.Clear( EContextSensitive );
  1253     iFlags.Clear( EContextSensitive );
  1553     iFlags.Clear( EHighlightEnabled );
  1254     iFlags.Clear( EHighlightEnabled );
       
  1255     iFlags.Clear( EHideViewSpecificCommands );
       
  1256     iFlags.Clear( EHideMarkAndUnmark ); 
  1554     _AKNTRACE_FUNC_EXIT;
  1257     _AKNTRACE_FUNC_EXIT;
  1555     }
  1258     }
  1556 
  1259 
  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 
  1260 
  1744 // -----------------------------------------------------------------------------
  1261 // -----------------------------------------------------------------------------
  1745 // CEikMenuPaneExtension::ConstructMenuSctRowL
  1262 // CEikMenuPaneExtension::ConstructMenuSctRowL
  1746 // Creates a special characters row to be used in edit menu.
  1263 // Creates a special characters row to be used in edit menu.
  1747 // -----------------------------------------------------------------------------
  1264 // -----------------------------------------------------------------------------
  1760     iSct->ConstructMenuSctRowL(aResourceId);
  1277     iSct->ConstructMenuSctRowL(aResourceId);
  1761     iSct->SetBuffer( aSpecialChars );
  1278     iSct->SetBuffer( aSpecialChars );
  1762     if ( renew && iMenuPaneWindow && iControl )
  1279     if ( renew && iMenuPaneWindow && iControl )
  1763         {
  1280         {
  1764         iSct->SetContainerWindowL( *iControl );
  1281         iSct->SetContainerWindowL( *iControl );
  1765         if ( AknLayoutUtils::PenEnabled() )
  1282         iSct->SetGloballyCapturing( ETrue );
  1766             {
  1283         iSct->SetPointerCapture( ETrue );
  1767             iSct->SetGloballyCapturing( ETrue );
       
  1768             iSct->SetPointerCapture( ETrue );
       
  1769             }
       
  1770         }
  1284         }
  1771     _AKNTRACE_FUNC_EXIT;
  1285     _AKNTRACE_FUNC_EXIT;
  1772     }
  1286     }
  1773 
  1287 
  1774 // -----------------------------------------------------------------------------
  1288 // -----------------------------------------------------------------------------
  1789     iSct->ConstructMenuSctRowFromDialogL(aResourceId);
  1303     iSct->ConstructMenuSctRowFromDialogL(aResourceId);
  1790     iSct->SetBuffer( aSpecialChars );
  1304     iSct->SetBuffer( aSpecialChars );
  1791     if ( renew && iMenuPaneWindow && iControl)
  1305     if ( renew && iMenuPaneWindow && iControl)
  1792         {
  1306         {
  1793         iSct->SetContainerWindowL( *iControl );
  1307         iSct->SetContainerWindowL( *iControl );
  1794         if ( AknLayoutUtils::PenEnabled() )
  1308         iSct->SetGloballyCapturing( ETrue );
  1795             {
  1309         iSct->SetPointerCapture( ETrue );
  1796             iSct->SetGloballyCapturing( ETrue );
       
  1797             iSct->SetPointerCapture( ETrue );
       
  1798             }
       
  1799         }
  1310         }
  1800     }
  1311     }
  1801 
  1312 
  1802 // -----------------------------------------------------------------------------
  1313 // -----------------------------------------------------------------------------
  1803 // CEikMenuPaneExtension::HandleControlEventL
  1314 // CEikMenuPaneExtension::HandleControlEventL
  1804 // -----------------------------------------------------------------------------
  1315 // -----------------------------------------------------------------------------
  1805 //
  1316 //
  1806 void CEikMenuPaneExtension::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType)
  1317 void CEikMenuPaneExtension::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType)
  1807     {
  1318     {
  1808     _AKNTRACE_FUNC_ENTER;
  1319     _AKNTRACE_FUNC_ENTER;
  1809     if ( AknLayoutUtils::PenEnabled() )
  1320     if ( aEventType == EEventStateChanged )
  1810         {
  1321         {
  1811          if(aEventType == EEventStateChanged)
  1322         // Something has been selected from CharMap
  1812             {
  1323         iSpecialCharPointed = ETrue;
  1813             // Something has been selected from CharMap
       
  1814             iSpecialCharPointed = ETrue;
       
  1815             }
       
  1816         }
  1324         }
  1817     _AKNTRACE( "aEventType = %d", aEventType );
  1325     _AKNTRACE( "aEventType = %d", aEventType );
  1818     _AKNTRACE_FUNC_EXIT;
  1326     _AKNTRACE_FUNC_EXIT;
  1819     }
  1327     }
  1820 
  1328 
  1825 //
  1333 //
  1826 void CEikMenuPaneExtension::ImmediateFeedback(
  1334 void CEikMenuPaneExtension::ImmediateFeedback(
  1827     TTouchLogicalFeedback aType,
  1335     TTouchLogicalFeedback aType,
  1828     TTouchFeedbackType aFbType  = TTouchFeedbackType( ETouchFeedbackAudio |
  1336     TTouchFeedbackType aFbType  = TTouchFeedbackType( ETouchFeedbackAudio |
  1829                                                       ETouchFeedbackVibra ))
  1337                                                       ETouchFeedbackVibra ))
  1830     {   
  1338     {
  1831     if ( iFeedback )
  1339     if( iFeedback && AknLayoutUtils::PenEnabled() )
  1832         {
  1340         {
  1833         iFeedback->InstantFeedback( iControl, aType, aFbType, TPointerEvent() );
  1341         iFeedback->InstantFeedback( iControl, aType, aFbType, TPointerEvent() );
  1834         }
  1342         }
  1835     }
  1343     }
  1836 
  1344 
  1837 
  1345 
  1838 // -----------------------------------------------------------------------------
  1346 // -----------------------------------------------------------------------------
  1839 // CEikMenuPaneExtension::PrepareCascadeForItemCommands
  1347 // CEikMenuPaneExtension::PrepareCascadeForItemCommandsL
  1840 // -----------------------------------------------------------------------------
  1348 // -----------------------------------------------------------------------------
  1841 //
  1349 //
  1842 void CEikMenuPaneExtension::PrepareCascadeForItemCommands()
  1350 void CEikMenuPaneExtension::PrepareCascadeForItemCommandsL()
  1843     {
  1351     {
  1844     if ( iFlags.IsSet( ESingleClickEnabled )
  1352     if ( iFlags.IsSet( ESingleClickEnabled )
  1845             && iControl->iOwner
  1353             && iControl->iOwner
  1846             && iControl->iOwner->iExtension )
  1354             && iControl->iOwner->iExtension )
  1847         {
  1355         {
  1848         const TBitFlags& ownerFlags( iControl->iOwner->iExtension->iFlags );
  1356         const TBitFlags& ownerFlags( iControl->iOwner->iExtension->iFlags );
  1849         if ( ownerFlags.IsSet( EContextSensitive ) )
  1357         if ( ownerFlags.IsSet( EContextSensitive ) )
  1850             {
  1358             {
  1851             iFlags.Set( EContextSensitive );
  1359             iFlags.Set( EContextSensitive );
  1852             }
  1360             }
  1853         else if ( ownerFlags.IsSet( EHideItemSpecificCommands ) )
  1361         else
  1854             {
  1362             {
  1855             iControl->SetItemCommandsDimmed();
  1363             if ( ownerFlags.IsSet( EHideItemSpecificCommands ) )
       
  1364                 {
       
  1365                 iControl->SetItemCommandsStateL( ETrue );
       
  1366                 }
       
  1367             if ( ownerFlags.IsSet( EHideItemActionCommands ) )
       
  1368                 {
       
  1369                 iControl->SetItemActionsStateL( ETrue );
       
  1370                 }
  1856             }
  1371             }
  1857         }
  1372         }
  1858     }
  1373     }
  1859 
  1374 
  1860 
  1375 
  2291 //
  1806 //
  2292 EXPORT_C CEikMenuPane::~CEikMenuPane()
  1807 EXPORT_C CEikMenuPane::~CEikMenuPane()
  2293     {
  1808     {
  2294     _AKNTRACE_FUNC_ENTER;
  1809     _AKNTRACE_FUNC_ENTER;
  2295     AKNTASHOOK_REMOVE();
  1810     AKNTASHOOK_REMOVE();
       
  1811 
       
  1812     if ( iIsDeleted )
       
  1813         {
       
  1814         *iIsDeleted = ETrue;
       
  1815         iIsDeleted = NULL;
       
  1816         }
       
  1817     
  2296     CloseCascadeMenu();
  1818     CloseCascadeMenu();
  2297     if ( !ItemArrayOwnedExternally() )
  1819     if ( !ItemArrayOwnedExternally() )
  2298         {
  1820         {
  2299         delete iItemArray;
  1821         delete iItemArray;
  2300         iItemArray  = NULL;
  1822         iItemArray  = NULL;
  2360     iEditMenuObserver = aEditMenuObserver;
  1882     iEditMenuObserver = aEditMenuObserver;
  2361 
  1883 
  2362     CheckCreateScrollerL();
  1884     CheckCreateScrollerL();
  2363     CheckCreateExtensionL();
  1885     CheckCreateExtensionL();
  2364 
  1886 
  2365     iExtension->iTransitionsOn = FeatureManager::FeatureSupported( KFeatureIdUiTransitionEffects );
       
  2366 
       
  2367     CreateWindowL( iCoeEnv->RootWin() );
  1887     CreateWindowL( iCoeEnv->RootWin() );
  2368     EnableWindowTransparency();
  1888     EnableWindowTransparency();
  2369     SetAllowStrayPointers();
  1889     SetAllowStrayPointers();
  2370     EnableDragEvents();
  1890     EnableDragEvents();
  2371 
  1891 
  2372     TAknWindowLineLayout menuLineLayout;
  1892     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 
  1893 
  2387     if ( iExtension->iSct )
  1894     if ( iExtension->iSct )
  2388         {
  1895         {
  2389         RWindow* window = (RWindow*)this->DrawableWindow();
  1896         RWindow* window = (RWindow*)this->DrawableWindow();
  2390         iExtension->iMenuPaneWindow = window;
  1897         iExtension->iMenuPaneWindow = window;
  2391         iExtension->iSct->SetContainerWindowL( *this );
  1898         iExtension->iSct->SetContainerWindowL( *this );
  2392 
  1899 
  2393         if ( AknLayoutUtils::PenEnabled() )
  1900         // This is effectively the same as CCoeControl::EnableDragEvents()
  2394             {
  1901         // which is protected.
  2395             // This is effectively the same as CCoeControl::EnableDragEvents()
  1902         window->PointerFilter( EPointerFilterDrag, 0 );
  2396             // which is protected.
  1903         iExtension->iSct->SetGloballyCapturing( ETrue );
  2397             window->PointerFilter( EPointerFilterDrag, 0 );
  1904         iExtension->iSct->SetPointerCapture( ETrue );
  2398             iExtension->iSct->SetGloballyCapturing( ETrue );
  1905         iExtension->iSct->SetObserver(iExtension);
  2399             iExtension->iSct->SetPointerCapture( ETrue );
       
  2400             iExtension->iSct->SetObserver(iExtension);
       
  2401             }
       
  2402         }
  1906         }
  2403 
  1907 
  2404     if ( iOwner ) // submenu
  1908     if ( iOwner ) // submenu
  2405         {
  1909         {
  2406         SetPointerCapture( ETrue );
  1910         SetPointerCapture( ETrue );
  2414     RWindow* window = &Window();
  1918     RWindow* window = &Window();
  2415     if( window == NULL )
  1919     if( window == NULL )
  2416         User::Leave( KErrNoMemory );
  1920         User::Leave( KErrNoMemory );
  2417             
  1921             
  2418     Window().SetOrdinalPosition( 0 );
  1922     Window().SetOrdinalPosition( 0 );
  2419     
       
  2420     Window().SetPointerGrab( ETrue );
  1923     Window().SetPointerGrab( ETrue );
  2421     SetGloballyCapturing( ETrue );
  1924     SetGloballyCapturing( ETrue );
  2422 
  1925 
  2423     iExtension->iPhysics->UpdateViewWindowControl(); 
  1926     iExtension->iPhysics->UpdateViewWindowControl(); 
  2424     _AKNTRACE_FUNC_EXIT;
  1927     _AKNTRACE_FUNC_EXIT;
  2438         delete iItemArray;
  1941         delete iItemArray;
  2439         iItemArray = NULL;
  1942         iItemArray = NULL;
  2440         }
  1943         }
  2441     CreateItemArrayL();
  1944     CreateItemArrayL();
  2442 
  1945 
  2443     TAknWindowLineLayout menuLineLayout;
  1946     iItemHeight = CalculateItemHeight();
  2444     if ( iOwner ) // submenu
       
  2445         {
       
  2446         menuLineLayout = AKN_LAYOUT_WINDOW_list_single_popup_submenu_pane( 0, 0 );
       
  2447         }
       
  2448     else
       
  2449         {
       
  2450         menuLineLayout = AKN_LAYOUT_WINDOW_list_single_popup_menu_pane( 0 );
       
  2451         }
       
  2452     TRect windowRect = Rect();
       
  2453     TAknLayoutRect menuLayoutRect;
       
  2454     menuLayoutRect.LayoutRect( windowRect, menuLineLayout );
       
  2455     iItemHeight = menuLayoutRect.Rect().Height();
       
  2456 
  1947 
  2457     CheckCreateScrollerL();
  1948     CheckCreateScrollerL();
  2458     CheckCreateExtensionL();
  1949     CheckCreateExtensionL();
  2459 
  1950 
  2460     const TInt count=aReader.ReadInt16();
  1951     const TInt count=aReader.ReadInt16();
  2773     if (iEditMenuObserver)
  2264     if (iEditMenuObserver)
  2774         {
  2265         {
  2775         iEditMenuObserver->DynInitMenuPaneL( aCascadeMenuId, iCascadeMenuPane );
  2266         iEditMenuObserver->DynInitMenuPaneL( aCascadeMenuId, iCascadeMenuPane );
  2776         }
  2267         }
  2777 
  2268 
  2778     iCascadeMenuPane->iExtension->PrepareCascadeForItemCommands();
  2269     if ( iExtension->iFlags.IsSet( CEikMenuPaneExtension::EHideMarkAndUnmark ) )
       
  2270         {
       
  2271         TInt pos; 
       
  2272         if ( iCascadeMenuPane->MenuItemExists( EAknCmdMark, pos ) ) 
       
  2273             {
       
  2274             iCascadeMenuPane->SetItemDimmed( EAknCmdMark, ETrue ); 
       
  2275             }
       
  2276         if ( iCascadeMenuPane->MenuItemExists( EAknCmdUnmark, pos ) ) 
       
  2277             {
       
  2278             iCascadeMenuPane->SetItemDimmed( EAknCmdUnmark, ETrue ); 
       
  2279             } 
       
  2280         }
       
  2281     
       
  2282     iCascadeMenuPane->iExtension->PrepareCascadeForItemCommandsL();
  2779     iCascadeMenuPane->iExtension->EnableHighlight( EFalse );
  2283     iCascadeMenuPane->iExtension->EnableHighlight( EFalse );
  2780     iCascadeMenuPane->FilterDimmedItems();
  2284     iCascadeMenuPane->FilterDimmedItems();
  2781 
  2285 
  2782     // cascade menu launch animation
  2286     // cascade menu launch animation
  2783     if ( iExtension->iRedirectionListener )
  2287     if ( iExtension->iRedirectionListener )
  2787     else
  2291     else
  2788         {
  2292         {
  2789         iExtension->StartCascadeMenuAppearTransition();
  2293         iExtension->StartCascadeMenuAppearTransition();
  2790         }
  2294         }
  2791 
  2295 
  2792     if( AknLayoutUtils::PenEnabled() )
  2296     TTouchLogicalFeedback fbLogicalType = ETouchFeedbackPopUp;
  2793         {
  2297     if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) )
  2794         TTouchLogicalFeedback fbLogicalType = ETouchFeedbackPopUp;
  2298         {
  2795         if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) )
  2299         fbLogicalType = ETouchFeedbackSubMenuOpened;
  2796             {
  2300         }
  2797             fbLogicalType = ETouchFeedbackPopupOpen;
  2301     iExtension->ImmediateFeedback( fbLogicalType,
  2798             }
       
  2799         iExtension->ImmediateFeedback( fbLogicalType,
       
  2800                                        ETouchFeedbackVibra );
  2302                                        ETouchFeedbackVibra );
  2801         }
       
  2802     _AKNTRACE_FUNC_EXIT;
  2303     _AKNTRACE_FUNC_EXIT;
  2803     }
  2304     }
  2804 
  2305 
  2805 // -----------------------------------------------------------------------------
  2306 // -----------------------------------------------------------------------------
  2806 // CEikMenuPane::CalculateSizeAndPosition
  2307 // CEikMenuPane::CalculateSizeAndPosition
  2817     if ( iItemArray )
  2318     if ( iItemArray )
  2818         {// Min size is for 1 item even if menu is empty
  2319         {// Min size is for 1 item even if menu is empty
  2819         numItemsInPane = iItemArray->Count();
  2320         numItemsInPane = iItemArray->Count();
  2820         }
  2321         }
  2821 
  2322 
  2822     if ( iExtension->iSct )
  2323     if ( iExtension && iExtension->iSct )
  2823         {
  2324         {
  2824         numItemsInPane++;
  2325         numItemsInPane++;
  2825         }
  2326         }
  2826 
       
  2827     TInt maxNumItemsInMenu = AknLayoutScalable_Avkon::
       
  2828                     list_single_pane_cp2_ParamLimits().LastRow() + 1;
       
  2829     TInt maxNumItemsInSubMenu = AknLayoutScalable_Avkon::
       
  2830                     list_single_popup_submenu_pane_ParamLimits().LastRow() + 1;
       
  2831 
  2327 
  2832     TInt maxItemsInView = NumberOfItemsThatFitInView();
  2328     TInt maxItemsInView = NumberOfItemsThatFitInView();
  2833 
  2329 
  2834     if (iExtension && iExtension->iSct)
  2330     if (iExtension && iExtension->iSct)
  2835         {
  2331         {
  2864 
  2360 
  2865     CreateScrollBarFrame();
  2361     CreateScrollBarFrame();
  2866 
  2362 
  2867     iExtension->iPressedDown = EFalse;
  2363     iExtension->iPressedDown = EFalse;
  2868     iExtension->SetOffset( 0 );
  2364     iExtension->SetOffset( 0 );
  2869     iExtension->iHasIcon = MenuHasIcon();
       
  2870 
       
  2871     if ( iExtension->iTransitionsOn )
       
  2872         {
       
  2873         CAknTransitionUtils::SetAllParents( this );
       
  2874         }
       
  2875 
  2365 
  2876     const TSize screenSize( iEikonEnv->EikAppUi()->ApplicationRect().Size() );
  2366     const TSize screenSize( iEikonEnv->EikAppUi()->ApplicationRect().Size() );
  2877 
  2367 
  2878     CEikCba *cba = 0;
  2368     CEikCba *cba = 0;
  2879     MopGetObject(cba);
  2369     MopGetObject(cba);
  2890             && iCoeEnv->LastEvent().Key()->iCode == EKeyCBA1 )
  2380             && iCoeEnv->LastEvent().Key()->iCode == EKeyCBA1 )
  2891         {        
  2381         {        
  2892         SetDefaultHighlight();
  2382         SetDefaultHighlight();
  2893         }    
  2383         }    
  2894 
  2384 
  2895     TRect rect( CalculateSizeAndPosition() );
  2385     SetRect( CalculateSizeAndPosition() );
  2896     TPoint newPos( rect.iTl );
       
  2897     TSize menuSize( rect.Size() );
       
  2898 
       
  2899     SetExtent( newPos, menuSize );
       
  2900 
  2386 
  2901     // We need to set the background context when calling create for the
  2387     // We need to set the background context when calling create for the
  2902     // first time. Otherwise iExtension->iBgContext would have tiny
  2388     // first time. Otherwise iExtension->iBgContext would have tiny
  2903     // rectangles and grabbing the highlight background would produce
  2389     // rectangles and grabbing the highlight background would produce
  2904     // white.
  2390     // white.
  2905     UpdateBackgroundContext( Rect() );
  2391     UpdateBackgroundContext( Rect() );
  2906 
  2392 
  2907     // The extent has been set. This is the first safe point in code to
       
  2908     // construct animations (because before this highlight related layout code
       
  2909     // will produce invalid results
       
  2910     if( iExtension )
       
  2911         {
       
  2912         // Creates animation only if it does not exist
       
  2913         iExtension->CreateAnimation();        
       
  2914         }
       
  2915         
       
  2916     // Initialize physics engine
  2393     // Initialize physics engine
  2917     TRAP_IGNORE ( iExtension->InitPhysicsL() );
  2394     TRAP_IGNORE ( iExtension->InitPhysicsL() );
  2918         
  2395         
  2919     MakeVisible(ETrue);
  2396     MakeVisible(ETrue);
  2920     SetFocus(ETrue);
  2397     SetFocus(ETrue);
  2965     TAknLayoutRect topLeft;
  2442     TAknLayoutRect topLeft;
  2966     TAknLayoutRect bottomRight;
  2443     TAknLayoutRect bottomRight;
  2967     TAknsItemID frameIID;
  2444     TAknsItemID frameIID;
  2968     TAknsItemID frameCenterIID;
  2445     TAknsItemID frameCenterIID;
  2969     
  2446     
  2970     TRect backgroundRect( iExtension->GetBackgroundRect( aWindowRect ) );     
       
  2971         
       
  2972     if( iOwner ) //for sub menu
  2447     if( iOwner ) //for sub menu
  2973         {
  2448         {
  2974         topLeft.LayoutRect( aWindowRect, SkinLayout::Submenu_skin_placing_Line_2() );
  2449         topLeft.LayoutRect( aWindowRect, SkinLayout::Submenu_skin_placing_Line_2() );
  2975         bottomRight.LayoutRect( aWindowRect, SkinLayout::Submenu_skin_placing_Line_5() );
  2450         bottomRight.LayoutRect( aWindowRect, SkinLayout::Submenu_skin_placing_Line_5() );
  2976         frameIID = KAknsIIDQsnFrPopupSub;
  2451         frameIID = KAknsIIDQsnFrPopupSub;
  2977         frameCenterIID = KAknsIIDQsnFrPopupCenterSubmenu;
  2452         frameCenterIID = KAknsIIDQsnFrPopupCenterSubmenu;
  2978         }
  2453         }
  2979     else
  2454     else
  2980         {
  2455         {
  2981         topLeft.LayoutRect( backgroundRect, SkinLayout::Popup_windows_skin_placing__frame_general__Line_2() );
  2456         topLeft.LayoutRect( aWindowRect, SkinLayout::Popup_windows_skin_placing__frame_general__Line_2() );
  2982         bottomRight.LayoutRect( backgroundRect, SkinLayout::Popup_windows_skin_placing__frame_general__Line_5() );
  2457         bottomRight.LayoutRect( aWindowRect, SkinLayout::Popup_windows_skin_placing__frame_general__Line_5() );
  2983         frameIID = KAknsIIDQsnFrPopup;
  2458         frameIID = KAknsIIDQsnFrPopup;
  2984         frameCenterIID = KAknsIIDQsnFrPopupCenterMenu;
  2459         frameCenterIID = KAknsIIDQsnFrPopupCenterMenu;
  2985         }
  2460         }
  2986 
  2461 
  2987     TRect outerRect( topLeft.Rect().iTl, bottomRight.Rect().iBr );
  2462     TRect outerRect( topLeft.Rect().iTl, bottomRight.Rect().iBr );
  3037     TInt previousTopItem = iScroller->TopItemIndex();
  2512     TInt previousTopItem = iScroller->TopItemIndex();
  3038     TInt previousSelectedItem = iSelectedItem;
  2513     TInt previousSelectedItem = iSelectedItem;
  3039     _AKNTRACE( "previousTopItem =  %d", previousTopItem );
  2514     _AKNTRACE( "previousTopItem =  %d", previousTopItem );
  3040     _AKNTRACE( "previousSelectedItem =  %d", previousSelectedItem );
  2515     _AKNTRACE( "previousSelectedItem =  %d", previousSelectedItem );
  3041 
  2516 
       
  2517     SetSelectedItem( aNewSelectedItem );
       
  2518 
       
  2519     if ( aNewSelectedItem >= 0 )
       
  2520         {
       
  2521         ScrollToMakeItemVisible( aNewSelectedItem );
       
  2522         }
       
  2523     else
       
  2524         {
       
  2525         ScrollToMakeItemVisible( 0 );
       
  2526         }
       
  2527 
  3042     ActivateGc();
  2528     ActivateGc();
  3043 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  3044     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iExtension->iGc );
       
  3045     if ( transApi )
       
  3046         {
       
  3047         iExtension->iGc->Activate( *DrawableWindow() );
       
  3048         }
       
  3049     CWindowGc& gc = transApi ? *iExtension->iGc : SystemGc();
       
  3050 #else
       
  3051     CWindowGc& gc =  SystemGc();
  2529     CWindowGc& gc =  SystemGc();
  3052 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  3053     PrepareGcForDrawingItems( gc );
  2530     PrepareGcForDrawingItems( gc );
  3054 
  2531     
  3055     // Scrollers top item index must be updated first because setting selected
       
  3056     // item results in animation redraw (which requires knowledge about the
       
  3057     // current top item).
       
  3058     if ( aNewSelectedItem >= 0 )
       
  3059         {
       
  3060         ScrollToMakeItemVisible( aNewSelectedItem );
       
  3061         }
       
  3062     else
       
  3063         {
       
  3064         ScrollToMakeItemVisible( 0 );
       
  3065         }
       
  3066 
       
  3067     TInt topItem = iScroller->TopItemIndex();
  2532     TInt topItem = iScroller->TopItemIndex();
  3068     TInt bottomItem = topItem + NumberOfItemsThatFitInView();
  2533     TInt bottomItem = topItem + NumberOfItemsThatFitInView();
  3069     if( bottomItem > NumberOfItemsInPane() )
  2534     if( bottomItem > NumberOfItemsInPane() )
  3070         {
  2535         {
  3071         bottomItem = NumberOfItemsInPane();
  2536         bottomItem = NumberOfItemsInPane();
  3077     if (iExtension->iSctHighlighted)
  2542     if (iExtension->iSctHighlighted)
  3078         {
  2543         {
  3079         DrawItem( gc, topItem, ERemoveHighlight );
  2544         DrawItem( gc, topItem, ERemoveHighlight );
  3080         DrawItem( gc, (bottomItem-1), ERemoveHighlight );
  2545         DrawItem( gc, (bottomItem-1), ERemoveHighlight );
  3081         }
  2546         }
  3082     SetSelectedItem( aNewSelectedItem );
       
  3083 
  2547 
  3084     PrepareHighlightFrame();
  2548     PrepareHighlightFrame();
  3085 
  2549 
  3086     if ( previousTopItem == topItem  && aNewSelectedItem >= 0 )
  2550     if ( previousTopItem == topItem  && aNewSelectedItem >= 0 )
  3087         {
  2551         {
  3088         // then only previuosly and currently selected items should be redrawn
  2552         // then only previuosly and currently selected items should be redrawn
  3089         DrawItem( gc, previousSelectedItem, ERemoveHighlight );
  2553         if ( iExtension->iHighlightedItem != KErrNotFound )
       
  2554             {
       
  2555             DrawItem( gc, previousSelectedItem, ERemoveHighlight );
       
  2556             }
  3090 
  2557 
  3091         if ( !iExtension->iSctHighlighted )
  2558         if ( !iExtension->iSctHighlighted )
  3092             {
  2559             {
  3093             DrawItem( gc, aNewSelectedItem, EDrawHighlight );
  2560             DrawItem( gc, aNewSelectedItem, EDrawHighlight );
  3094             }
  2561             }
  3095         }
  2562         }
  3096     else
  2563 
  3097         {
       
  3098         TBool skipHighlight = EFalse;
       
  3099         if (iExtension && iExtension->iSct && aNewSelectedItem == 0 &&
       
  3100             previousSelectedItem > 1)
       
  3101             {
       
  3102             skipHighlight = ETrue;
       
  3103             }
       
  3104         for( TInt i = topItem; i<bottomItem; i++ )
       
  3105             {
       
  3106             if( i == aNewSelectedItem && !skipHighlight)
       
  3107                 {
       
  3108                 DrawItem( gc, i, EDrawHighlight );
       
  3109                 }
       
  3110             else
       
  3111                 {
       
  3112                 DrawItem( gc, i, ERemoveHighlight );
       
  3113                 }
       
  3114             }
       
  3115         }
       
  3116 
       
  3117 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  3118     if ( transApi )
       
  3119         {
       
  3120         iExtension->iGc->Deactivate();
       
  3121         }
       
  3122 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  3123     DeactivateGc();
  2564     DeactivateGc();
  3124 
  2565     
  3125     UpdateScrollBarThumbs();
       
  3126     
       
  3127     // Updating view position here prevents some flickering
       
  3128     iExtension->ViewPositionChanged( iExtension->iViewPosition );   
       
  3129 
       
  3130     _AKNTRACE_FUNC_EXIT;
  2566     _AKNTRACE_FUNC_EXIT;
  3131     }
  2567     }
  3132 
  2568 
  3133 // -----------------------------------------------------------------------------
  2569 // -----------------------------------------------------------------------------
  3134 // CEikMenuPane::PrepareGcForDrawingItems
  2570 // CEikMenuPane::PrepareGcForDrawingItems
  3135 // -----------------------------------------------------------------------------
  2571 // -----------------------------------------------------------------------------
  3136 //
  2572 //
  3137 void CEikMenuPane::PrepareGcForDrawingItems(CGraphicsContext& aGc) const
  2573 void CEikMenuPane::PrepareGcForDrawingItems(CGraphicsContext& aGc) const
  3138     {
  2574     {
  3139 
       
  3140     // BIDI
  2575     // BIDI
  3141     /*
  2576     /*
  3142      * get the fonts from the LAF!
  2577      * get the fonts from the LAF!
  3143      * Do we need to get them here? - nope - moved to DrawItem()
  2578      * Do we need to get them here? - nope - moved to DrawItem()
  3144      */    
  2579      */    
  3145 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  2580     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 );
  2581     aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  3158     aGc.SetBrushColor( iEikonEnv->ControlColor( EColorMenuPaneBackground,*this ) );
  2582     aGc.SetBrushColor( iEikonEnv->ControlColor( EColorMenuPaneBackground,*this ) );
  3159 #endif
  2583     }
  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 
  2584 
  3311 
  2585 
  3312 // ---------------------------------------------------------------------------
  2586 // ---------------------------------------------------------------------------
  3313 // CEikMenuPane::DrawItem
  2587 // CEikMenuPane::DrawItem
  3314 // ---------------------------------------------------------------------------
  2588 // ---------------------------------------------------------------------------
  3315 //
  2589 //
  3316 void CEikMenuPane::DrawItem( TInt aItem, THighlightType aHighlight ) const
  2590 void CEikMenuPane::DrawItem( TInt aItem, THighlightType aHighlight ) const
  3317     {
  2591     {
  3318     ActivateGc();
  2592     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();
  2593     CWindowGc& gc = SystemGc();
  3331 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  3332     PrepareGcForDrawingItems( gc );
  2594     PrepareGcForDrawingItems( gc );
  3333     DrawItem( gc, aItem, aHighlight );
  2595     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();
  2596     DeactivateGc();
  3342     }
  2597     }
  3343 
  2598 
  3344 
  2599 
  3345 // ---------------------------------------------------------------------------
  2600 // ---------------------------------------------------------------------------
  3361     if ( aItem >= numItemsInArray )
  2616     if ( aItem >= numItemsInArray )
  3362         {
  2617         {
  3363         return;
  2618         return;
  3364         }
  2619         }
  3365     
  2620     
  3366     // seem to have window owning control in correct place
       
  3367     TRect windowRect = Rect();
       
  3368 
       
  3369     if ( !iOwner )
       
  3370         {
       
  3371         windowRect.iBr.iY -= ( iExtension->iCba->Rect().Height() );    
       
  3372         }
       
  3373     
       
  3374     CEikMenuPaneItem* item = (*iItemArray)[aItem];
  2621     CEikMenuPaneItem* item = (*iItemArray)[aItem];
  3375     // Max visible number of items in menu / submenu
  2622     // Max visible number of items in menu / submenu
  3376     TInt maxNumberOfItems = NumberOfItemsThatFitInView();
  2623     TInt maxNumberOfItems = NumberOfItemsThatFitInView();
  3377     
  2624     
  3378     TInt topIndex = iScroller->TopItemIndex();
  2625     TInt topIndex = iScroller->TopItemIndex();
  3402     if ( (itemLeftInBottom > 0) && (topIndex > 0) ) 
  2649     if ( (itemLeftInBottom > 0) && (topIndex > 0) ) 
  3403         {
  2650         {
  3404         index += itemLeftInBottom;
  2651         index += itemLeftInBottom;
  3405         }
  2652         }
  3406 
  2653 
  3407     TBool drawPartialItem(EFalse);
  2654     TBool drawSeparator = !( ( index + topIndex ) == numItemsInArray - 1 );
       
  2655     TBool drawPartialItem = EFalse;
       
  2656     
  3408     if ( index == maxNumberOfItems )
  2657     if ( index == maxNumberOfItems )
  3409         {
  2658         {
  3410         // We have partial items to draw because of panning so there
  2659         // We have partial items to draw because of panning so there
  3411         // is one more item to draw than normally.
  2660         // is one more item to draw than normally.
  3412         drawPartialItem = ETrue;
  2661         drawPartialItem = ETrue;
       
  2662         
  3413         // There is no layout data for the extra item, so we used the one
  2663         // There is no layout data for the extra item, so we used the one
  3414         // above it. 
  2664         // above it. 
  3415         --index;
  2665         --index;
  3416         }
  2666         }
  3417 
  2667 
  3419     if ( index < 0 || index >= maxNumberOfItems || (iExtension->iSct && index==0))
  2669     if ( index < 0 || index >= maxNumberOfItems || (iExtension->iSct && index==0))
  3420         {
  2670         {
  3421         return;  // only interested in drawing visible items
  2671         return;  // only interested in drawing visible items
  3422         }
  2672         }
  3423 
  2673 
  3424     // Collect all of the information from the Layout DLL. Initialise these
  2674     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;
  2675     TAknLayoutRect singleMenuPaneRect;
  3433 
  2676 
  3434     if ( !iOwner )
  2677     if ( !iOwner ) // main menu
  3435         {
  2678         {
  3436         TAknWindowLineLayout listScrollPaneLayout( 
  2679         singleMenuPaneRect.LayoutRect( iExtension->iItemAreaRect,
  3437             AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() );
  2680             AknLayoutScalable_Avkon::list_single_pane_cp2( index ).LayoutLine() );
  3438         if ( iExtension )
  2681         menuTextLayout = 
  3439             {
  2682             AknLayoutScalable_Avkon::list_single_pane_t1_cp2( cascade ? 1 : 0 ).LayoutLine();
  3440             iExtension->AdjustPopupLayoutData( listScrollPaneLayout );
  2683         }
  3441             }        
  2684     else // submenu
  3442         TAknLayoutRect listScrollPaneRect;
  2685         {
  3443         listScrollPaneRect.LayoutRect( windowRect, listScrollPaneLayout );
  2686         singleMenuPaneRect.LayoutRect( iExtension->iItemAreaRect,
  3444 
  2687             AknLayoutScalable_Avkon::list_single_popup_submenu_pane( index ).LayoutLine() );
  3445         menuPane = AknLayoutScalable_Avkon::list_menu_pane( 0 ).LayoutLine();
  2688         
  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 )
  2689         if ( hasIcon )
  3474             {
  2690             {
  3475             menuTextLayout = TAknTextLineLayout( AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 1 ).LayoutLine() );
  2691             menuTextLayout = 
       
  2692                 TAknTextLineLayout( 
       
  2693                 AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 1 ).LayoutLine() );
       
  2694             }
       
  2695         else
       
  2696             {
       
  2697             menuTextLayout = 
       
  2698                 TAknTextLineLayout( 
       
  2699                 AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1( 0 ).LayoutLine() );
  3476             }
  2700             }
  3477         }
  2701         }
  3478 
  2702 
  3479     TRect itemRect( singleMenuPaneRect.Rect() );
  2703     TRect itemRect( singleMenuPaneRect.Rect() );
  3480      
  2704      
  3490     
  2714     
  3491     TBool drawingInitiated = ETrue;
  2715     TBool drawingInitiated = ETrue;
  3492 
  2716 
  3493     RWindow& window = Window();
  2717     RWindow& window = Window();
  3494     
  2718     
  3495     if ( &window && window.GetDrawRect() == TRect::EUninitialized )
  2719    if ( &window && window.GetDrawRect() == TRect::EUninitialized )
  3496         {
  2720         {
  3497 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  3498         MAknListBoxTfxInternal* transApi =
       
  3499             CAknListLoader::TfxApiInternal( &aGc );
       
  3500         drawingInitiated = transApi && !transApi->EffectsDisabled();
       
  3501 #else
       
  3502         drawingInitiated = EFalse;
  2721         drawingInitiated = EFalse;
  3503 #endif
  2722         }
  3504         }
  2723 
  3505 
  2724     if ( !drawingInitiated && !iExtension->iFullRedraw )
  3506     if ( !drawingInitiated )
  2725         {
  3507         {
  2726         TRect drawRect( itemRect ); 
  3508         window.Invalidate( itemRect );
  2727         drawRect.Intersection( iExtension->iItemAreaRect );
  3509         window.BeginRedraw( itemRect );
  2728         window.Invalidate( drawRect );
       
  2729         window.BeginRedraw( drawRect );
  3510         }
  2730         }
  3511 
  2731 
  3512     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  2732     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  3513     MAknsControlContext* cc = NULL;
  2733     MAknsControlContext* cc = NULL;
  3514     if( iExtension )
  2734     if( iExtension )
  3515         {
  2735         {
  3516         cc = iExtension->iBgContext;
  2736         cc = iExtension->iBgContext;
  3517         }
  2737         }
  3518     TBool background( ETrue );
  2738     TBool background( ETrue );
  3519 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  2739 
  3520     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
  2740     aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  3521     if ( transApi && !transApi->EffectsDisabled() )
  2741     aGc.SetBrushColor( singleMenuPaneRect.Color() );
  3522         {
  2742 
  3523         iExtension->iGc->Activate( *DrawableWindow() );
  2743     // there can be partial items, so clip drawing on menu pane's item area
  3524         }
  2744     aGc.SetClippingRect( iExtension->iItemAreaRect );
  3525 #endif
  2745 
  3526 
  2746     if (!iExtension->iFullRedraw)
  3527 #ifdef RD_UI_TRANSITION_EFFECTS_LIST            
  2747         {
  3528     if ( !transApi || transApi->EffectsDisabled() )
  2748         background = AknsDrawUtils::Background(
  3529         {
  2749             skin, cc, this, aGc, itemRect,
  3530 #endif                
  2750             KAknsDrawParamNoClearUnderImage );
       
  2751         }
       
  2752 
       
  2753     if ( !background )
       
  2754         {
  3531         aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  2755         aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  3532         aGc.SetBrushColor( singleMenuPaneRect.Color() );
  2756         aGc.SetPenStyle( CGraphicsContext::ENullPen );
  3533 
  2757         aGc.SetPenColor( singleMenuPaneRect.Color() );
  3534         if(!iExtension->iFullRedraw)
  2758         aGc.SetBrushColor( singleMenuPaneRect.Color() );         
  3535             {
  2759         aGc.DrawRect( itemRect );
  3536             background = AknsDrawUtils::Background(
  2760         }
  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 
  2761 
  3553     if ( !iExtension->HighlightEnabled() )
  2762     if ( !iExtension->HighlightEnabled() )
  3554         {
  2763         {
  3555         aHighlight = ENoHighlight;
  2764         aHighlight = ENoHighlight;
  3556         }
  2765         }
  3557 
  2766     
  3558     switch ( aHighlight )
  2767     switch ( aHighlight )
  3559         {
  2768         {
  3560         case EDrawHighlight :
  2769         case EDrawHighlight :
  3561             {
  2770             {
  3562             if ( !iExtension->iSctHighlighted )
  2771             if ( !iExtension->iSctHighlighted )
  3563                 {
  2772                 {
  3564 #ifdef RD_UI_TRANSITION_EFFECTS_LIST                
  2773                 iExtension->iHighlightedItem = aItem;
  3565                 if ( transApi )
  2774 
  3566                     {
  2775                 // Because of transparency, background must be drawn here as well
  3567                     // This will remove the old bitmap
  2776                 // (as frame may be see-through)
  3568                     transApi->Invalidate( MAknListBoxTfxInternal::EListHighlight ); 
  2777                 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  3569                                        
  2778                 aGc.SetBrushColor( singleMenuPaneRect.Color() );
  3570                     transApi->BeginRedraw( MAknListBoxTfxInternal::EListHighlight,
  2779 
  3571                                            itemRect );                                           
  2780                 AknsDrawUtils::Background(
  3572                     transApi->StartDrawing( MAknListBoxTfxInternal::EListHighlight );
  2781                     skin, cc, this, aGc, itemRect,
  3573                     }
  2782                     KAknsDrawParamNoClearUnderImage );
  3574 #endif
  2783 
  3575 
  2784                 TAknLayoutRect highlightTopLeft;
  3576                 // Partial items, so prevent drawing over the edge of menu pane
  2785                 TAknLayoutRect highlightBottomRight;
  3577 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  2786 
  3578                 if ( !transApi || ( transApi && transApi->EffectsDisabled() ) )
  2787                 highlightTopLeft.LayoutRect(itemRect,
  3579                     {
  2788                     SkinLayout::List_highlight_skin_placing__popup_windows__Line_2() );
  3580                     aGc.SetClippingRect(menuPaneRect.Rect());
  2789                 highlightBottomRight.LayoutRect(itemRect,
  3581                     }
  2790                     SkinLayout::List_highlight_skin_placing__popup_windows__Line_5() );
  3582 #else
  2791                 TRect outerRect( highlightTopLeft.Rect().iTl, highlightBottomRight.Rect().iBr );
  3583                 aGc.SetClippingRect(menuPaneRect.Rect());
  2792                 TRect innerRect( highlightTopLeft.Rect().iBr, highlightBottomRight.Rect().iTl );
  3584 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  2793 
  3585 
  2794                 TBool drawOk = AknsDrawUtils::DrawFrame( skin,
  3586                 TBool drawOk = EFalse;
  2795                         aGc, 
  3587                 if( iExtension->iAnimation ) // Draw animated highlight
  2796                         outerRect, 
  3588                     {
  2797                         innerRect, 
  3589 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  2798                         KAknsIIDQsnFrList, 
  3590                     if ( transApi && transApi->VerifyKml() == KErrNone )
  2799                         KAknsIIDDefault );
  3591                         {
  2800 
  3592                         Extension()->UseNoAnimation();
  2801                 // skinned highlight drawing has failed
  3593                         }
  2802                 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                     {
  2803                     {
  3650                     TAknLayoutRect shadowRect;
  2804                     TAknLayoutRect shadowRect;
  3651                     TAknLayoutRect highlightRect;
  2805                     TAknLayoutRect highlightRect;
  3652                     shadowRect.LayoutRect( itemRect,
  2806                     shadowRect.LayoutRect( itemRect,
  3653                         AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_1( itemRect ) );
  2807                         AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_1( itemRect ) );
  3655                         AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_2( itemRect ) );
  2809                         AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_2( itemRect ) );
  3656                     aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  2810                     aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  3657                     shadowRect.DrawRect( aGc );
  2811                     shadowRect.DrawRect( aGc );
  3658                     highlightRect.DrawRect( aGc );
  2812                     highlightRect.DrawRect( aGc );
  3659                     }
  2813                     }
  3660 
       
  3661                 aGc.CancelClippingRect();
       
  3662 
       
  3663 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  3664                 if ( transApi )
       
  3665                     {
       
  3666                     transApi->StopDrawing();
       
  3667                     transApi->EndRedraw( MAknListBoxTfxInternal::EListHighlight );
       
  3668                     }
       
  3669 #endif
       
  3670                 }
  2814                 }
  3671             break;
  2815             break;
  3672             }
  2816             }
  3673         case ERemoveHighlight:
  2817         case ERemoveHighlight:
  3674         case ENoHighlight:
  2818         case ENoHighlight:
       
  2819             if ( iExtension->iHighlightedItem == aItem )
       
  2820                 {
       
  2821                 iExtension->iHighlightedItem = KErrNotFound;
       
  2822                 }
  3675         default:
  2823         default:
  3676             break;
  2824             break;
  3677         }
  2825         }
  3678 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  3679     if ( transApi )
       
  3680         {
       
  3681         transApi->BeginRedraw( MAknListBoxTfxInternal::EListItem, itemRect, aItem );
       
  3682         transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
       
  3683         }
       
  3684 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  3685 
       
  3686     // Partial items, so prevent drawing over the edge of menu pane
       
  3687 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  3688     if ( !transApi || ( transApi && transApi->EffectsDisabled() ) )
       
  3689         {
       
  3690         aGc.SetClippingRect(menuPaneRect.Rect());
       
  3691         }
       
  3692 #else
       
  3693     aGc.SetClippingRect(menuPaneRect.Rect());
       
  3694 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  3695 
  2826 
  3696     // Cascade
  2827     // Cascade
  3697     if ( cascade )
  2828     if ( cascade )
  3698         {
  2829         {
  3699         TAknWindowLineLayout elementCascade( AknLayoutScalable_Avkon::list_single_pane_cp2_g3().LayoutLine());
  2830         TAknWindowLineLayout elementCascade( AknLayoutScalable_Avkon::list_single_pane_cp2_g3().LayoutLine());
  3702         aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
  2833         aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
  3703         CAknsMaskedBitmapItemData* itemData = static_cast<CAknsMaskedBitmapItemData*>(
  2834         CAknsMaskedBitmapItemData* itemData = static_cast<CAknsMaskedBitmapItemData*>(
  3704             skin->GetCachedItemData( KAknsIIDQgnIndiSubmenu, EAknsITMaskedBitmap ) );
  2835             skin->GetCachedItemData( KAknsIIDQgnIndiSubmenu, EAknsITMaskedBitmap ) );
  3705         if( itemData )
  2836         if( itemData )
  3706             {
  2837             {
       
  2838             AknIconUtils::SetSize( itemData->Bitmap(),cascadeRect.Rect().Size() );
  3707             aGc.BitBltMasked( cascadeRect.Rect().iTl, itemData->Bitmap(),
  2839             aGc.BitBltMasked( cascadeRect.Rect().iTl, itemData->Bitmap(),
  3708                 cascadeRect.Rect().Size(), itemData->Mask(), ETrue );
  2840                 cascadeRect.Rect().Size(), itemData->Mask(), ETrue );
  3709             }
  2841             }
  3710         else
  2842         else
  3711             {
  2843             {
  3712             aGc.BitBltMasked( cascadeRect.Rect().iTl, iExtension->iCascadeBitmap,
  2844             if ( iExtension->iCascadeBitmap && iExtension->iCascadeBitmapMask )
  3713                 cascadeRect.Rect().Size(), iExtension->iCascadeBitmapMask, ETrue );
  2845                {
       
  2846                AknIconUtils::SetSize( iExtension->iCascadeBitmap,cascadeRect.Rect().Size() );
       
  2847                aGc.BitBltMasked( cascadeRect.Rect().iTl, iExtension->iCascadeBitmap,
       
  2848                    cascadeRect.Rect().Size(), iExtension->iCascadeBitmapMask, ETrue );
       
  2849                }
  3714             }
  2850             }
  3715         }
  2851         }
  3716     else
  2852     else
  3717         {
  2853         {
  3718         TAknLayoutRect activeApplicationsIconRect;
  2854         TAknLayoutRect activeApplicationsIconRect;
  3784                 }
  2920                 }
  3785             }
  2921             }
  3786         }
  2922         }
  3787 
  2923 
  3788     // Text
  2924     // Text
  3789     TAknLayoutText textRect( iExtension->GetMenuItemTextLayout( itemRect, cascade ) );
  2925     TAknLayoutText textRect;
       
  2926     textRect.LayoutText( itemRect, menuTextLayout );
  3790     TRgb textColor = textRect.Color();
  2927     TRgb textColor = textRect.Color();
       
  2928 
  3791     if ( aHighlight == EDrawHighlight ) // highlighted text
  2929     if ( aHighlight == EDrawHighlight ) // highlighted text
  3792         {
  2930         {
  3793         AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG10 );
  2931         AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG10 );
  3794         }
  2932         }
  3795     else if ( !iOwner ) // menu
  2933     else if ( !iOwner ) // menu
  3817             textColor = KRgbBlack;
  2955             textColor = KRgbBlack;
  3818             }
  2956             }
  3819        }
  2957        }
  3820     aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
  2958     aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
  3821     aGc.SetPenColor( textColor );
  2959     aGc.SetPenColor( textColor );
  3822     aGc.UseFont( textRect.Font() );
       
  3823 
  2960 
  3824     const CFont* font = textRect.Font();
  2961     const CFont* font = textRect.Font();
  3825 
  2962 
  3826     //TBuf<CEikMenuPaneItem::SData::ENominalTextLength + KAknBidiExtraSpacePerLine> visualText; // buffer for visually ordered text
  2963     //TBuf<CEikMenuPaneItem::SData::ENominalTextLength + KAknBidiExtraSpacePerLine> visualText; // buffer for visually ordered text
  3827     TBuf<255 + KAknBidiExtraSpacePerLine> visualText; // buffer for visually ordered text
  2964     TBuf<255 + KAknBidiExtraSpacePerLine> visualText; // buffer for visually ordered text
  3844         TRect cascRect( textRect.TextRect() );
  2981         TRect cascRect( textRect.TextRect() );
  3845         cascRect.Move( position );
  2982         cascRect.Move( position );
  3846         iExtension->iCascadeDRect.SetRect( cascRect.iTl, cascRect.iBr );        
  2983         iExtension->iCascadeDRect.SetRect( cascRect.iTl, cascRect.iBr );        
  3847         }
  2984         }
  3848 
  2985 
  3849     if(iExtension->iIsPenEnable)
  2986     TAknLayoutRect highlightRect;
  3850         {
  2987     highlightRect.LayoutRect( itemRect,
  3851         TAknLayoutRect highlightRect;
  2988         AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_2( itemRect ) );
  3852         highlightRect.LayoutRect( itemRect,
  2989 
  3853             AKN_LAYOUT_WINDOW_Highlight_graphics__various__Line_2( itemRect ) );
  2990     // store the calculated y-position to the menu item,
  3854 
  2991     // so that it can be used in HandlePointerEventL()
  3855         // store the calculated y-position to the menu item,
  2992     item->iPos = highlightRect.Rect().iTl.iY;
  3856         // so that it can be used in HandlePointerEventL()
  2993     
  3857         item->iPos = highlightRect.Rect().iTl.iY;
  2994     // don't draw separator line for the last item
  3858         aGc.DiscardFont();
  2995     if ( drawSeparator )
  3859         }
  2996         {
  3860 
  2997         AknListUtils::DrawSeparator( aGc, itemRect, textColor, skin );
  3861     if ( !drawingInitiated )
  2998         }
       
  2999     
       
  3000     if ( !drawingInitiated && !iExtension->iFullRedraw )
  3862         {
  3001         {
  3863         Window().EndRedraw();
  3002         Window().EndRedraw();
  3864         }
  3003         }
  3865 
  3004 
  3866     aGc.CancelClippingRect();
  3005     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     }
  3006     }
  3877 
  3007 
  3878 
  3008 
  3879 // -----------------------------------------------------------------------------
  3009 // -----------------------------------------------------------------------------
  3880 // CEikMenuPane::Draw
  3010 // CEikMenuPane::Draw
  3881 // -----------------------------------------------------------------------------
  3011 // -----------------------------------------------------------------------------
  3882 //
  3012 //
  3883 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  3884 EXPORT_C void CEikMenuPane::Draw( const TRect& aRect ) const
  3013 EXPORT_C void CEikMenuPane::Draw( const TRect& aRect ) const
  3885     {
  3014     {
  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();
  3015     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  3914     MAknsControlContext* cc = NULL;
  3016     MAknsControlContext* cc = NULL;
  3915 
  3017 
  3916     if( iExtension )
  3018     if( iExtension )
  3917         {
  3019         {
  3918         cc = iExtension->iBgContext;
  3020         cc = iExtension->iBgContext;
  3919         }
  3021         }
  3920 
  3022 
  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();
  3023     CWindowGc& gc = SystemGc();
  3929 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  3930     PrepareGcForDrawingItems( gc );
  3024     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 
  3025 
  3951     TInt count=0;
  3026     TInt count=0;
       
  3027 
  3952     if( iItemArray )
  3028     if( iItemArray )
  3953         {
  3029         {
  3954         count=iItemArray->Count();
  3030         count=iItemArray->Count();
  3955         }
  3031         }
  3956 
  3032 
  3957     // Give the topmost menu item's rect to SCT if needed.
  3033     // Give the topmost menu item's rect to SCT if needed.
  3958     if ( iExtension->iSct )
  3034     if ( iExtension->iSct )
  3959         {
  3035         {
  3960         TAknLayoutRect listScrollPaneRect;
  3036         iExtension->iSct->SetMenuSctRect( ItemRect( 0 ) );
  3961         TAknLayoutRect menuPaneRect;
  3037 
  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;
  3038         TRegionFix<4> region;
  3997         region.AddRect( Rect() );
  3039         region.AddRect( aRect );
  3998         region.SubRect( iExtension->iSct->Rect() );
  3040         region.SubRect( iExtension->iSct->Rect() );
  3999         gc.SetClippingRegion( region );
  3041         gc.SetClippingRegion( region );
  4000         }
  3042         }
  4001         
       
  4002     TRect backgroundRect( iOwner ? windowRect : iExtension->GetBackgroundRect( windowRect ) );
       
  4003         
  3043         
  4004     // The added flag removes the white bg for transparency
  3044     // The added flag removes the white bg for transparency
  4005     TBool frameDrawn = AknsDrawUtils::Background( 
  3045     TBool frameDrawn = AknsDrawUtils::Background( 
  4006         skin, cc, this, gc, backgroundRect, KAknsDrawParamNoClearUnderImage );        
  3046         skin, cc, this, gc, aRect, KAknsDrawParamNoClearUnderImage );        
  4007 
  3047 
  4008 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  3048     if ( aRect.Intersects( iExtension->iItemAreaRect ) )
  4009     if ( transApi )
  3049         {
  4010         {
  3050         iExtension->iFullRedraw = ETrue;   
  4011         transApi->StopDrawing();
  3051     
  4012         }
  3052         for ( TInt ii=0;ii<count;++ii )
  4013 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  3053             {
  4014 
  3054             if(!iExtension->iSctHighlighted && ii == iSelectedItem  )
  4015     iExtension->iFullRedraw = ETrue;   
  3055                 DrawItem( gc, ii, EDrawHighlight);
  4016 
  3056             else
  4017     for ( TInt ii=0;ii<count;++ii )
  3057                 DrawItem( gc, ii, ENoHighlight);
  4018         {
  3058             }    
  4019         if(!iExtension->iSctHighlighted && ii == iSelectedItem  )
  3059       
  4020             DrawItem( gc, ii, EDrawHighlight);
  3060         iExtension->iFullRedraw = EFalse;   
  4021         else
  3061         }
  4022             DrawItem( gc, ii, ENoHighlight);
       
  4023         }    
       
  4024   
       
  4025     iExtension->iFullRedraw = EFalse;   
       
  4026 
  3062 
  4027     if ( iExtension->iSct )
  3063     if ( iExtension->iSct )
  4028         {
  3064         {
  4029 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  4030         if ( transApi )
       
  4031             {
       
  4032             transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified );
       
  4033             }
       
  4034 #endif
       
  4035         gc.CancelClippingRegion();
  3065         gc.CancelClippingRegion();
  4036 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  3066         }
  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     }
  3067     }
  4052 
  3068 
  4053 
  3069 
  4054 // -----------------------------------------------------------------------------
  3070 // -----------------------------------------------------------------------------
  4055 // CEikMenuPane::ReportSelectionMadeL
  3071 // CEikMenuPane::ReportSelectionMadeL
  4119         // 'this' might be destroyed by calling iMenuObserver->ProcessCommandL(
  3135         // 'this' might be destroyed by calling iMenuObserver->ProcessCommandL(
  4120         // commandId ), so need to avoid crash
  3136         // commandId ), so need to avoid crash
  4121         CEikMenuPane* menu = iOwner ? iOwner : this;
  3137         CEikMenuPane* menu = iOwner ? iOwner : this;
  4122         MCoeControlObserver* observer = menu->Observer();
  3138         MCoeControlObserver* observer = menu->Observer();
  4123 
  3139 
  4124 
  3140         if ( commandId >= EAknCmdMarkingModeEnter 
  4125         if ( commandId != EAknCmdTaskSwapper )
  3141                 && commandId <= EAknCmdMarkingModeUnmarkAll )
       
  3142             {
       
  3143             CEikMenuBar* menuBar = static_cast<CEikMenuBar*>( Parent() );
       
  3144             if ( menuBar && menuBar->MenuPane() == this )
       
  3145                 {
       
  3146                 static_cast<MEikCommandObserver*>(
       
  3147                         menuBar)->ProcessCommandL( commandId );
       
  3148                 }
       
  3149             ReportCanceled();
       
  3150             }
       
  3151         else if ( commandId != EAknCmdTaskSwapper )
  4126             {
  3152             {
  4127             _AKNTRACE( "commandId = %d",  commandId );
  3153             _AKNTRACE( "commandId = %d",  commandId );
       
  3154             TBool isDeleted = EFalse;
       
  3155             iIsDeleted = &isDeleted;
       
  3156             
       
  3157             CleanupStack::PushL( TCleanupItem( CleanLocalRef, this ) );            
  4128             iMenuObserver->ProcessCommandL( commandId ); 
  3158             iMenuObserver->ProcessCommandL( commandId ); 
       
  3159             CleanupStack::Pop();
       
  3160 
       
  3161             if ( !isDeleted )
       
  3162                 {
       
  3163                 CEikMenuBar* menuBar = static_cast<CEikMenuBar*>( Parent() );
       
  3164                 if ( menuBar && menuBar->MenuPane() == this )
       
  3165                     {
       
  3166                     static_cast<MEikCommandObserver*>(
       
  3167                             menuBar)->ProcessCommandL( commandId );
       
  3168                     }
       
  3169                 }            
       
  3170 
       
  3171             iIsDeleted = NULL;
  4129             }
  3172             }
  4130         else
  3173         else
  4131             {
  3174             {
  4132             ReportCanceled();
  3175             ReportCanceled();
  4133             return;
  3176             return;
  4157 //
  3200 //
  4158 EXPORT_C void CEikMenuPane::FocusChanged( TDrawNow aDrawNow )
  3201 EXPORT_C void CEikMenuPane::FocusChanged( TDrawNow aDrawNow )
  4159     {
  3202     {
  4160     _AKNTRACE_FUNC_ENTER;
  3203     _AKNTRACE_FUNC_ENTER;
  4161     _AKNTRACE( "aDrawNow =  %d", aDrawNow );
  3204     _AKNTRACE( "aDrawNow =  %d", aDrawNow );
  4162     if( iExtension )
       
  4163         {
       
  4164         if ( IsFocused() )
       
  4165             {
       
  4166 #ifdef RD_UI_TRANSITION_EFFECTS_LIST        
       
  4167             // Focus must be handled here, otherwise it will come to late
       
  4168             MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iExtension->iGc );
       
  4169     
       
  4170             if ( transApi )
       
  4171                 {
       
  4172                 transApi->HandleFocusChange( ETrue );
       
  4173                 }
       
  4174 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  4175             iExtension->FocusGained();
       
  4176             }
       
  4177         else // Not focused
       
  4178             {
       
  4179             iExtension->FocusLost();
       
  4180             }
       
  4181         }
       
  4182 
  3205 
  4183     if ( !iItemArray || iItemArray->Count() == 0 )
  3206     if ( !iItemArray || iItemArray->Count() == 0 )
  4184         {
  3207         {
  4185         return;
  3208         return;
  4186         }
  3209         }
  4368     TInt newHighlight = iSelectedItem;
  3391     TInt newHighlight = iSelectedItem;
  4369     TBool loopScrolling = ETrue;
  3392     TBool loopScrolling = ETrue;
  4370     TInt itemAfterLastItem = loopScrolling ? 0 : max;
  3393     TInt itemAfterLastItem = loopScrolling ? 0 : max;
  4371     TInt itemAfterFirstItem = loopScrolling ? max : 0;
  3394     TInt itemAfterFirstItem = loopScrolling ? max : 0;
  4372 
  3395 
  4373 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  3396     // Scroll highlighted item so that it becomes visible,
  4374     CWindowGc& gc = iExtension->iGc ? *iExtension->iGc : SystemGc();
  3397     // if it is not visible before (scrolling with scroll bar
  4375     MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( &gc );
  3398     // can cause highlighted item to go out of screen)
  4376 #endif //RD_UI_TRANSITION_EFFECTS_LIST
  3399     TInt topItem = iScroller->TopItemIndex();
  4377 
  3400     TInt bottomItem = topItem + NumberOfItemsThatFitInView();
  4378     if(iExtension->iIsPenEnable)
  3401           
  4379         {
  3402     if ( iExtension->Offset() < 0 ) 
  4380         _AKNTRACE( "[%s]", "iExtension->iIsPenEnable = TRUE" );
  3403         {
  4381         // Scroll highlighted item so that it becomes visible,
  3404         // Extra bottom item when panning
  4382         // if it is not visible before (scrolling with scroll bar
  3405         bottomItem++;
  4383         // can cause highlighted item to go out of screen)
  3406         }
  4384         TInt topItem = iScroller->TopItemIndex();
  3407     
  4385         TInt bottomItem = topItem + NumberOfItemsThatFitInView();
  3408     if( bottomItem > NumberOfItemsInPane() )
  4386               
  3409         {
  4387         if ( iExtension->Offset() < 0 ) 
  3410         bottomItem = NumberOfItemsInPane();
  4388             {
  3411         }
  4389             // Extra bottom item when panning
  3412     _AKNTRACE( "topItem = %d,bottomItem = %d", topItem,bottomItem );
  4390             bottomItem++;
  3413 
  4391             }
  3414     if ( aType != EEventKeyDown && iSelectedItem != ENothingSelected &&
  4392         
  3415         !(iExtension->iSctHighlighted && topItem == 0) &&
  4393         if( bottomItem > NumberOfItemsInPane() )
  3416         (iSelectedItem < topItem || iSelectedItem > bottomItem - 1) )
  4394             {
  3417         {
  4395             bottomItem = NumberOfItemsInPane();
  3418         _AKNTRACE( "[%s]", "ScrollToMakeItemVisible(iSelectedItem);" );
  4396             }
  3419         ScrollToMakeItemVisible(iSelectedItem);
  4397         _AKNTRACE( "topItem = %d,bottomItem = %d", topItem,bottomItem );
  3420 
  4398 
  3421         ActivateGc();
  4399         if ( aType != EEventKeyDown && iSelectedItem != ENothingSelected &&
  3422         CWindowGc& gc = SystemGc();
  4400             !(iExtension->iSctHighlighted && topItem == 0) &&
  3423         PrepareGcForDrawingItems( gc );
  4401             (iSelectedItem < topItem || iSelectedItem > bottomItem - 1) )
  3424 
  4402             {
  3425         // draw all items that are needed.
  4403             _AKNTRACE( "[%s]", "ScrollToMakeItemVisible(iSelectedItem);" );
  3426         for( TInt i = 0; i < count; i++ )
  4404             ScrollToMakeItemVisible(iSelectedItem);
  3427             {
  4405 
  3428             if( i == iSelectedItem && !iExtension->iSctHighlighted)
  4406             ActivateGc();
  3429                 {
  4407 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  3430                 DrawItem( gc, i, EDrawHighlight );
  4408             if ( transApi )
  3431                 }
  4409                 {
  3432             else
  4410                 iExtension->iGc->Activate( *DrawableWindow() );
  3433                 {
  4411                 }
  3434                 DrawItem( gc, i, ERemoveHighlight );
  4412 #else
  3435                 }
  4413             CWindowGc& gc = SystemGc();
  3436             }
  4414 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  3437 
  4415             PrepareGcForDrawingItems( gc );
  3438         DeactivateGc();
  4416 
  3439         _AKNTRACE( "[%s]", "OfferKeyEventL return 9" );
  4417             // draw all items that are needed.
  3440         _AKNTRACE_FUNC_EXIT;
  4418             for( TInt i = 0; i < count; i++ )
  3441         return EKeyWasConsumed;
  4419                 {
       
  4420                 if( i == iSelectedItem && !iExtension->iSctHighlighted)
       
  4421                     {
       
  4422                     DrawItem( gc, i, EDrawHighlight );
       
  4423                     }
       
  4424                 else
       
  4425                     {
       
  4426                     DrawItem( gc, i, ERemoveHighlight );
       
  4427                     }
       
  4428                 }
       
  4429 
       
  4430 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  4431             if ( transApi )
       
  4432                 {
       
  4433                 iExtension->iGc->Deactivate();
       
  4434                 }
       
  4435 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  4436             DeactivateGc();
       
  4437             _AKNTRACE( "[%s]", "OfferKeyEventL return 9" );
       
  4438             _AKNTRACE_FUNC_EXIT;
       
  4439             return EKeyWasConsumed;
       
  4440             }
       
  4441         }
  3442         }
  4442 
  3443 
  4443     if ( iSelectedItem != ENothingSelected || iExtension->iSctHighlighted )
  3444     if ( iSelectedItem != ENothingSelected || iExtension->iSctHighlighted )
  4444         {
  3445         {
  4445         switch ( code )
  3446         switch ( code )
  4452                 return EKeyWasConsumed;
  3453                 return EKeyWasConsumed;
  4453 // AKNLAF start
  3454 // AKNLAF start
  4454 // loop scrolling always used in options menus
  3455 // loop scrolling always used in options menus
  4455             case EKeyDownArrow:
  3456             case EKeyDownArrow:
  4456             	_AKNTRACE( "[%s]", "OfferKeyEventL(EKeyDownArrow)" );
  3457             	_AKNTRACE( "[%s]", "OfferKeyEventL(EKeyDownArrow)" );
  4457 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  4458                 if ( transApi )
       
  4459                     {
       
  4460                     transApi->SetMoveType(
       
  4461                             MAknListBoxTfxInternal::EListMoveDown );
       
  4462                     }
       
  4463 #endif //RD_UI_TRANSITION_EFFECTS_LIST
       
  4464                 if ( iExtension->iSctHighlighted && iExtension->iSct )
  3458                 if ( iExtension->iSctHighlighted && iExtension->iSct )
  4465                     {
  3459                     {
  4466                     iExtension->iSctHighlighted = EFalse;
  3460                     iExtension->iSctHighlighted = EFalse;
  4467                     MoveHighlightTo( ++newHighlight );
  3461                     MoveHighlightTo( ++newHighlight );
  4468                     iExtension->iSct->HighlightSctRow( iExtension->iSctHighlighted );
  3462                     iExtension->iSct->HighlightSctRow( iExtension->iSctHighlighted );
  4484                     }
  3478                     }
  4485                 keyResponse = EKeyWasConsumed;
  3479                 keyResponse = EKeyWasConsumed;
  4486                 break;
  3480                 break;
  4487             case EKeyUpArrow:
  3481             case EKeyUpArrow:
  4488             	_AKNTRACE( "[%s]", "OfferKeyEventL(EKeyUpArrow)" );
  3482             	_AKNTRACE( "[%s]", "OfferKeyEventL(EKeyUpArrow)" );
  4489 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  4490                 if ( transApi )
       
  4491                     {
       
  4492                     transApi->SetMoveType(
       
  4493                             MAknListBoxTfxInternal::EListMoveUp );
       
  4494                     }
       
  4495 #endif //RD_UI_TRANSITION_EFFECTS_LIST
       
  4496                 if ( iExtension->iSct &&
  3483                 if ( iExtension->iSct &&
  4497                     iSelectedItem == 0 && !iExtension->iSctHighlighted )
  3484                     iSelectedItem == 0 && !iExtension->iSctHighlighted )
  4498                     {
  3485                     {
  4499                     iExtension->iSctHighlighted = ETrue;
  3486                     iExtension->iSctHighlighted = ETrue;
  4500                     MoveHighlightTo( ENothingSelected );
  3487                     MoveHighlightTo( ENothingSelected );
  4693         return;
  3680         return;
  4694         }
  3681         }
  4695         
  3682         
  4696     TInt count( NumberOfItemsInPane() );
  3683     TInt count( NumberOfItemsInPane() );
  4697         
  3684         
  4698     if ( iExtension->iIsPenEnable )
  3685     // Scroll highlighted item so that it becomes visible
  4699         {
  3686     // if it is not visible before (scrolling with scroll bar
  4700         // Scroll highlighted item so that it becomes visible
  3687     // can cause highlighted item to go out of screen).
  4701         // if it is not visible before (scrolling with scroll bar
  3688     TInt topItem( iScroller->TopItemIndex() );
  4702         // can cause highlighted item to go out of screen).
  3689     TInt bottomItem( topItem + NumberOfItemsThatFitInView() );
  4703         TInt topItem( iScroller->TopItemIndex() );
  3690     if ( bottomItem > count )
  4704         TInt bottomItem( topItem + NumberOfItemsThatFitInView() );
  3691         {
  4705         if ( bottomItem > count )
  3692         bottomItem = count;
  4706             {
  3693         }
  4707             bottomItem = count;
  3694 
  4708             }
  3695     if ( iExtension->Offset() < 0 &&
  4709    
  3696          ( iSelectedItem == topItem || iSelectedItem == bottomItem ) )
  4710         if ( iExtension->Offset() < 0 &&
  3697         {
  4711              ( iSelectedItem == topItem || iSelectedItem == bottomItem ) )
  3698         // Restoring offset with "simulated" ok key event.         
  4712             {
  3699         iExtension->RestoreOffset( EKeyOK ); 
  4713             // Restoring offset with "simulated" ok key event.         
  3700         }    
  4714             iExtension->RestoreOffset( EKeyOK ); 
  3701     else if ( iSelectedItem < topItem ||
  4715             }    
  3702               iSelectedItem > bottomItem - 1 )
  4716         else if ( iSelectedItem < topItem ||
  3703         {
  4717                   iSelectedItem > bottomItem - 1 )
  3704         if ( count > iSelectedItem )
  4718             {
  3705             {
  4719             if ( count > iSelectedItem )
  3706             if ( iExtension->iSctHighlighted && iExtension->iSct )
  4720                 {
  3707                 {
  4721                 if ( iExtension->iSctHighlighted && iExtension->iSct )
  3708                 TKeyEvent key;
       
  3709                 key.iCode = EKeyOK;
       
  3710                 key.iModifiers = 0;
       
  3711 
       
  3712                 TKeyResponse keyResponse( EKeyWasNotConsumed );
       
  3713                 TEventCode type( EEventNull );
       
  3714                 keyResponse = iExtension->iSct->OfferKeyEventL( key,
       
  3715                                                                 type );
       
  3716                 if ( keyResponse == EKeyWasConsumed )
  4722                     {
  3717                     {
  4723                     TKeyEvent key;
  3718                     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                     }
  3719                     }
  4739                 }
  3720                 _AKNTRACE( "[%s]" "ActivateCurrentItemL return 2" );
  4740 
  3721                 _AKNTRACE_FUNC_EXIT;
  4741             iExtension->isUpdateScrollDirectly = ETrue;
  3722                 return;
  4742             ScrollToMakeItemVisible( iSelectedItem );
  3723                 }
  4743             iExtension->isUpdateScrollDirectly = EFalse;
  3724             }
  4744 
  3725 
  4745             ActivateGc();
  3726         iExtension->isUpdateScrollDirectly = ETrue;
  4746 
  3727         ScrollToMakeItemVisible( iSelectedItem );
  4747 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  3728         iExtension->isUpdateScrollDirectly = EFalse;
  4748 
  3729 
  4749             MAknListBoxTfxInternal *transApi =
  3730         ActivateGc();
  4750                 CAknListLoader::TfxApiInternal( iExtension->iGc );
  3731         CWindowGc& gc = SystemGc();
  4751             if ( transApi )
  3732         PrepareGcForDrawingItems( gc );
  4752                 {
  3733 
  4753                 iExtension->iGc->Activate( *DrawableWindow() );
  3734         // Draw all items that are needed.
  4754                 }
  3735         for ( TInt i = 0; i < count; i++ )
  4755             CWindowGc& gc = transApi ? *iExtension->iGc : SystemGc();
  3736             {
  4756 
  3737             if ( i == iSelectedItem && !iExtension->iSctHighlighted )
  4757 #else
  3738                 {
  4758 
  3739                 DrawItem( gc, i, EDrawHighlight );
  4759             CWindowGc& gc = SystemGc();
  3740                 }
  4760 
  3741             else
  4761 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  3742                 {
  4762 
  3743                 DrawItem( gc, i, ERemoveHighlight );
  4763             PrepareGcForDrawingItems( gc );
  3744                 }
  4764 
  3745             }
  4765             // Draw all items that are needed.
  3746 
  4766             for ( TInt i = 0; i < count; i++ )
  3747         DeactivateGc();
  4767                 {
  3748         _AKNTRACE( "[%s]" "ActivateCurrentItemL return 3" );
  4768                 if ( i == iSelectedItem && !iExtension->iSctHighlighted )
  3749         _AKNTRACE_FUNC_EXIT;
  4769                     {
  3750         return;
  4770                     DrawItem( gc, i, EDrawHighlight );
       
  4771                     }
       
  4772                 else
       
  4773                     {
       
  4774                     DrawItem( gc, i, ERemoveHighlight );
       
  4775                     }
       
  4776                 }
       
  4777 
       
  4778 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  4779 
       
  4780             if ( transApi )
       
  4781                 {
       
  4782                 iExtension->iGc->Deactivate();
       
  4783                 }
       
  4784 
       
  4785 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  4786 
       
  4787             DeactivateGc();
       
  4788             _AKNTRACE( "[%s]" "ActivateCurrentItemL return 3" );
       
  4789             _AKNTRACE_FUNC_EXIT;
       
  4790             return;
       
  4791             }
       
  4792         }
  3751         }
  4793 
  3752 
  4794     if ( iCascadeMenuPane )
  3753     if ( iCascadeMenuPane )
  4795         {
  3754         {
  4796         iCascadeMenuPane->ActivateCurrentItemL();
  3755         iCascadeMenuPane->ActivateCurrentItemL();
  4871     CEikMenuBar* menubar = static_cast<CEikMenuBar*>( Parent() );
  3830     CEikMenuBar* menubar = static_cast<CEikMenuBar*>( Parent() );
  4872     if( menubar->MenuPane() == this )
  3831     if( menubar->MenuPane() == this )
  4873         {
  3832         {
  4874         TPointerEvent ptrEvent;
  3833         TPointerEvent ptrEvent;
  4875         ptrEvent.iType = TPointerEvent::EButton1Up;
  3834         ptrEvent.iType = TPointerEvent::EButton1Up;
  4876         menubar->HandlePointerEventL( ptrEvent );
  3835         TRAP_IGNORE( menubar->HandlePointerEventL( ptrEvent ) );
  4877         }
  3836         }
  4878     else
  3837     else
  4879         {
  3838         {
  4880         MCoeControlObserver* observer = iOwner ? iOwner->Observer() : Observer();
  3839         MCoeControlObserver* observer = iOwner ? iOwner->Observer() : Observer();
  4881         if ( observer )
  3840         if ( observer )
  4907 // Handles pointer events.
  3866 // Handles pointer events.
  4908 // ----------------------------------------------------------------------------
  3867 // ----------------------------------------------------------------------------
  4909 //
  3868 //
  4910 EXPORT_C void CEikMenuPane::HandlePointerEventL( const TPointerEvent& aPointerEvent )
  3869 EXPORT_C void CEikMenuPane::HandlePointerEventL( const TPointerEvent& aPointerEvent )
  4911     {
  3870     {
  4912     if( !AknLayoutUtils::PenEnabled() )
       
  4913         {
       
  4914         return;
       
  4915         }
       
  4916 
       
  4917     _AKNTRACE_FUNC_ENTER;
  3871     _AKNTRACE_FUNC_ENTER;
  4918 
  3872 
  4919     if ( iOwner && !IsVisible() )
  3873     if ( iOwner && !IsVisible() )
  4920         {
  3874         {
  4921         _AKNTRACE( "[%s]", "HandlePointerEventL return 1" );
  3875         _AKNTRACE( "[%s]", "HandlePointerEventL return 1" );
  4947         }    
  3901         }    
  4948     else
  3902     else
  4949         {
  3903         {
  4950         if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  3904         if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  4951             {
  3905             {
  4952             if( AknLayoutUtils::PenEnabled() )
  3906             if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) )
  4953                 {
  3907                 {
  4954                 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) )
  3908                 iExtension->ImmediateFeedback( ETouchFeedbackSubMenuClosed );
  4955                     {
  3909                 }
  4956                     iExtension->ImmediateFeedback( ETouchFeedbackPopupClose );
  3910             else
  4957                     }
  3911                 {
  4958                 else
  3912                 iExtension->ImmediateFeedback( ETouchFeedbackPopUp );
  4959                     {
       
  4960                     iExtension->ImmediateFeedback( ETouchFeedbackPopUp );
       
  4961                     }
       
  4962                 }
  3913                 }
  4963             iExtension->iShowCascadeTransition = ETrue;
  3914             iExtension->iShowCascadeTransition = ETrue;
  4964             CloseCascadeMenu();  
  3915             CloseCascadeMenu();  
       
  3916             // Submenu of submenu was closed
       
  3917             if ( iCascadeMenuPane  )
       
  3918                 {
       
  3919                 iCascadeMenuPane->iExtension->EnableHighlight( EFalse );
       
  3920                 iCascadeMenuPane->RepaintHighlight();
       
  3921                 iExtension->iDownOnMenuArea = EFalse;
       
  3922                 }
       
  3923             else
       
  3924                 {
       
  3925                 iExtension->EnableHighlight( EFalse );
       
  3926                 RepaintHighlight();            
       
  3927                 }
  4965             IgnoreEventsUntilNextPointerUp();
  3928             IgnoreEventsUntilNextPointerUp();
  4966             _AKNTRACE( "[%s]", "HandlePointerEventL return 2" );
  3929             _AKNTRACE( "[%s]", "HandlePointerEventL return 2" );
  4967             _AKNTRACE_FUNC_EXIT;
  3930             _AKNTRACE_FUNC_EXIT;
  4968             return;
  3931             return;
  4969             }
  3932             }
  5046     const TRect innerRect = iBorder.InnerRect( Rect() );
  4009     const TRect innerRect = iBorder.InnerRect( Rect() );
  5047     TRect menuSctRect;
  4010     TRect menuSctRect;
  5048     // Get the option item's rect in Menu SCT
  4011     // Get the option item's rect in Menu SCT
  5049     if ( iExtension->iSct )
  4012     if ( iExtension->iSct )
  5050         {
  4013         {
  5051         TAknLayoutRect menuPaneRect;
  4014         menuSctRect = iExtension->iItemAreaRect;
  5052         TAknWindowLineLayout menuPane;
       
  5053         
       
  5054         TAknWindowLineLayout listScrollPaneLayout( 
       
  5055             AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() );
       
  5056         if ( iExtension )
       
  5057             {
       
  5058             iExtension->AdjustPopupLayoutData( listScrollPaneLayout );
       
  5059             }
       
  5060         TAknLayoutRect listScrollPaneRect;
       
  5061         listScrollPaneRect.LayoutRect( Rect(), listScrollPaneLayout );
       
  5062         
       
  5063         menuPane = AknLayoutScalable_Avkon::list_menu_pane( 0 ).LayoutLine();
       
  5064         menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), menuPane );
       
  5065         menuSctRect = menuPaneRect.Rect();
       
  5066         }
  4015         }
  5067     TRect cascadeMenuRect(0,0,0,0);
  4016     TRect cascadeMenuRect(0,0,0,0);
  5068 
  4017 
  5069     // Y coordinate for pointer event
  4018     // Y coordinate for pointer event
  5070     const TInt yPos = aPointerEvent.iPosition.iY;
  4019     const TInt yPos = aPointerEvent.iPosition.iY;
  5087 
  4036 
  5088 
  4037 
  5089     // if submenu, then move it's rect coordinates to relative to parent.
  4038     // if submenu, then move it's rect coordinates to relative to parent.
  5090     if ( iCascadeMenuPane  )
  4039     if ( iCascadeMenuPane  )
  5091         {
  4040         {
  5092         TPoint subPos = iCascadeMenuPane->PositionRelativeToScreen();
  4041         TPoint subPos = iCascadeMenuPane->Position();
  5093         cascadeMenuRect = TRect(subPos-PositionRelativeToScreen(), iCascadeMenuPane->Size());
  4042         cascadeMenuRect = TRect(subPos-Position(), iCascadeMenuPane->Size());
  5094         }
  4043         }
  5095 
  4044 
  5096     // Pointerevent in case we need to pass event from submenu to parent
  4045     // Pointerevent in case we need to pass event from submenu to parent
  5097     TPointerEvent parentEvent;   
  4046     TPointerEvent parentEvent;   
  5098 
  4047 
  5101         {
  4050         {
  5102         iExtension->StopCascadeMenuTimer();
  4051         iExtension->StopCascadeMenuTimer();
  5103         iExtension->ResetPressedHighlight();
  4052         iExtension->ResetPressedHighlight();
  5104         }
  4053         }
  5105 
  4054 
  5106 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  5107     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal(
       
  5108                                                             iExtension->iGc );
       
  5109     TBool effects = transApi && !transApi->EffectsDisabled();
       
  5110 #endif
       
  5111 
       
  5112     switch (aPointerEvent.iType )
  4055     switch (aPointerEvent.iType )
  5113         {
  4056         {
  5114         case TPointerEvent::EButton1Up:
  4057         case TPointerEvent::EButton1Up:
  5115             {
  4058             {
  5116             _AKNTRACE( "[%s]", "TPointerEvent::EButton1Up" );
  4059             _AKNTRACE( "[%s]", "TPointerEvent::EButton1Up" );
  5117             if ( !innerRect.Contains( aPointerEvent.iPosition ) ) 
  4060             if ( !innerRect.Contains( aPointerEvent.iPosition ) ) 
  5118                 {
  4061                 {
       
  4062                 TBool highlightWasEnabled = iExtension->HighlightEnabled();
  5119                 // remove highlight in case highlight is outside of menu pane 
  4063                 // remove highlight in case highlight is outside of menu pane 
  5120                 iExtension->EnableHighlight( EFalse );
  4064                 iExtension->EnableHighlight( EFalse );
  5121                 if ( iOwner )
  4065                 if ( iOwner )
  5122                     {
  4066                     {
  5123                     RepaintHighlight();
  4067                     RepaintHighlight();
  5124                     }
  4068                     }
       
  4069                    else if ( highlightWasEnabled && !iCascadeMenuPane )
       
  4070                     {
       
  4071                     DrawItem( SelectedItem(), ENoHighlight );
       
  4072                     }
  5125                 } 
  4073                 } 
  5126             if ( iOwner && 
  4074             if ( iOwner && 
  5127                  !innerRect.Contains( aPointerEvent.iPosition ) && 
  4075                  !innerRect.Contains( aPointerEvent.iPosition ) && 
  5128                  !iExtension->iDownOnMenuArea )
  4076                  !iExtension->iDownOnMenuArea )
  5129                 {
  4077                 {
  5130                 iExtension->CalculateParentEvent( aPointerEvent, parentEvent);
  4078                 iExtension->CalculateParentEvent( aPointerEvent, parentEvent);
  5131                 _AKNTRACE( "[%s]", "HandlePointerEventL return 6" );
  4079                 _AKNTRACE( "[%s]", "HandlePointerEventL return 6" );
  5132                 _AKNTRACE_FUNC_EXIT;
  4080                 _AKNTRACE_FUNC_EXIT;
  5133                 return iOwner->HandlePointerEventL( parentEvent );
  4081                 return iOwner->HandlePointerEventL( parentEvent );
  5134                 }
  4082                 }
  5135             iExtension->iDownOnMenuArea = EFalse;
       
  5136 
  4083 
  5137             iExtension->iPanningActive = EFalse;
  4084             iExtension->iPanningActive = EFalse;
  5138             if ( !(iExtension->iSct &&  iExtension->iSct->Rect().Contains( iExtension->iStartPoint ) ) )
  4085             if ( !(iExtension->iSct &&  iExtension->iSct->Rect().Contains( iExtension->iStartPoint ) ) 
       
  4086                 && iExtension->iDownOnMenuArea )
  5139                 {
  4087                 {
  5140                 TPoint drag = iExtension->iStartPoint - aPointerEvent.iPosition;
  4088                 TPoint drag = iExtension->iStartPoint - aPointerEvent.iPosition;
  5141                 if ( iExtension->iPhysics->StartPhysics( 
  4089                 if ( iExtension->iPhysics->StartPhysics( 
  5142                     drag, iExtension->iStartTime ) )
  4090                     drag, iExtension->iStartTime ) )
  5143                     {
  4091                     {
  5144                     iExtension->iFlickActive = ETrue;
  4092                     iExtension->iFlickActive = ETrue;
  5145                     iExtension->ResetPressedHighlight();
  4093                     iExtension->ResetPressedHighlight();
  5146                     }
  4094                     }
  5147                 }
  4095                 }
       
  4096              iExtension->iDownOnMenuArea = EFalse;
  5148             if ( iExtension->HighlightTimerActive() &&
  4097             if ( iExtension->HighlightTimerActive() &&
  5149                  !iExtension->iPressedDown )
  4098                  !iExtension->iPressedDown )
  5150                 {
  4099                 {
  5151                 // Complete the timer here if it's still running
  4100                 // Complete the timer here if it's still running
  5152                 // when up event is received.
  4101                 // when up event is received.
  5223                          
  4172                          
  5224                             TryLaunchCascadeMenuL( *item );
  4173                             TryLaunchCascadeMenuL( *item );
  5225                             }
  4174                             }
  5226                         else if ( iExtension->iButtonDownItem == iSelectedItem )
  4175                         else if ( iExtension->iButtonDownItem == iSelectedItem )
  5227                             {
  4176                             {
  5228                             iExtension->ImmediateFeedback( ETouchFeedbackBasicItem,
  4177                             iExtension->ImmediateFeedback( ETouchFeedbackList,
  5229                                                            ETouchFeedbackVibra );
  4178                                                            ETouchFeedbackVibra );
  5230                             if( !IsCascadeMenuPane() )
  4179                             if( !IsCascadeMenuPane() )
  5231                                 {
  4180                                 {
  5232                                 // EFalse = don't stop transition if opening the cascade menu 
  4181                                 // EFalse = don't stop transition if opening the cascade menu 
  5233                                 // just report selection
  4182                                 // just report selection
  5279                 {
  4228                 {
  5280                 if ( iExtension->iFlickActive )
  4229                 if ( iExtension->iFlickActive )
  5281                     {
  4230                     {
  5282                     noSelection = ETrue;
  4231                     noSelection = ETrue;
  5283 					//when touch down during the flicking, play a basic list feedback
  4232 					//when touch down during the flicking, play a basic list feedback
  5284                     iExtension->ImmediateFeedback( ETouchFeedbackBasicItem );
  4233                     iExtension->ImmediateFeedback( ETouchFeedbackList );
  5285                     }
  4234                     }
  5286                 // stop physics for drag
  4235                 // stop physics for drag
  5287                 iExtension->iPhysics->StopPhysics();
  4236                 iExtension->iPhysics->StopPhysics();
  5288                 iExtension->iPhysics->ResetFriction();
  4237                 iExtension->iPhysics->ResetFriction();
  5289                 
  4238                 
  5306                 if ( iCascadeMenuPane )
  4255                 if ( iCascadeMenuPane )
  5307                     {
  4256                     {
  5308                     // if submenu, and clicked outside of it
  4257                     // if submenu, and clicked outside of it
  5309                     if ( !cascadeMenuRect.Contains( aPointerEvent.iPosition ) )
  4258                     if ( !cascadeMenuRect.Contains( aPointerEvent.iPosition ) )
  5310                         {
  4259                         {
  5311                         if( AknLayoutUtils::PenEnabled() )
  4260                         if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) )
  5312                             {                            
  4261                             {
  5313                             if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) )
  4262                             iExtension->ImmediateFeedback( ETouchFeedbackSubMenuClosed );
  5314                                 {
  4263                             }
  5315                                 iExtension->ImmediateFeedback( ETouchFeedbackPopupClose );
  4264                         else
  5316                                 }
  4265                             {
  5317                             else
  4266                             iExtension->ImmediateFeedback( ETouchFeedbackPopUp );
  5318                                 {
       
  5319                                 iExtension->ImmediateFeedback( ETouchFeedbackPopUp );
       
  5320                                 }
       
  5321                             }
  4267                             }
  5322                         //Just close sub menu
  4268                         //Just close sub menu
  5323                         iExtension->iShowCascadeTransition = ETrue;
  4269                         iExtension->iShowCascadeTransition = ETrue;
  5324                         CloseCascadeMenu();
  4270                         CloseCascadeMenu();
  5325                         iExtension->EnableHighlight( EFalse );
  4271                         // Submenu of submenu was closed
  5326                         RepaintHighlight();
  4272                         if ( iCascadeMenuPane  )
       
  4273                             {
       
  4274                             iCascadeMenuPane->iExtension->EnableHighlight( EFalse );
       
  4275                             iCascadeMenuPane->RepaintHighlight();
       
  4276                             iExtension->iDownOnMenuArea = EFalse;
       
  4277                             }
       
  4278                         else
       
  4279                             {
       
  4280                             iExtension->EnableHighlight( EFalse );
       
  4281                             RepaintHighlight();            
       
  4282                             }
  5327                         IgnoreEventsUntilNextPointerUp();                                                                  
  4283                         IgnoreEventsUntilNextPointerUp();                                                                  
  5328                         break;
  4284                         break;
  5329                         }
  4285                         }
  5330                     }
  4286                     }
  5331                 else
  4287                 else
  5354                                     // from sct to normal menu item
  4310                                     // from sct to normal menu item
  5355                                     iExtension->iSctHighlighted = EFalse;
  4311                                     iExtension->iSctHighlighted = EFalse;
  5356                                     iExtension->iSct->HighlightSctRow( iExtension->iSctHighlighted );
  4312                                     iExtension->iSct->HighlightSctRow( iExtension->iSctHighlighted );
  5357                                     }
  4313                                     }
  5358 
  4314 
  5359 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  5360                                 if ( effects )
       
  5361                                     {
       
  5362                                     transApi->SetMoveType( MAknListBoxTfxInternal::EListTap );
       
  5363                                     }
       
  5364 #endif
       
  5365                                 iExtension->iPressedDown = ETrue;
  4315                                 iExtension->iPressedDown = ETrue;
  5366 
  4316 
  5367                                 // Start timer for pressed highlight
  4317                                 // Start timer for pressed highlight
  5368                                 if ( !noSelection )
  4318                                 if ( !noSelection )
  5369                                     {
  4319                                     {
  5370                                     iExtension->ImmediateFeedback( ETouchFeedbackBasicItem );
  4320                                     iExtension->ImmediateFeedback( ETouchFeedbackList );
  5371                                     iExtension->StartHighlightTimerL();
  4321                                     iExtension->StartHighlightTimerL();
  5372                                     }
  4322                                     }
  5373                                 iExtension->iNextHighlightItem = ii;
  4323                                 iExtension->iNextHighlightItem = ii;
  5374                                 iExtension->iButtonDownItem = ii;
  4324                                 iExtension->iButtonDownItem = ii;
  5375                                 
  4325                                 
  5376                                 // down even on already highlighted item => list feedback
  4326                                 // down even on already highlighted item => list feedback
  5377                                 if ( iExtension->iButtonDownItem == iSelectedItem )
  4327                                 if ( iExtension->iButtonDownItem == iSelectedItem )
  5378                                     {
  4328                                     {
  5379                                     iExtension->ImmediateFeedback( ETouchFeedbackBasicItem );
  4329                                     iExtension->ImmediateFeedback( ETouchFeedbackList );
  5380                                     }
  4330                                     }
  5381                                 if ( noSelection )
  4331                                 if ( noSelection )
  5382                                     {
  4332                                     {
  5383                                     iExtension->iButtonDownItem = KErrNotFound;
  4333                                     iExtension->iButtonDownItem = KErrNotFound;
  5384                                     }
  4334                                     }
  5385 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  4335 
  5386                                 if ( effects )
       
  5387                                     {
       
  5388                                     transApi->Draw( Rect() );
       
  5389                                     }
       
  5390 #endif
       
  5391                                 // if new item has submenu, show it
  4336                                 // if new item has submenu, show it
  5392                                 if ( item->iData.iCascadeId )
  4337                                 if ( item->iData.iCascadeId )
  5393                                     {
  4338                                     {
  5394                                     if ( !iExtension->IsCascadeMenuTimerActive() )
  4339                                     if ( !iExtension->IsCascadeMenuTimerActive() )
  5395                                         {
  4340                                         {
  5404                     }
  4349                     }
  5405                 }
  4350                 }
  5406             else
  4351             else
  5407                 {
  4352                 {
  5408                 // Clicked out side submenu, parent handles this
  4353                 // Clicked out side submenu, parent handles this
       
  4354                 iExtension->iDownOnMenuArea = EFalse;
  5409                 if ( iOwner )
  4355                 if ( iOwner )
  5410                     {
  4356                     {
  5411                     iExtension->CalculateParentEvent(aPointerEvent, parentEvent);                                        
  4357                     iExtension->CalculateParentEvent(aPointerEvent, parentEvent);                                        
  5412                     _AKNTRACE( "[%s]", "HandlePointerEventL return 12" );
  4358                     _AKNTRACE( "[%s]", "HandlePointerEventL return 12" );
  5413                     _AKNTRACE_FUNC_EXIT;
  4359                     _AKNTRACE_FUNC_EXIT;
  5414                     return iOwner->HandlePointerEventL( parentEvent );
  4360                     return iOwner->HandlePointerEventL( parentEvent );
  5415                     }
  4361                     }
  5416                 else
  4362                 else
  5417                     {
  4363                     {
  5418                     if ( iExtension->iIsPenEnable ) 
  4364                     // For finger usability, extend to the right.
       
  4365                     TRect innerToRightRect;
       
  4366                     if ( AknLayoutUtils::LayoutMirrored() )
  5419                         {
  4367                         {
  5420                         // For finger usability, extend to the right.
  4368                         innerToRightRect = TRect( Rect().iTl, innerRect.iBr );
  5421                         TRect innerToRightRect;
  4369                         }
  5422                         if ( AknLayoutUtils::LayoutMirrored() )
  4370                     else
       
  4371                         {
       
  4372                         innerToRightRect = TRect( innerRect.iTl, Rect().iBr );
       
  4373                         }
       
  4374                     // Keep opened
       
  4375                     if ( innerToRightRect.Contains( aPointerEvent.iPosition ) ) 
       
  4376                         {
       
  4377                         break;
       
  4378                         }
       
  4379 
       
  4380                     // clicked outside, then close menu case by case
       
  4381                     if ( iCascadeMenuPane )
       
  4382                         {
       
  4383                         if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) )
  5423                             {
  4384                             {
  5424                             innerToRightRect = TRect( Rect().iTl, innerRect.iBr );
  4385                             iExtension->ImmediateFeedback( ETouchFeedbackSubMenuClosed );
  5425                             }
  4386                             }
  5426                         else
  4387                         else
  5427                             {
  4388                             {
  5428                             innerToRightRect = TRect( innerRect.iTl, Rect().iBr );
  4389                             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( ETouchFeedbackPopupClose );
       
  5444                                 }
       
  5445                             else
       
  5446                                 {
       
  5447                                 iExtension->ImmediateFeedback( ETouchFeedbackPopUp );
       
  5448                                 }
       
  5449                             }
  4390                             }
  5450                         iExtension->iShowCascadeTransition = ETrue;
  4391                         iExtension->iShowCascadeTransition = ETrue;
  5451                         CloseCascadeMenu(); //Just close sub menu.
  4392                         CloseCascadeMenu(); //Just close sub menu.
  5452                         iExtension->EnableHighlight( EFalse );
  4393                         // Submenu of submenu was closed
  5453                         RepaintHighlight();
  4394                         if ( iCascadeMenuPane  )
       
  4395                             {
       
  4396                             iCascadeMenuPane->iExtension->EnableHighlight( EFalse );
       
  4397                             iCascadeMenuPane->RepaintHighlight();
       
  4398                             }
       
  4399                         else
       
  4400                             {
       
  4401                             iExtension->EnableHighlight( EFalse );
       
  4402                             RepaintHighlight();                        
       
  4403                             }
  5454                         IgnoreEventsUntilNextPointerUp();
  4404                         IgnoreEventsUntilNextPointerUp();
  5455                         }
  4405                         }
  5456                     else
  4406                     else
  5457                         {
  4407                         {
  5458                         ReportCanceled();   //Close main menu.
  4408                         _AKNTRACE( "[%s]", "HandlePointerEventL return 12.5" );
       
  4409                         _AKNTRACE_FUNC_EXIT;                   
       
  4410                         return;
  5459                         }
  4411                         }
  5460                     }
  4412                     }
  5461                 }
  4413                 }
  5462 
  4414 
  5463             }
  4415             }
  5485             	}
  4437             	}
  5486             
  4438             
  5487             TPoint drag = iExtension->iStartPoint - 
  4439             TPoint drag = iExtension->iStartPoint - 
  5488                 aPointerEvent.iPosition;
  4440                 aPointerEvent.iPosition;
  5489             TInt threshold = drag.iY;      
  4441             TInt threshold = drag.iY;      
  5490             if( Abs( threshold ) > iExtension->iPhysics->DragThreshold() )
  4442             if( Abs( threshold ) > iExtension->iPhysics->DragThreshold() 
  5491                 {
  4443                 && iExtension->iDownOnMenuArea )
       
  4444                 {
       
  4445                 iExtension->EnableHighlight( EFalse );
  5492                 iExtension->iButtonDownItem = KErrNotFound;
  4446                 iExtension->iButtonDownItem = KErrNotFound;
  5493                 iExtension->ResetPressedHighlight();
  4447                 iExtension->ResetPressedHighlight();
  5494                 iExtension->iNextHighlightItem = KErrNotFound;
  4448                 iExtension->iNextHighlightItem = KErrNotFound;
  5495                 iExtension->iPanningActive = ETrue;
  4449                 iExtension->iPanningActive = ETrue;
  5496                 iExtension->EnableHighlight( EFalse );
       
  5497 
       
  5498 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  5499                 MAknListBoxTfx* tfxApi = CAknListLoader::TfxApi( iExtension->iGc );
       
  5500 
       
  5501                 if ( tfxApi )
       
  5502                     {
       
  5503                     tfxApi->EnableEffects( EFalse );
       
  5504                     }
       
  5505 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  5506                 }    
  4450                 }    
  5507                          
  4451                          
  5508             if ( iExtension->iPanningActive )
  4452             if ( iExtension->iPanningActive && iExtension->iDownOnMenuArea )
  5509                 {
  4453                 {
  5510                 TPoint delta( 
  4454                 TPoint delta( 
  5511                     0, iExtension->iPrevPoint.iY - aPointerEvent.iPosition.iY );
  4455                     0, iExtension->iPrevPoint.iY - aPointerEvent.iPosition.iY );
  5512                 iExtension->iPhysics->RegisterPanningPosition( delta );
  4456                 iExtension->iPhysics->RegisterPanningPosition( delta );
  5513                 } 
  4457                 } 
  5522                 iExtension->ResetPressedHighlight();
  4466                 iExtension->ResetPressedHighlight();
  5523                 }
  4467                 }
  5524        
  4468        
  5525             // act in Menu Sct or Option Menu repectively
  4469             // act in Menu Sct or Option Menu repectively
  5526             if (( iExtension->iSct && menuSctRect.Contains(aPointerEvent.iPosition)) ||
  4470             if (( iExtension->iSct && menuSctRect.Contains(aPointerEvent.iPosition)) ||
  5527                 ( !iExtension->iSct && innerRect.Contains(aPointerEvent.iPosition)))
  4471                 ( !iExtension->iSct && innerRect.Contains(aPointerEvent.iPosition)) &&
       
  4472                 iExtension->iDownOnMenuArea ) 
  5528                {
  4473                {
  5529                 iExtension->iDraggedOutside = EFalse;
  4474                 iExtension->iDraggedOutside = EFalse;
  5530                 // Scroll only through visible items
  4475                 // Scroll only through visible items
  5531                 for ( TInt ii = topItem; ii < bottomItem; ++ii )
  4476                 for ( TInt ii = topItem; ii < bottomItem; ++ii )
  5532                     {
  4477                     {
  5541                             // if submenu open and touched item is not the one which opened submenu, then close submenu
  4486                             // if submenu open and touched item is not the one which opened submenu, then close submenu
  5542                             if ( (ii != iSelectedItem)
  4487                             if ( (ii != iSelectedItem)
  5543                                     && !cascadeMenuRect.Contains(
  4488                                     && !cascadeMenuRect.Contains(
  5544                                             aPointerEvent.iPosition ) )
  4489                                             aPointerEvent.iPosition ) )
  5545                                 {
  4490                                 {
  5546                                 if ( AknLayoutUtils::PenEnabled() )
  4491                                 if ( CAknTransitionUtils::TransitionsEnabled(
       
  4492                                         AknTransEffect::EComponentTransitionsOff ) )
  5547                                     {
  4493                                     {
  5548                                     if ( CAknTransitionUtils::TransitionsEnabled(
  4494                                     iExtension->ImmediateFeedback(
  5549                                             AknTransEffect::EComponentTransitionsOff ) )
  4495                                             ETouchFeedbackSubMenuClosed );
  5550                                         {
  4496                                     }
  5551                                         iExtension->ImmediateFeedback(
  4497                                 else
  5552                                                 ETouchFeedbackPopupClose );
  4498                                     {
  5553                                         }
  4499                                     iExtension->ImmediateFeedback(
  5554                                     else
  4500                                             ETouchFeedbackPopUp );
  5555                                         {
       
  5556                                         iExtension->ImmediateFeedback(
       
  5557                                                 ETouchFeedbackPopUp );
       
  5558                                         }
       
  5559                                     }
  4501                                     }
  5560                                 iExtension->iShowCascadeTransition = ETrue;
  4502                                 iExtension->iShowCascadeTransition = ETrue;
  5561                                 CloseCascadeMenu();
  4503                                 CloseCascadeMenu();
  5562                                 }
  4504                                 }
  5563                             }
       
  5564                         else
       
  5565                             {
       
  5566                             TInt oldSelected = iSelectedItem;
       
  5567                             // update highlight to new item
       
  5568                             if ( oldSelected != ii )
       
  5569                                 {
       
  5570                                 iExtension->iPressedDown = EFalse;
       
  5571 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  5572                                 if ( effects
       
  5573                                         && !iExtension->iShowCascadeTransition )
       
  5574                                     {
       
  5575                                     transApi->SetMoveType(
       
  5576                                             MAknListBoxTfxInternal::EListDrag );
       
  5577                                     }
       
  5578 #endif
       
  5579                                 }
       
  5580                             TRect screenRect( TPoint( KMinTInt, KMinTInt ),
       
  5581                                     TPoint( KMaxTInt, KMaxTInt ) );
       
  5582                             TRect repeatRect( screenRect.iTl.iX, item->iPos,
       
  5583                                     screenRect.iBr.iX, item->iPos
       
  5584                                             + iItemHeight );
       
  5585                             }
  4505                             }
  5586                         // item found, break                      
  4506                         // item found, break                      
  5587                         break;
  4507                         break;
  5588                         }
  4508                         }
  5589                     }
  4509                     }
  5816 // -----------------------------------------------------------------------------
  4736 // -----------------------------------------------------------------------------
  5817 //
  4737 //
  5818 EXPORT_C void CEikMenuPane::SetSelectedItem( TInt aSelectedItem )
  4738 EXPORT_C void CEikMenuPane::SetSelectedItem( TInt aSelectedItem )
  5819     {
  4739     {
  5820     iSelectedItem = (aSelectedItem >= NumberOfItemsInPane() ) ? 0 : aSelectedItem;
  4740     iSelectedItem = (aSelectedItem >= NumberOfItemsInPane() ) ? 0 : aSelectedItem;
  5821 
       
  5822     if( iExtension )
       
  5823         iExtension->ChangeHighlightBackground();
       
  5824     }
  4741     }
  5825 
  4742 
  5826 // -----------------------------------------------------------------------------
  4743 // -----------------------------------------------------------------------------
  5827 // CEikMenuPane::SelectedItem
  4744 // CEikMenuPane::SelectedItem
  5828 // -----------------------------------------------------------------------------
  4745 // -----------------------------------------------------------------------------
  5914 //----------------------------------------------------------------------------
  4831 //----------------------------------------------------------------------------
  5915 //
  4832 //
  5916 void CEikMenuPane::HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType )
  4833 void CEikMenuPane::HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType )
  5917     {
  4834     {
  5918     _AKNTRACE_FUNC_ENTER;
  4835     _AKNTRACE_FUNC_ENTER;
  5919     if( !AknLayoutUtils::PenEnabled())
       
  5920         {
       
  5921         return;
       
  5922         }
       
  5923 
  4836 
  5924     _AKNTRACE( "[%s]", "Stop physics engine");
  4837     _AKNTRACE( "[%s]", "Stop physics engine");
  5925     iExtension->iPhysics->StopPhysics();
  4838     iExtension->iPhysics->StopPhysics();
  5926     iExtension->iPhysics->ResetFriction();
  4839     iExtension->iPhysics->ResetFriction();
  5927 
  4840 
  5965         }
  4878         }
  5966 
  4879 
  5967     // Items that becomes topmost and downmost items
  4880     // Items that becomes topmost and downmost items
  5968     TInt newTopItem = 0;
  4881     TInt newTopItem = 0;
  5969 
  4882 
  5970 
       
  5971     // if update is not wanted, do nothing.
  4883     // if update is not wanted, do nothing.
  5972     if ( update )
  4884     if ( update )
  5973         {
  4885         {
  5974 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  5975         MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal(
       
  5976                 iExtension->iGc );
       
  5977         TBool effects = transApi && !transApi->EffectsDisabled();
       
  5978 #endif
       
  5979 
       
  5980         switch (aEventType)
  4886         switch (aEventType)
  5981             {
  4887             {
  5982             case EEikScrollUp:
  4888             case EEikScrollUp:
  5983                 {
  4889                 {
  5984                 _AKNTRACE( "[%s]", "EEikScrollUp");
  4890                 _AKNTRACE( "[%s]", "EEikScrollUp");
  6036 
  4942 
  6037             case EEikScrollPageDown:
  4943             case EEikScrollPageDown:
  6038                 {
  4944                 {
  6039                 _AKNTRACE( "[%s]", "EEikScrollPageDown");
  4945                 _AKNTRACE( "[%s]", "EEikScrollPageDown");
  6040                 _AKNTRACE( "bottomItem = %d", bottomItem);
  4946                 _AKNTRACE( "bottomItem = %d", bottomItem);
  6041                 // if last item is not visible
  4947                 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);
  4948                 _AKNTRACE( "update = %d", update);
  6053                 }
  4949                 }
  6054                 break;
  4950                 break;
  6055 
  4951 
  6056             case EEikScrollThumbDragVert:
  4952             case EEikScrollThumbDragVert:
  6057                 {
  4953                 {
  6058                 _AKNTRACE( "[%s]", "EEikScrollThumbDragVert");
  4954                 _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
  4955                 // new thumb position
  6073                 TInt thumb = aScrollBar->ThumbPosition();
  4956                 TInt thumb = aScrollBar->ThumbPosition();
  6074                 _AKNTRACE( "thumb = %d", thumb);
  4957                 _AKNTRACE( "thumb = %d", thumb);
  6075 
  4958                 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);
  4959                 _AKNTRACE( "update = %d", update);
  6087                 }
  4960                 }
  6088                 break;
  4961                 break;
  6089 
  4962 
  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:
  4963             default:
  6104                 update = EFalse;
  4964                 update = EFalse;
  6105                 break;
  4965                 break;
  6106             }
  4966             }
  6107 
  4967 
  6108         // if topItem changed, then draw menu again.
  4968         // if topItem changed, then draw menu again.
  6109         if ( newTopItem != topItem )
  4969         if ( newTopItem != topItem || update )
  6110             {
  4970             {
  6111 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  4971             iExtension->iListTopIndex = aScrollBar->ThumbPosition();
  6112             if ( effects )
  4972             TPoint newPosition( iExtension->iViewPosition.iX,
  6113                 {
  4973                     iExtension->iListTopIndex + iExtension->iViewHeight / 2 );
  6114                 transApi->SetMoveType( newTopItem > topItem ?
       
  6115                     MAknListBoxTfxInternal::EListScrollDown :
       
  6116                     MAknListBoxTfxInternal::EListScrollUp );
       
  6117                 }
       
  6118 #endif
       
  6119 
       
  6120             
  4974             
  6121             iExtension->iListTopIndex = aScrollBar->ThumbPosition();
  4975             iExtension->iFlags.Set( CEikMenuPaneExtension::ESkipScrollbarUpdate );
  6122                            
  4976             iExtension->ViewPositionChanged( newPosition );
  6123             iExtension->iViewPosition.iY = 
  4977             iExtension->iFlags.Clear( CEikMenuPaneExtension::ESkipScrollbarUpdate );
  6124                 iExtension->iListTopIndex + iExtension->iViewHeight / 2;              
       
  6125                           
       
  6126             iExtension->ViewPositionChanged( iExtension->iViewPosition );
       
  6127 
       
  6128             }
  4978             }
  6129         }
  4979         }
  6130     _AKNTRACE_FUNC_EXIT;
  4980     _AKNTRACE_FUNC_EXIT;
  6131     }
  4981     }
       
  4982 
  6132 
  4983 
  6133 // -----------------------------------------------------------------------------
  4984 // -----------------------------------------------------------------------------
  6134 // CEikMenuPane::CreateScrollBarFrame
  4985 // CEikMenuPane::CreateScrollBarFrame
  6135 // -----------------------------------------------------------------------------
  4986 // -----------------------------------------------------------------------------
  6136 //
  4987 //
  6141     TRAPD( err,( iSBFrame = new(ELeave) CEikScrollBarFrame( this, iScroller, ETrue, ETrue ) ) );
  4992     TRAPD( err,( iSBFrame = new(ELeave) CEikScrollBarFrame( this, iScroller, ETrue, ETrue ) ) );
  6142     if ( !err )
  4993     if ( !err )
  6143         {
  4994         {
  6144         CEikScrollBarFrame::TScrollBarVisibility visibility = CEikScrollBarFrame::EOn;
  4995         CEikScrollBarFrame::TScrollBarVisibility visibility = CEikScrollBarFrame::EOn;
  6145 
  4996 
  6146         if ( iOwner && ( iItemArray->Count() <= NumberOfItemsThatFitInView() ) )
  4997         if ( iItemArray->Count() <= NumberOfItemsThatFitInView() )
  6147             {
  4998             {
  6148             // submenu with less than 6 items
  4999             // all items fit, no need to show the scrollbar
  6149             visibility = CEikScrollBarFrame::EOff;
  5000             visibility = CEikScrollBarFrame::EOff;
  6150             }
  5001             }
  6151         TRAP_IGNORE( iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, visibility /*CEikScrollBarFrame::EAuto*/ ) );
  5002 
  6152 
  5003         TRAP_IGNORE( iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, visibility ) );
  6153         TRAP_IGNORE( iSBFrame->CreateDoubleSpanScrollBarsL( EFalse, EFalse, ETrue, EFalse ) );
  5004         TRAP_IGNORE( iSBFrame->CreateDoubleSpanScrollBarsL( EFalse, EFalse, ETrue, EFalse ) );
  6154         iSBFrame->DrawBackground( EFalse, EFalse );
  5005         iSBFrame->DrawBackground( EFalse, EFalse );
  6155         UpdateScrollBar();
  5006         UpdateScrollBar();
  6156         }
  5007         }
  6157     }
  5008     }
  6161 // CEikMenuPane::UpdateScrollBar
  5012 // CEikMenuPane::UpdateScrollBar
  6162 // -----------------------------------------------------------------------------
  5013 // -----------------------------------------------------------------------------
  6163 //
  5014 //
  6164 void CEikMenuPane::UpdateScrollBar()
  5015 void CEikMenuPane::UpdateScrollBar()
  6165     {
  5016     {
  6166     if ( !CheckCreateScroller() )
  5017     if ( !CheckCreateScroller() || !IsVisible() )
  6167         return;
  5018         return;
  6168     CIdle* idle = iScroller->Idle();
  5019     CIdle* idle = iScroller->Idle();
  6169     if ( idle && !idle->IsActive() )
  5020     if ( idle && !idle->IsActive() )
  6170         idle->Start( TCallBack( CEikMenuPane::UpdateScrollBarCallBackL, this ) );
  5021         idle->Start( TCallBack( CEikMenuPane::UpdateScrollBarCallBackL, this ) );
  6171     }
  5022     }
  6172 
  5023 
       
  5024 
  6173 // -----------------------------------------------------------------------------
  5025 // -----------------------------------------------------------------------------
  6174 // CEikMenuPane::UpdateScrollBarCallBackL
  5026 // CEikMenuPane::UpdateScrollBarCallBackL
  6175 // -----------------------------------------------------------------------------
  5027 // -----------------------------------------------------------------------------
  6176 //
  5028 //
  6177 TInt CEikMenuPane::UpdateScrollBarCallBackL( TAny* aObj )
  5029 TInt CEikMenuPane::UpdateScrollBarCallBackL( TAny* aObj )
  6178     { // static
  5030     { // static
  6179     REINTERPRET_CAST(CEikMenuPane*,aObj)->DoUpdateScrollBarL();
  5031     REINTERPRET_CAST(CEikMenuPane*,aObj)->DoUpdateScrollBarL();
  6180     return 0;
  5032     return 0;
  6181     }
  5033     }
       
  5034 
  6182 
  5035 
  6183 // -----------------------------------------------------------------------------
  5036 // -----------------------------------------------------------------------------
  6184 // CEikMenuPane::DoUpdateScrollBarL
  5037 // CEikMenuPane::DoUpdateScrollBarL
  6185 // -----------------------------------------------------------------------------
  5038 // -----------------------------------------------------------------------------
  6186 //
  5039 //
  6190         return;
  5043         return;
  6191     _AKNTRACE_FUNC_ENTER;
  5044     _AKNTRACE_FUNC_ENTER;
  6192     TEikScrollBarModel hSbarModel;
  5045     TEikScrollBarModel hSbarModel;
  6193     TEikScrollBarModel vSbarModel;
  5046     TEikScrollBarModel vSbarModel;
  6194 
  5047 
  6195     TRect menuPaneRect;
  5048     TRect clientRect( iExtension->iMenuPaneRect.Size() );
  6196     if ( !iOwner )
       
  6197         {
       
  6198         menuPaneRect = iExtension->iMenuPaneRect;    
       
  6199         }
       
  6200     else
       
  6201         {
       
  6202         menuPaneRect = Rect();    
       
  6203         }
       
  6204     
       
  6205     TRect clientRect( menuPaneRect.Size() ); 
       
  6206 
  5049 
  6207     // Panning uses pixel resolution scrollbar
  5050     // Panning uses pixel resolution scrollbar
  6208     vSbarModel.iThumbPosition = iExtension->iListTopIndex;      
  5051     vSbarModel.iThumbPosition = iExtension->iListTopIndex;      
  6209     vSbarModel.iScrollSpan = TotalItemHeight();
  5052     vSbarModel.iScrollSpan = TotalItemHeight();
  6210     vSbarModel.iThumbSpan = iExtension->iViewHeight;
  5053     vSbarModel.iThumbSpan = iExtension->iViewHeight;
  6219     TEikScrollBarFrameLayout layout;
  5062     TEikScrollBarFrameLayout layout;
  6220     layout.SetClientMargin( 0 );
  5063     layout.SetClientMargin( 0 );
  6221     layout.SetInclusiveMargin( 0 );
  5064     layout.SetInclusiveMargin( 0 );
  6222     layout.iTilingMode = TEikScrollBarFrameLayout::EClientRectConstant;
  5065     layout.iTilingMode = TEikScrollBarFrameLayout::EClientRectConstant;
  6223 
  5066 
  6224     // For main menupane scrollbar is always shown, for submenu only when needed
  5067     CEikScrollBarFrame::TScrollBarVisibility visibility = 
  6225     if ( !iOwner )
  5068             iSBFrame->ScrollBarVisibility( CEikScrollBar::EVertical );
  6226         {
  5069     
  6227         iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn );
  5070     // scrollbar is shown only if needed
  6228         }
  5071     if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOn 
  6229     else
  5072             && visibility == CEikScrollBarFrame::EOff )
  6230         {
  5073         {
  6231         TInt maxItems = NumberOfItemsThatFitInView();
  5074         iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, 
  6232         TInt count = iItemArray->Count();
  5075                 CEikScrollBarFrame::EOn );
  6233         iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
  5076         iExtension->iScrollBarRect = iSBFrame->VerticalScrollBar()->Rect();
  6234             (count > maxItems) ? CEikScrollBarFrame::EOn : CEikScrollBarFrame::EOff );
  5077         }
  6235         }
  5078     else if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOff 
  6236 
  5079             && visibility == CEikScrollBarFrame::EOn )
       
  5080         {
       
  5081         iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, 
       
  5082                 CEikScrollBarFrame::EOff );
       
  5083         iExtension->iScrollBarRect = TRect::EUninitialized;
       
  5084         }
       
  5085     
  6237     TAknLayoutRect scrollLayoutRect;
  5086     TAknLayoutRect scrollLayoutRect;
  6238     if ( !iOwner )
  5087     scrollLayoutRect.LayoutRect( clientRect, 
  6239         {
  5088             AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() );
  6240         TAknWindowLineLayout listScrollPaneLayout( 
  5089     scrollBarInclusiveRect = scrollLayoutRect.Rect();
  6241             AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() );
  5090     scrollBarClientRect = scrollBarInclusiveRect;
  6242         if ( iExtension )
  5091 
  6243             {
  5092     AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, scrollBarClientRect,
  6244             iExtension->AdjustPopupLayoutData( listScrollPaneLayout );
  5093       AknLayoutScalable_Avkon::scroll_pane_cp4().LayoutLine());
  6245             }
       
  6246         scrollLayoutRect.LayoutRect( clientRect, listScrollPaneLayout );
       
  6247         scrollBarInclusiveRect =  scrollLayoutRect.Rect();
       
  6248         scrollBarClientRect = scrollBarInclusiveRect;
       
  6249 
       
  6250         AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, scrollBarClientRect,
       
  6251             AknLayoutScalable_Avkon::scroll_pane_cp25(0).LayoutLine() );
       
  6252         }
       
  6253     else
       
  6254         {
       
  6255         scrollLayoutRect.LayoutRect( clientRect, 
       
  6256                 AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() );
       
  6257         scrollBarInclusiveRect = scrollLayoutRect.Rect();
       
  6258         scrollBarClientRect = scrollBarInclusiveRect;
       
  6259 
       
  6260         AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, scrollBarClientRect,
       
  6261           AknLayoutScalable_Avkon::scroll_pane_cp4().LayoutLine());
       
  6262         }
       
  6263 
  5094 
  6264     iSBFrame->TileL( &hDsSbarModel, &vDsSbarModel, scrollBarClientRect, scrollBarInclusiveRect, layout );
  5095     iSBFrame->TileL( &hDsSbarModel, &vDsSbarModel, scrollBarClientRect, scrollBarInclusiveRect, layout );
  6265     iSBFrame->SetVFocusPosToThumbPos( vDsSbarModel.FocusPosition() );
  5096     iSBFrame->SetVFocusPosToThumbPos( vDsSbarModel.FocusPosition() );
  6266     
       
  6267 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  6268     MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iExtension->iGc );
       
  6269     if ( iSBFrame->VerticalScrollBar() &&
       
  6270          iSBFrame->VScrollBarVisibility() == CEikScrollBarFrame::EOn )
       
  6271         {
       
  6272         iExtension->iScrollBarRect = iSBFrame->VerticalScrollBar()->Rect();
       
  6273         }
       
  6274     else
       
  6275         {
       
  6276         iExtension->iScrollBarRect = TRect::EUninitialized;
       
  6277         }
       
  6278     if ( transApi )
       
  6279         {
       
  6280         transApi->ResetNonDrawingRects();
       
  6281         transApi->AddNonDrawingRect( iExtension->iScrollBarRect );
       
  6282         transApi->AddNonDrawingRect( iExtension->iSctRect );
       
  6283         }
       
  6284 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
  6285     if ( iSBFrame->VerticalScrollBar() &&
       
  6286          iSBFrame->VScrollBarVisibility() == CEikScrollBarFrame::EOn )
       
  6287         {
       
  6288         iExtension->iSBRect = iSBFrame->VerticalScrollBar()->Rect();       
       
  6289         }
       
  6290     else
       
  6291         {
       
  6292         iExtension->iSBRect = TRect::EUninitialized;
       
  6293         }        
       
  6294     _AKNTRACE_FUNC_EXIT;
  5097     _AKNTRACE_FUNC_EXIT;
  6295     }
  5098     }
  6296 
  5099 
       
  5100 
  6297 // -----------------------------------------------------------------------------
  5101 // -----------------------------------------------------------------------------
  6298 // CEikMenuPane::UpdateScrollBarThumbs
  5102 // CEikMenuPane::UpdateScrollBarThumbs
  6299 // -----------------------------------------------------------------------------
  5103 // -----------------------------------------------------------------------------
  6300 //
  5104 //
  6301 void CEikMenuPane::UpdateScrollBarThumbs()
  5105 void CEikMenuPane::UpdateScrollBarThumbs()
  6303     if ( iSBFrame )
  5107     if ( iSBFrame )
  6304         {
  5108         {
  6305         iSBFrame->SetVFocusPosToThumbPos( iExtension->iListTopIndex );             
  5109         iSBFrame->SetVFocusPosToThumbPos( iExtension->iListTopIndex );             
  6306         }
  5110         }
  6307     }
  5111     }
       
  5112 
  6308 
  5113 
  6309 // -----------------------------------------------------------------------------
  5114 // -----------------------------------------------------------------------------
  6310 // CEikMenuPane::ScrollToMakeItemVisible
  5115 // CEikMenuPane::ScrollToMakeItemVisible
  6311 // -----------------------------------------------------------------------------
  5116 // -----------------------------------------------------------------------------
  6312 //
  5117 //
  6351             {
  5156             {
  6352             UpdateScrollBar();
  5157             UpdateScrollBar();
  6353             }
  5158             }
  6354         else
  5159         else
  6355             {
  5160             {
  6356             DoUpdateScrollBarL();
  5161             TRAP_IGNORE( DoUpdateScrollBarL() );
  6357             }        
  5162             }        
  6358         }
  5163         }
  6359     _AKNTRACE_FUNC_EXIT;
  5164     _AKNTRACE_FUNC_EXIT;
  6360     return;
  5165     return;
  6361     }
  5166     }
       
  5167 
  6362 
  5168 
  6363 // -----------------------------------------------------------------------------
  5169 // -----------------------------------------------------------------------------
  6364 // CEikMenuPane::Scroll
  5170 // CEikMenuPane::Scroll
  6365 // -----------------------------------------------------------------------------
  5171 // -----------------------------------------------------------------------------
  6366 //
  5172 //
  6386     newTop = Max( 0, newTop );
  5192     newTop = Max( 0, newTop );
  6387     newTop = Min( newTop, count - NumberOfItemsThatFitInView() );
  5193     newTop = Min( newTop, count - NumberOfItemsThatFitInView() );
  6388     iScroller->SetTopItemIndex( newTop );
  5194     iScroller->SetTopItemIndex( newTop );
  6389     _AKNTRACE( "newTop =  %d", newTop );
  5195     _AKNTRACE( "newTop =  %d", newTop );
  6390  
  5196  
  6391     // Menu moved with keys, update panning/flicking data
       
  6392     iExtension->iListTopIndex = iScroller->TopItemIndex() * iItemHeight;
  5197     iExtension->iListTopIndex = iScroller->TopItemIndex() * iItemHeight;
  6393     iExtension->iViewPosition.iY = 
  5198     TPoint newPosition( iExtension->iViewPosition );
  6394         iExtension->iListTopIndex + iExtension->iViewHeight / 2;  
  5199     newPosition.iY = iExtension->iListTopIndex + iExtension->iViewHeight / 2;  
  6395 
  5200 
  6396     iExtension->SetOffset( 0 );
  5201     iExtension->SetOffset( 0 );
  6397 
  5202     iExtension->ViewPositionChanged( newPosition );
       
  5203     
  6398     _AKNTRACE( "iExtension->iListTopIndex =  %d", iExtension->iListTopIndex );
  5204     _AKNTRACE( "iExtension->iListTopIndex =  %d", iExtension->iListTopIndex );
  6399     _AKNTRACE( "iExtension->iViewPosition.iY =  %d", iExtension->iViewPosition.iY );
  5205     _AKNTRACE( "iExtension->iViewPosition.iY =  %d", iExtension->iViewPosition.iY );
  6400     _AKNTRACE( "[%s]", "iExtension->SetOffset( 0 )" );
  5206     _AKNTRACE( "[%s]", "iExtension->SetOffset( 0 )" );
  6401 
  5207 
  6402     _AKNTRACE_FUNC_EXIT;
  5208     _AKNTRACE_FUNC_EXIT;
  6403     return;
  5209     return;
  6404     }
  5210     }
  6405 
  5211 
       
  5212 
  6406 // -----------------------------------------------------------------------------
  5213 // -----------------------------------------------------------------------------
  6407 // CEikMenuPane::ViewRect
  5214 // CEikMenuPane::ViewRect
  6408 // -----------------------------------------------------------------------------
  5215 // -----------------------------------------------------------------------------
  6409 //
  5216 //
  6410 TRect CEikMenuPane::ViewRect() const
  5217 TRect CEikMenuPane::ViewRect() const
  6411     {
  5218     {
  6412     return Rect();
  5219     return Rect();
  6413     }
  5220     }
       
  5221 
  6414 
  5222 
  6415 // -----------------------------------------------------------------------------
  5223 // -----------------------------------------------------------------------------
  6416 // CEikMenuPane::NumberOfItemsThatFitInView
  5224 // CEikMenuPane::NumberOfItemsThatFitInView
  6417 // -----------------------------------------------------------------------------
  5225 // -----------------------------------------------------------------------------
  6418 //
  5226 //
  6421     TInt subst = 0;
  5229     TInt subst = 0;
  6422     if ( iExtension->iSct )
  5230     if ( iExtension->iSct )
  6423         {
  5231         {
  6424         subst = 1;
  5232         subst = 1;
  6425         }
  5233         }
  6426 #ifdef RD_UI_TRANSITION_EFFECTS_LIST        
  5234 
  6427     iExtension->iItemsThatFitInView = iOwner ? AknLayoutScalable_Avkon::
  5235     iExtension->iItemsThatFitInView = iOwner ? AknLayoutScalable_Avkon::
  6428         list_single_popup_submenu_pane_ParamLimits().LastRow() + 1 :
  5236         list_single_popup_submenu_pane_ParamLimits().LastRow() + 1 :
  6429         AknLayoutScalable_Avkon::
  5237         AknLayoutScalable_Avkon::
  6430         list_single_pane_cp2_ParamLimits().LastRow() + 1 - subst;
  5238         list_single_pane_cp2_ParamLimits().LastRow() + 1 - subst;
  6431         if ( Layout_Meta_Data::IsLandscapeOrientation() 
  5239         if ( Layout_Meta_Data::IsLandscapeOrientation() 
  6432              && iExtension->iItemsThatFitInView == 6 )
  5240              && iExtension->iItemsThatFitInView == 6 )
  6433             {
  5241             {
  6434             iExtension->iItemsThatFitInView --;
  5242             iExtension->iItemsThatFitInView --;
  6435             }
  5243             }
  6436         
  5244         
  6437     if ( iExtension->iPhysics && iExtension->Offset() != 0 )
       
  6438         {
       
  6439         // with kinetic scrolling there can be partial items on the screen 
       
  6440         iExtension->iTotalNumberOfItemsInView = iExtension->iItemsThatFitInView + 1;
       
  6441         }
       
  6442         
       
  6443     return iExtension->iItemsThatFitInView;
  5245     return iExtension->iItemsThatFitInView;
  6444 #else
  5246     }
  6445     return iOwner ? AknLayoutScalable_Avkon::
  5247 
  6446         list_single_popup_submenu_pane_ParamLimits().LastRow() + 1 :
       
  6447         AknLayoutScalable_Avkon::
       
  6448         list_single_pane_cp2_ParamLimits().LastRow() + 1 - subst;
       
  6449 #endif
       
  6450     }
       
  6451 
  5248 
  6452 // -----------------------------------------------------------------------------
  5249 // -----------------------------------------------------------------------------
  6453 // CEikMenuPane::TotalItemHeight
  5250 // CEikMenuPane::TotalItemHeight
  6454 // -----------------------------------------------------------------------------
  5251 // -----------------------------------------------------------------------------
  6455 //
  5252 //
  6483         {
  5280         {
  6484         TRAP( err,( iScroller = CMenuScroller::NewL( *this ) ) );
  5281         TRAP( err,( iScroller = CMenuScroller::NewL( *this ) ) );
  6485         }
  5282         }
  6486     return err == KErrNone;
  5283     return err == KErrNone;
  6487     }
  5284     }
       
  5285 
  6488 
  5286 
  6489 // -----------------------------------------------------------------------------
  5287 // -----------------------------------------------------------------------------
  6490 // CEikMenuPane::CheckCreateScrollerL
  5288 // CEikMenuPane::CheckCreateScrollerL
  6491 // -----------------------------------------------------------------------------
  5289 // -----------------------------------------------------------------------------
  6492 //
  5290 //
  6594                 }
  5392                 }
  6595             
  5393             
  6596             TRect rect( CalculateSizeAndPosition() );
  5394             TRect rect( CalculateSizeAndPosition() );
  6597             SetExtent( rect.iTl, rect.Size() );
  5395             SetExtent( rect.iTl, rect.Size() );
  6598 
  5396 
  6599             TRAP_IGNORE( DoUpdateScrollBarL() );
       
  6600 
       
  6601             UpdateBackgroundContext( Rect() );
       
  6602             PrepareHighlightFrame();
       
  6603             SetCascadedIconSize();
       
  6604 
       
  6605             // Background under highlight may have changed -> we need to update
       
  6606             // highlight background to animation
       
  6607             if( iExtension )
       
  6608                 {
       
  6609                 iExtension->HandleLayoutSwitch();
       
  6610                 }
       
  6611                           
       
  6612 #ifdef RD_UI_TRANSITION_EFFECTS_LIST        
       
  6613             MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iExtension->iGc );
       
  6614             if ( transApi )
       
  6615                 {
       
  6616                 transApi->Remove( MAknListBoxTfxInternal:: EListEverything );
       
  6617                 }
       
  6618 #endif    
       
  6619             
       
  6620             //Initialize physics engine
  5397             //Initialize physics engine
  6621             if ( iExtension->iPhysics )
  5398             if ( iExtension->iPhysics )
  6622                 {
  5399                 {
  6623                 TRAP_IGNORE ( iExtension->InitPhysicsL() );
  5400                 TRAP_IGNORE ( iExtension->InitPhysicsL() );
  6624                 iExtension->iListTopIndex = iScroller->TopItemIndex() * iItemHeight;
  5401                 iExtension->iListTopIndex = iScroller->TopItemIndex() * iItemHeight;
  6625                 iExtension->iViewPosition.iY = 
  5402                 iExtension->iViewPosition.iY = 
  6626                             iExtension->iListTopIndex + iExtension->iViewHeight / 2;  
  5403                             iExtension->iListTopIndex + iExtension->iViewHeight / 2;  
  6627                 iExtension->ViewPositionChanged( iExtension->iViewPosition );
  5404                 }             
  6628                 } 
  5405          
  6629             
  5406             TRAP_IGNORE( DoUpdateScrollBarL() );
       
  5407 
       
  5408             UpdateBackgroundContext( Rect() );
       
  5409             PrepareHighlightFrame();
       
  5410             SetCascadedIconSize();
       
  5411             DrawDeferred();
  6630             if ( iCascadeMenuPane )
  5412             if ( iCascadeMenuPane )
  6631                 {
  5413                 {
  6632                 iCascadeMenuPane->HandleResourceChange( aType );
  5414                 iCascadeMenuPane->HandleResourceChange( aType );
  6633                 } 
  5415                 } 
  6634             
  5416             
  6653                     {
  5435                     {
  6654                     TPointerEvent pointerEvent = iExtension->iLastPointerEvent;                    
  5436                     TPointerEvent pointerEvent = iExtension->iLastPointerEvent;                    
  6655                     pointerEvent.iType = TPointerEvent::EButton1Up;
  5437                     pointerEvent.iType = TPointerEvent::EButton1Up;
  6656                     // Sending a up event to scroll bar for dehighlighting 
  5438                     // Sending a up event to scroll bar for dehighlighting 
  6657                     // the scroll bar.
  5439                     // the scroll bar.
  6658                     verScrollBar->HandlePointerEventL(pointerEvent);   
  5440                     TRAP_IGNORE ( verScrollBar->HandlePointerEventL(pointerEvent) );   
  6659                     iSBFrame->DrawScrollBarsDeferred();
  5441                     iSBFrame->DrawScrollBarsDeferred();
  6660                     ClaimPointerGrab( EFalse );
  5442                     ClaimPointerGrab( EFalse );
  6661                     }
  5443                     }
  6662                 }
  5444                 }
  6663             // Fixed for TSW error ELLI-7UG89S
  5445             // Fixed for TSW error ELLI-7UG89S
  6672                 }
  5454                 }
  6673             }
  5455             }
  6674         }
  5456         }
  6675     else if ( aType == KAknMessageFocusLost )
  5457     else if ( aType == KAknMessageFocusLost )
  6676         {
  5458         {
  6677         if ( iExtension && iExtension->HighlightEnabled() )
  5459         if ( iCascadeMenuPane )
       
  5460             {
       
  5461             iCascadeMenuPane->HandleResourceChange( aType );
       
  5462             }
       
  5463         else if ( iExtension && iExtension->HighlightEnabled() )
  6678             {
  5464             {
  6679             iExtension->EnableHighlight( EFalse, EFalse );
  5465             iExtension->EnableHighlight( EFalse, EFalse );
  6680             DrawItem( iSelectedItem, ENoHighlight );
  5466             DrawItem( iSelectedItem, ENoHighlight );
  6681             }
  5467             }
  6682         }
  5468         }
  6944     _AKNTRACE_FUNC_ENTER;
  5730     _AKNTRACE_FUNC_ENTER;
  6945     TRect retVal;
  5731     TRect retVal;
  6946 
  5732 
  6947     // it can be only in submenu in case when scalable layout is available
  5733     // it can be only in submenu in case when scalable layout is available
  6948     TBool hasIcon = MenuHasIcon();
  5734     TBool hasIcon = MenuHasIcon();
  6949     TBool hasDoubleSpanScrollBar = EFalse;
  5735 
  6950 
  5736     // scrollbar is shown only if needed
  6951     if ( iSBFrame && iSBFrame->VScrollBarVisibility() )
  5737     if ( iItemArray->Count() > NumberOfItemsThatFitInView() )
  6952         {
  5738         {
  6953         _AKNTRACE( "[%s]", "hasDoubleSpanScrollBar = ETrue;" );
  5739         iExtension->iScrollbarVisibility = CEikScrollBarFrame::EOn;
  6954         hasDoubleSpanScrollBar = ETrue;
  5740         }
  6955         }
  5741     else
  6956 
  5742         {
       
  5743         iExtension->iScrollbarVisibility = CEikScrollBarFrame::EOff;
       
  5744         }
       
  5745     
  6957     TRect parentMenuRect;
  5746     TRect parentMenuRect;
  6958     AknLayoutUtils::TAknCbaLocation cbaPosition = AknLayoutUtils::CbaLocation();    
  5747     AknLayoutUtils::TAknCbaLocation cbaPosition = AknLayoutUtils::CbaLocation();    
  6959                 
  5748                 
  6960     if ( !iOwner )
  5749     if ( !iOwner )
  6961         {
  5750         {
  7043 
  5832 
  7044     _AKNTRACE( "parentMenuRect.iTl.iX = %d", parentMenuRect.iTl.iX );
  5833     _AKNTRACE( "parentMenuRect.iTl.iX = %d", parentMenuRect.iTl.iX );
  7045     _AKNTRACE( "parentMenuRect.iTl.iY = %d", parentMenuRect.iTl.iY );
  5834     _AKNTRACE( "parentMenuRect.iTl.iY = %d", parentMenuRect.iTl.iY );
  7046     _AKNTRACE( "parentMenuRect.Width() = %d", parentMenuRect.Width() );
  5835     _AKNTRACE( "parentMenuRect.Width() = %d", parentMenuRect.Width() );
  7047     _AKNTRACE( "parentMenuRect.Height( = %d", parentMenuRect.Height() );
  5836     _AKNTRACE( "parentMenuRect.Height( = %d", parentMenuRect.Height() );
  7048     // if we have landscape layout then main menu should be positioned vertically centered
       
  7049     TRect appRect( iEikonEnv->EikAppUi()->ApplicationRect() );
       
  7050 
  5837 
  7051     if ( !iOwner ) // main menu
  5838     if ( !iOwner ) // main menu
  7052         {
  5839         {
  7053         // Embedded cba
  5840         // Embedded cba
  7054         TRect screen;
  5841         TRect screen;
  7064 
  5851 
  7065         // CEikMenuPane rect contains empty space. We want the popup content
  5852         // CEikMenuPane rect contains empty space. We want the popup content
  7066         // to be in correct place - so we calculate correct position for
  5853         // to be in correct place - so we calculate correct position for
  7067         // background and move control rect to match new background top left
  5854         // background and move control rect to match new background top left
  7068         // position.
  5855         // position.
  7069         TRect backgroundRect( iExtension->GetBackgroundRect( parentMenuRect ) );
       
  7070         TPoint backgroundRectPos( 
  5856         TPoint backgroundRectPos( 
  7071             AknPopupUtils::Position( backgroundRect.Size(), ETrue ) );
  5857             AknPopupUtils::Position( parentMenuRect.Size(), ETrue ) );
  7072         
  5858         
  7073         retVal = parentMenuRect;
  5859         retVal = parentMenuRect;
  7074         retVal.Move( backgroundRectPos - backgroundRect.iTl );
  5860         retVal.Move( backgroundRectPos - parentMenuRect.iTl );
  7075         
  5861         
  7076         // Set embedded cba rect
  5862         // Set embedded cba rect
  7077         if ( iExtension->iCba )
  5863         if ( iExtension->iCba )
  7078             {
  5864             {
  7079             // There is hidden extra touch space for scroll bar in landscape
  5865             // There is hidden extra touch space for scroll bar in landscape
  7080             TInt xOffset = backgroundRect.iTl.iX - parentMenuRect.iTl.iX ; 
  5866             TInt xOffset = parentMenuRect.iTl.iX - parentMenuRect.iTl.iX ; 
  7081             iExtension->iCba->SetRect( TRect( 
  5867             iExtension->iCba->SetRect( TRect( 
  7082                 xOffset,
  5868                 xOffset,
  7083                 menuRect.Height(),
  5869                 menuRect.Height(),
  7084                 backgroundRect.Width() + xOffset,
  5870                 parentMenuRect.Width() + xOffset,
  7085                 menuRect.Height() + cbaRect.Rect().Height() ) );
  5871                 menuRect.Height() + cbaRect.Rect().Height() ) );
  7086             }
  5872             }
  7087 
  5873 
  7088         iExtension->iMenuPaneRect = TRect( retVal.iTl, 
  5874         iExtension->iMenuPaneRect = TRect( retVal.iTl, 
  7089                                            TSize ( menuRect.Size() ) );
  5875                                            TSize ( menuRect.Size() ) );
  7090                                         
  5876 
       
  5877         TInt variety = 4;
       
  5878         
       
  5879         // reserve area for scrollbar only if it's shown
       
  5880         if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOn )
       
  5881             {
       
  5882             variety = 0;
       
  5883             }
       
  5884 
       
  5885         TAknLayoutRect layoutRect;
       
  5886         layoutRect.LayoutRect( TRect( iExtension->iMenuPaneRect.Size() ), 
       
  5887                 AknLayoutScalable_Avkon::listscroll_popup_sub_pane( 0 ) );
       
  5888         
       
  5889         iExtension->iMenuAreaRect = layoutRect.Rect();
       
  5890         
       
  5891         layoutRect.LayoutRect( iExtension->iMenuAreaRect,
       
  5892                 AknLayoutScalable_Avkon::list_menu_pane( variety ) );
       
  5893 
       
  5894         iExtension->iItemAreaRect = layoutRect.Rect();
       
  5895         
  7091         _AKNTRACE( "[%s]", "the layout of main menu return" );
  5896         _AKNTRACE( "[%s]", "the layout of main menu return" );
  7092         _AKNTRACE_FUNC_EXIT;                               
  5897         _AKNTRACE_FUNC_EXIT;                               
  7093         return retVal;
  5898         return retVal;
  7094         }
  5899         }
  7095 
  5900 
  7098     TInt parentCount = iOwner->iItemArray->Count(); // There must be at least one parent item for a submenu to have popped up.
  5903     TInt parentCount = iOwner->iItemArray->Count(); // There must be at least one parent item for a submenu to have popped up.
  7099 
  5904 
  7100     iExtension->iSubMenuWidthIndex = KAlternativeSubmenuWidths - 1;
  5905     iExtension->iSubMenuWidthIndex = KAlternativeSubmenuWidths - 1;
  7101 
  5906 
  7102     TAknLayoutRect parentListScrollLayoutRect;     // listscroll_menu_pane
  5907     TAknLayoutRect parentListScrollLayoutRect;     // listscroll_menu_pane
  7103     TAknLayoutRect parentPaneLayoutRect;           // list_menu_pane
       
  7104 
  5908 
  7105     TAknTextLineLayout subMenuText;                // layout for the text when item is not indicated
  5909     TAknTextLineLayout subMenuText;                // layout for the text when item is not indicated
  7106     TAknTextLineLayout subMenuIconText;            // layout for the text when item is indicated
  5910     TAknTextLineLayout subMenuIconText;            // layout for the text when item is indicated
  7107 
  5911 
  7108     TAknWindowLineLayout parentListScrollPaneLayout( 
  5912     TAknWindowLineLayout parentListScrollPaneLayout( 
  7109         AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() );
  5913         AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() );
  7110     if ( iExtension )
       
  7111         {
       
  7112         iExtension->AdjustPopupLayoutData( parentListScrollPaneLayout );
       
  7113         }    
       
  7114     parentListScrollLayoutRect.LayoutRect( parentMenuRect, parentListScrollPaneLayout );    
  5914     parentListScrollLayoutRect.LayoutRect( parentMenuRect, parentListScrollPaneLayout );    
  7115     parentPaneLayoutRect.LayoutRect( parentListScrollLayoutRect.Rect(),
       
  7116         AknLayoutScalable_Avkon::list_menu_pane(0).LayoutLine() );
       
  7117     subMenuText = AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1(0).LayoutLine();
  5915     subMenuText = AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1(0).LayoutLine();
  7118     subMenuIconText = AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1(1).LayoutLine();
  5916     subMenuIconText = AknLayoutScalable_Avkon::list_single_popup_submenu_pane_t1(1).LayoutLine();
  7119 
  5917 
  7120     // Choose correct submenu width
  5918     // Choose correct submenu width
  7121     // Find the narrowest layout that will accommodate the text
  5919     // Find the narrowest layout that will accommodate the text
  7134         textWidth = font->TextWidthInPixels( item->iData.iText );
  5932         textWidth = font->TextWidthInPixels( item->iData.iText );
  7135         maxTextWidth = Max( maxTextWidth, textWidth );
  5933         maxTextWidth = Max( maxTextWidth, textWidth );
  7136         }
  5934         }
  7137 
  5935 
  7138     // find the suitable item width, so that the text would be visible
  5936     // find the suitable item width, so that the text would be visible
       
  5937     TInt submenuVariety = 1;
       
  5938     
       
  5939     if ( iExtension->iScrollbarVisibility == CEikScrollBarFrame::EOn )
       
  5940         {
       
  5941         submenuVariety = 0;
       
  5942         }
       
  5943 
  7139     for ( ii = 6; ii < KAlternativeSubmenuWidths + 6; ++ii )
  5944     for ( ii = 6; ii < KAlternativeSubmenuWidths + 6; ++ii )
  7140         {
  5945         {
  7141         TAknWindowLineLayout submenuLayout( AknLayoutScalable_Avkon::popup_submenu_window( ii ).LayoutLine() );
  5946         TAknWindowLineLayout submenuLayout( AknLayoutScalable_Avkon::popup_submenu_window( ii ).LayoutLine() );
  7142         TAknLayoutRect submenuRect;
  5947         TAknLayoutRect submenuRect;
  7143         submenuRect.LayoutRect( parentListScrollLayoutRect.Rect(), submenuLayout );
  5948         submenuRect.LayoutRect( parentListScrollLayoutRect.Rect(), submenuLayout );
  7144 
  5949 
  7145         TAknWindowLineLayout listScrollPaneLayout( AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() );
  5950         TAknWindowLineLayout listScrollPaneLayout( AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() );
  7146         TAknLayoutRect listScrollPaneRect;
  5951         TAknLayoutRect listScrollPaneRect;
  7147         listScrollPaneRect.LayoutRect( submenuRect.Rect(), listScrollPaneLayout );
  5952         listScrollPaneRect.LayoutRect( submenuRect.Rect(), listScrollPaneLayout );
  7148 
  5953 
  7149         TAknWindowLineLayout listSubmenuPaneLayout( AknLayoutScalable_Avkon::list_submenu_pane( !hasDoubleSpanScrollBar ).LayoutLine() );
  5954         TAknWindowLineLayout listSubmenuPaneLayout( AknLayoutScalable_Avkon::list_submenu_pane( submenuVariety ).LayoutLine() );
  7150         TAknLayoutRect listSubmenuPaneRect;
  5955         TAknLayoutRect listSubmenuPaneRect;
  7151         listSubmenuPaneRect.LayoutRect( listScrollPaneRect.Rect(), listSubmenuPaneLayout );
  5956         listSubmenuPaneRect.LayoutRect( listScrollPaneRect.Rect(), listSubmenuPaneLayout );
  7152 
  5957 
  7153         TAknLayoutText textIconLayout;
  5958         TAknLayoutText textIconLayout;
  7154         textIconLayout.LayoutText( listSubmenuPaneRect.Rect(), subMenuIconText);
  5959         textIconLayout.LayoutText( listSubmenuPaneRect.Rect(), subMenuIconText);
  7176 
  5981 
  7177     // Position of submenu depends upon parent size and position of selected item. Position is 1 at bottom up to six at top
  5982     // Position of submenu depends upon parent size and position of selected item. Position is 1 at bottom up to six at top
  7178     TInt parentPos = iOwner->iScroller->TopItemIndex() - iOwner->SelectedItem() +
  5983     TInt parentPos = iOwner->iScroller->TopItemIndex() - iOwner->SelectedItem() +
  7179         Min( parentCount, iOwner->NumberOfItemsThatFitInView() );
  5984         Min( parentCount, iOwner->NumberOfItemsThatFitInView() );
  7180 
  5985 
  7181     TInt index =  iOwner->SelectedItem() - iOwner->iScroller->TopItemIndex();
  5986     TRect parentSelectedItemRect( iOwner->HighlightRect() );
  7182     TInt rows = AknLayoutScalable_Avkon::list_single_pane_cp2_ParamLimits().LastRow();
  5987     parentSelectedItemRect.Move( iOwner->Position() );
  7183 
       
  7184     // This condition may be true if less items fits to menu view than sub-menu view
       
  7185     // and sub-menu under sub-menu is launched.
       
  7186     if (index > rows)
       
  7187         {
       
  7188         // Change the out-of-boundary index to last legal one.
       
  7189         index = rows;
       
  7190         }
       
  7191 
       
  7192     TAknLayoutRect parentSelectedItemRect;
       
  7193     parentSelectedItemRect.LayoutRect( parentPaneLayoutRect.Rect(),
       
  7194         AknLayoutScalable_Avkon::list_single_pane_cp2( index ).LayoutLine() );
       
  7195 
  5988 
  7196     TAknLayoutRect submenuWindowRect;
  5989     TAknLayoutRect submenuWindowRect;
  7197     // To prevent a panic in layout code, count has to be at least 1 even if
  5990     // To prevent a panic in layout code, count has to be at least 1 even if
  7198     // submenu is empty. Otherwise the index is out of bounds.
  5991     // submenu is empty. Otherwise the index is out of bounds.
  7199     if ( count == 0 )
  5992     if ( count == 0 )
  7228     enum { EFloating, EBottom } subMenuPos;
  6021     enum { EFloating, EBottom } subMenuPos;
  7229 
  6022 
  7230     if ( ( Layout_Meta_Data::IsLandscapeOrientation()
  6023     if ( ( Layout_Meta_Data::IsLandscapeOrientation()
  7231         && cbaPosition != AknLayoutUtils::EAknCbaLocationBottom ) )
  6024         && cbaPosition != AknLayoutUtils::EAknCbaLocationBottom ) )
  7232         {
  6025         {
  7233         if ( ( parentSelectedItemRect.Rect().iTl.iY + submenuWindowRect.Rect().Height() ) >
  6026         if ( ( parentSelectedItemRect.iTl.iY + submenuWindowRect.Rect().Height() ) >
  7234                 aWindowRect.iBr.iY )
  6027                 aWindowRect.iBr.iY )
  7235             {
  6028             {
  7236             subMenuPos = EBottom;
  6029             subMenuPos = EBottom;
  7237             }
  6030             }
  7238         else
  6031         else
  7280                 TSize( submenuWindowRect.Rect().Width() + widthOffset, submenuWindowRect.Rect().Height() ) );
  6073                 TSize( submenuWindowRect.Rect().Width() + widthOffset, submenuWindowRect.Rect().Height() ) );
  7281             }
  6074             }
  7282         }
  6075         }
  7283     else  // floating
  6076     else  // floating
  7284         {
  6077         {
  7285         TInt yPos = parentSelectedItemRect.Rect().iTl.iY -
  6078         TInt yPos = parentSelectedItemRect.iTl.iY -
  7286             ( listScrollPaneRect.Rect().iTl.iY - submenuWindowRect.Rect().iTl.iY );
  6079             ( listScrollPaneRect.Rect().iTl.iY - submenuWindowRect.Rect().iTl.iY );
  7287 
  6080 
  7288         // When a submenu is floating, make sure that the possible panning offset of the
  6081         // When a submenu is floating, make sure that the possible panning offset of the
  7289         // parent menu is taken into account.
  6082         // parent menu is taken into account.
  7290         yPos += iOwner->iExtension->Offset();
  6083         yPos += iOwner->iExtension->Offset();
  7309             TInt offset = retVal.iBr.iY - 
  6102             TInt offset = retVal.iBr.iY - 
  7310                 iOwner->iExtension->iMenuPaneRect.iBr.iY;
  6103                 iOwner->iExtension->iMenuPaneRect.iBr.iY;
  7311             retVal.Move( 0, -offset );
  6104             retVal.Move( 0, -offset );
  7312             }
  6105             }
  7313         }
  6106         }
       
  6107     
       
  6108     if ( retVal.iTl.iY < 0 )
       
  6109         {
       
  6110         retVal.Move( 0, -retVal.iTl.iY );
       
  6111         }
       
  6112 
       
  6113     iExtension->iMenuPaneRect = retVal;
       
  6114 
       
  6115     TAknLayoutRect layoutRect;
       
  6116     layoutRect.LayoutRect( TRect( iExtension->iMenuPaneRect.Size() ), 
       
  6117             AknLayoutScalable_Avkon::listscroll_popup_sub_pane( 0 ) );
       
  6118     
       
  6119     iExtension->iMenuAreaRect = layoutRect.Rect();
       
  6120     
       
  6121     layoutRect.LayoutRect( iExtension->iMenuAreaRect,
       
  6122             AknLayoutScalable_Avkon::list_submenu_pane( submenuVariety ) );
       
  6123 
       
  6124     iExtension->iItemAreaRect = layoutRect.Rect();
       
  6125     
  7314     _AKNTRACE( "[%s]", "the layout of sub menu return" );
  6126     _AKNTRACE( "[%s]", "the layout of sub menu return" );
  7315     _AKNTRACE_FUNC_EXIT;  
  6127     _AKNTRACE_FUNC_EXIT;  
  7316     return retVal;
  6128     return retVal;
  7317     }
  6129     }
  7318 
  6130 
  7329     // TopItemIndex. Which results in negative index. This "fix" prevents from
  6141     // TopItemIndex. Which results in negative index. This "fix" prevents from
  7330     // crashing the menu.
  6142     // crashing the menu.
  7331     if( index < 0 )
  6143     if( index < 0 )
  7332         index = 0;
  6144         index = 0;
  7333 
  6145 
  7334     // It is possible that this method is called when iItemArray is NULL.  In
       
  7335     // that case we fake numItems as 1 to make layout code work.
       
  7336     TInt maxItems = NumberOfItemsThatFitInView();
       
  7337     TInt numItems = Min( Max( 1, iItemArray->Count() ), maxItems );
       
  7338     if( !iItemArray )
       
  7339         numItems = 1;
       
  7340     
       
  7341     // When physics is enabled highlight can be moved to partially visible
  6146     // When physics is enabled highlight can be moved to partially visible
  7342     // item which is at the bottom of menu. This causes layout panic and to 
  6147     // item which is at the bottom of menu. This causes layout panic and to 
  7343     // avoid that we reduce index by one.
  6148     // avoid that we reduce index by one.
  7344     if ( index == maxItems )
  6149     if ( index == NumberOfItemsThatFitInView() )
  7345         {
  6150         {
  7346         index--;
  6151         index--;
  7347         }
  6152         }
  7348    
  6153    
  7349     TRect windowRect = Rect();
  6154     return ItemRect( index );
  7350 
       
  7351     TAknWindowLineLayout menuPane( AKN_LAYOUT_WINDOW_list_menu_pane( 0 , 0 ) );
       
  7352     TAknWindowLineLayout singleMenuPane( AKN_LAYOUT_WINDOW_list_single_popup_menu_pane( index ) );
       
  7353     TAknLayoutRect menuPaneRect;
       
  7354     TAknLayoutRect singleMenuPaneRect;
       
  7355 
       
  7356     TBool hasDoubleSpanScrollBar = EFalse;
       
  7357 
       
  7358     if ( iSBFrame && iSBFrame->VScrollBarVisibility() )
       
  7359         {
       
  7360         hasDoubleSpanScrollBar = ETrue;
       
  7361         }
       
  7362 
       
  7363     if ( !iOwner )
       
  7364         {
       
  7365         TAknWindowLineLayout listScrollPaneLayout( 
       
  7366             AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine() );
       
  7367         if ( iExtension )
       
  7368             {
       
  7369             iExtension->AdjustPopupLayoutData( listScrollPaneLayout );
       
  7370             }                            
       
  7371         TAknLayoutRect listScrollPaneRect;
       
  7372         listScrollPaneRect.LayoutRect( windowRect, listScrollPaneLayout );
       
  7373 
       
  7374         menuPane = AknLayoutScalable_Avkon::list_menu_pane( 0 ).LayoutLine();
       
  7375         menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), menuPane );
       
  7376 
       
  7377         singleMenuPane = AknLayoutScalable_Avkon::list_single_pane_cp2( index ).LayoutLine();
       
  7378         singleMenuPaneRect.LayoutRect( menuPaneRect.Rect(), singleMenuPane );
       
  7379         }
       
  7380     else // Submenu
       
  7381         {
       
  7382         TAknWindowLineLayout listScrollPaneLayout( AknLayoutScalable_Avkon::listscroll_popup_sub_pane().LayoutLine() );
       
  7383         TAknLayoutRect listScrollPaneRect;
       
  7384         listScrollPaneRect.LayoutRect( windowRect, listScrollPaneLayout );
       
  7385 
       
  7386         menuPane = AknLayoutScalable_Avkon::list_submenu_pane( !hasDoubleSpanScrollBar ).LayoutLine();
       
  7387         menuPaneRect.LayoutRect( listScrollPaneRect.Rect(), menuPane );
       
  7388 
       
  7389         singleMenuPane = AknLayoutScalable_Avkon::list_single_popup_submenu_pane( index ).LayoutLine();
       
  7390         singleMenuPaneRect.LayoutRect( menuPaneRect.Rect(), singleMenuPane );
       
  7391         }
       
  7392 
       
  7393     // Compared to normal DrawItem the highlight rect step is omitted because
       
  7394     // it would shift the highlight towards left.
       
  7395 
       
  7396     return singleMenuPaneRect.Rect();
       
  7397     }
  6155     }
  7398 
  6156 
  7399 
  6157 
  7400 // -----------------------------------------------------------------------------
  6158 // -----------------------------------------------------------------------------
  7401 // CEikMenuPane::PrepareHighlightFrame
  6159 // CEikMenuPane::PrepareHighlightFrame
  7437 
  6195 
  7438     if( itemData )
  6196     if( itemData )
  7439         {
  6197         {
  7440         AknIconUtils::SetSize( itemData->Bitmap(),  cascadeRect.Rect().Size() );
  6198         AknIconUtils::SetSize( itemData->Bitmap(),  cascadeRect.Rect().Size() );
  7441         }
  6199         }
  7442 
       
  7443     else
  6200     else
  7444         {
  6201         {
  7445         if (iExtension->iCascadeBitmap)
  6202         if (iExtension->iCascadeBitmap)
  7446             {
  6203             {
  7447             AknIconUtils::SetSize( iExtension->iCascadeBitmap,  cascadeRect.Rect().Size() );
  6204             AknIconUtils::SetSize( iExtension->iCascadeBitmap,  cascadeRect.Rect().Size() );
  7480 // -----------------------------------------------------------------------------
  6237 // -----------------------------------------------------------------------------
  7481 //
  6238 //
  7482 EXPORT_C TInt CEikMenuPane::CountComponentControls() const
  6239 EXPORT_C TInt CEikMenuPane::CountComponentControls() const
  7483     {
  6240     {
  7484     TInt count = 0;
  6241     TInt count = 0;
  7485     if ( iSBFrame && iSBFrame->VerticalScrollBar() &&
  6242     if ( iSBFrame && iSBFrame->VerticalScrollBar() )
  7486                             !( iSBFrame->VerticalScrollBar()->OwnsWindow() ) )
       
  7487         {
  6243         {
  7488         count = 1;
  6244         count = 1;
  7489         }
  6245         }
  7490     if ( iExtension->iSct )
  6246     if ( iExtension->iSct )
  7491         {
  6247         {
  7508     {
  6264     {
  7509     switch ( aIndex)
  6265     switch ( aIndex)
  7510         {
  6266         {
  7511         case 0:
  6267         case 0:
  7512             {
  6268             {
  7513             if ( iSBFrame && iSBFrame->VerticalScrollBar() &&
  6269             if ( iSBFrame && iSBFrame->VerticalScrollBar() )
  7514                         !( iSBFrame->VerticalScrollBar()->OwnsWindow() ) )
       
  7515                 {
  6270                 {
  7516                 return iSBFrame->VerticalScrollBar();
  6271                 return iSBFrame->VerticalScrollBar();
  7517                 }
  6272                 }
  7518             }
  6273             }
  7519         case 1:
  6274         case 1:
  7552     __ASSERT_ALWAYS( iExtension, Panic( EEikPanicNullPointer ) );
  6307     __ASSERT_ALWAYS( iExtension, Panic( EEikPanicNullPointer ) );
  7553     return iExtension;
  6308     return iExtension;
  7554     }
  6309     }
  7555 
  6310 
  7556 
  6311 
       
  6312 // -----------------------------------------------------------------------------
       
  6313 // CEikMenuPane::CheckCreateExtensionL
       
  6314 // -----------------------------------------------------------------------------
       
  6315 //
  7557 void CEikMenuPane::CheckCreateExtensionL()
  6316 void CEikMenuPane::CheckCreateExtensionL()
  7558     {
  6317     {
  7559     if ( !iExtension )
  6318     if ( !iExtension )
  7560         {
  6319         {
  7561         iExtension = new (ELeave) CEikMenuPaneExtension;
  6320         iExtension = new (ELeave) CEikMenuPaneExtension;
  7562         iExtension->ConstructL( this );
  6321         iExtension->ConstructL( this );
  7563         }
  6322         }
       
  6323     }
       
  6324 
       
  6325 
       
  6326 // -----------------------------------------------------------------------------
       
  6327 // CEikMenuPane::ItemRect
       
  6328 // -----------------------------------------------------------------------------
       
  6329 //
       
  6330 TRect CEikMenuPane::ItemRect( TInt aItemIndex ) const
       
  6331     {
       
  6332     // this method is valid for the main menu only
       
  6333     TInt lastRow = AknLayoutScalable_Avkon::list_single_pane_cp2_ParamLimits().LastRow();
       
  6334     aItemIndex = Min( aItemIndex, lastRow );
       
  6335 
       
  6336     TAknLayoutRect layoutRect;
       
  6337     layoutRect.LayoutRect( iExtension->iItemAreaRect,
       
  6338             AknLayoutScalable_Avkon::list_single_pane_cp2( aItemIndex ) );
       
  6339             
       
  6340     return layoutRect.Rect();
       
  6341     }
       
  6342 
       
  6343 
       
  6344 // -----------------------------------------------------------------------------
       
  6345 // CEikMenuPane::CalculateItemHeight
       
  6346 // -----------------------------------------------------------------------------
       
  6347 //
       
  6348 TInt CEikMenuPane::CalculateItemHeight() const
       
  6349     {
       
  6350     TAknWindowLineLayout menuLineLayout;
       
  6351 
       
  6352     if ( iOwner ) // submenu
       
  6353         {
       
  6354         menuLineLayout = 
       
  6355             AknLayoutScalable_Avkon::list_single_popup_submenu_pane( 0 ).LayoutLine();
       
  6356         }
       
  6357     else
       
  6358         {
       
  6359         menuLineLayout = 
       
  6360             AknLayoutScalable_Avkon::list_single_pane_cp2( 0 ).LayoutLine();
       
  6361         }
       
  6362 
       
  6363     TAknLayoutRect menuLayoutRect;
       
  6364     menuLayoutRect.LayoutRect( Rect(), menuLineLayout );
       
  6365     
       
  6366     return menuLayoutRect.Rect().Height();
  7564     }
  6367     }
  7565 
  6368 
  7566 
  6369 
  7567 // -----------------------------------------------------------------------------
  6370 // -----------------------------------------------------------------------------
  7568 // CEikMenuPane::ConstructMenuSctRowL
  6371 // CEikMenuPane::ConstructMenuSctRowL
  7579     TInt resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS;
  6382     TInt resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS;
  7580     if (FeatureManager::FeatureSupported(KFeatureIdChinese))
  6383     if (FeatureManager::FeatureSupported(KFeatureIdChinese))
  7581         {
  6384         {
  7582         resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS_CHINESE;
  6385         resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS_CHINESE;
  7583         }
  6386         }
       
  6387     if (FeatureManager::FeatureSupported(KFeatureIdKorean))
       
  6388         {
       
  6389         resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS_KOREAN;
       
  6390         }
  7584     iExtension->ConstructMenuSctRowL( aSpecialChars, resourceId );
  6391     iExtension->ConstructMenuSctRowL( aSpecialChars, resourceId );
  7585     }
  6392     }
  7586 
  6393 
  7587 // -----------------------------------------------------------------------------
  6394 // -----------------------------------------------------------------------------
  7588 // CEikMenuPane::ConstructMenuSctRowL
  6395 // CEikMenuPane::ConstructMenuSctRowL
  7632 // -----------------------------------------------------------------------------
  6439 // -----------------------------------------------------------------------------
  7633 //
  6440 //
  7634 EXPORT_C void CEikMenuPane::SetItemSpecific(
  6441 EXPORT_C void CEikMenuPane::SetItemSpecific(
  7635         TInt aCommandId, TBool aItemSpecific )
  6442         TInt aCommandId, TBool aItemSpecific )
  7636     {
  6443     {
       
  6444     if ( !iExtension )
       
  6445         {
       
  6446         TRAPD( err, CheckCreateExtensionL() );
       
  6447         if ( err )
       
  6448             {
       
  6449             return;
       
  6450             }
       
  6451         }
       
  6452     
  7637     if ( iExtension->iFlags.IsSet(
  6453     if ( iExtension->iFlags.IsSet(
  7638             CEikMenuPaneExtension::ESingleClickEnabled ) )
  6454             CEikMenuPaneExtension::ESingleClickEnabled ) )
  7639         {
  6455         {
  7640         CEikMenuPaneItem::SData& itemData = ItemData( aCommandId );
  6456         CEikMenuPaneItem::SData& itemData = ItemData( aCommandId );
  7641         if ( aItemSpecific )
  6457         if ( aItemSpecific )
  7710 
  6526 
  7711     //iExtension->StartCascadeMenuDisappearTransition();
  6527     //iExtension->StartCascadeMenuDisappearTransition();
  7712     if ( iCascadeMenuPane->IsVisible() )
  6528     if ( iCascadeMenuPane->IsVisible() )
  7713         {
  6529         {
  7714         okToDraw = AknsUtils::SkinInstance() != NULL;
  6530         okToDraw = AknsUtils::SkinInstance() != NULL;
  7715 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
  7716         MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iExtension->iGc );
       
  7717         if ( transApi && okToDraw )
       
  7718             {
       
  7719             iCascadeMenuPane->SetFocus( EFalse, EDrawNow );
       
  7720             }
       
  7721 #endif
       
  7722         // Stop ongoing comp. transitions, this is mostly for fast clicking
  6531         // Stop ongoing comp. transitions, this is mostly for fast clicking
  7723         // cases to make sure that no "scrap" is left behind.
  6532         // cases to make sure that no "scrap" is left behind.
  7724         GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort );
  6533         GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort );
       
  6534 
  7725         // cascade menu "cancel" animation. This does not apply
  6535         // cascade menu "cancel" animation. This does not apply
  7726         // when something is chosen from the menu
  6536         // when something is chosen from the menu
  7727 
  6537         if ( iExtension->iShowCascadeTransition && okToDraw )
  7728     if( iExtension->iShowCascadeTransition && okToDraw )
  6538             {
  7729         {
  6539             iCascadeMenuPane->SetParent( this );
  7730         iCascadeMenuPane->SetParent( this );
  6540     
  7731 
  6541             GfxTransEffect::Begin( iCascadeMenuPane, KGfxControlDisappearAction );
  7732         GfxTransEffect::Begin( iCascadeMenuPane, KGfxControlDisappearAction );
  6542             GfxTransEffect::SetDemarcation( iCascadeMenuPane, iExtension->iCascadeDRect );
  7733         GfxTransEffect::SetDemarcation( iCascadeMenuPane, iExtension->iCascadeDRect );
  6543             iCascadeMenuPane->MakeVisible( EFalse );
  7734 
  6544             GfxTransEffect::End( iCascadeMenuPane );
  7735         iCascadeMenuPane->MakeVisible( EFalse );
       
  7736 
       
  7737         GfxTransEffect::End( iCascadeMenuPane );
       
  7738 
       
  7739             }
  6545             }
  7740         }
  6546         }
  7741 
  6547 
  7742         // deregister right away since cascade menu is deleted
  6548         // deregister right away since cascade menu is deleted
  7743     GfxTransEffect::Deregister( iCascadeMenuPane );
  6549     GfxTransEffect::Deregister( iCascadeMenuPane );
  7777     return menuPane;
  6583     return menuPane;
  7778     }
  6584     }
  7779 
  6585 
  7780 
  6586 
  7781 // -----------------------------------------------------------------------------
  6587 // -----------------------------------------------------------------------------
  7782 // CEikMenuPane::SetItemCommandsDimmed
  6588 // CEikMenuPane::SetItemCommandsStateL
  7783 // -----------------------------------------------------------------------------
  6589 // -----------------------------------------------------------------------------
  7784 //
  6590 //
  7785 void CEikMenuPane::SetItemCommandsDimmed()
  6591 void CEikMenuPane::SetItemCommandsStateL( TBool aDimmed )
  7786     {
  6592     {
  7787     if ( iExtension && iExtension->iFlags.IsSet(
  6593     if ( iExtension && iExtension->iFlags.IsSet(
  7788             CEikMenuPaneExtension::ESingleClickEnabled ) )
  6594             CEikMenuPaneExtension::ESingleClickEnabled ) )
  7789         {
  6595         {
  7790         iExtension->iFlags.Set(
  6596         if ( aDimmed )
  7791                 CEikMenuPaneExtension::EHideItemSpecificCommands );
  6597             {
       
  6598             iExtension->iFlags.Set(
       
  6599                     CEikMenuPaneExtension::EHideItemSpecificCommands );
       
  6600             }
       
  6601         else
       
  6602             {
       
  6603             iExtension->iFlags.Set(
       
  6604                     CEikMenuPaneExtension::EHideViewSpecificCommands );
       
  6605             }
  7792         for ( TInt i = 0; i < iItemArray->Count(); ++i )
  6606         for ( TInt i = 0; i < iItemArray->Count(); ++i )
  7793             {
  6607             {
  7794             CEikMenuPaneItem* item = iItemArray->At( i );
  6608             CEikMenuPaneItem* item = iItemArray->At( i );
  7795             if ( item->iData.iFlags & EEikMenuItemAction
  6609             TBool itemSpecificItem(
       
  6610                     item->iData.iFlags & EEikMenuItemAction
  7796                     || item->iData.iFlags & EEikMenuItemSpecific
  6611                     || item->iData.iFlags & EEikMenuItemSpecific
  7797                     || item->iData.iFlags & EEikMenuItemSpecificListQuery )
  6612                     || item->iData.iFlags & EEikMenuItemSpecificListQuery );
       
  6613             // Dim item specific items
       
  6614             if ( aDimmed && itemSpecificItem )
  7798                 {
  6615                 {
  7799                 item->iData.iFlags |= EEikMenuItemDimmed;
  6616                 item->iData.iFlags |= EEikMenuItemDimmed;
  7800                 }
  6617                 }
  7801             }
  6618             // Dim items not item specific
  7802         }
  6619             else if ( !aDimmed
  7803     }
  6620                         && ( !itemSpecificItem
  7804 
  6621                         || item->iData.iFlags & EEikMenuItemAction ) )
       
  6622                 {
       
  6623                 item->iData.iFlags |= EEikMenuItemDimmed;
       
  6624                 if ( item->iData.iCascadeId ) 
       
  6625                     {
       
  6626                     // i is not updated in AddCascadeMenuItemsToMenuL so going 
       
  6627                     // through added items again here. Then it goes through
       
  6628                     // also submenus of submenus. 
       
  6629                     AddCascadeMenuItemsToMenuL(
       
  6630                             item->iData.iCascadeId, ETrue, EFalse, NULL, i );
       
  6631                     }
       
  6632                 }
       
  6633             }
       
  6634         }
       
  6635     }
       
  6636 
       
  6637 // -----------------------------------------------------------------------------
       
  6638 // CEikMenuPane::SetItemActionsStateL
       
  6639 // -----------------------------------------------------------------------------
       
  6640 //
       
  6641 void CEikMenuPane::SetItemActionsStateL( TBool aDimmed )
       
  6642     {
       
  6643     if ( iExtension && iExtension->iFlags.IsSet(
       
  6644             CEikMenuPaneExtension::ESingleClickEnabled ) )
       
  6645         {
       
  6646         if ( aDimmed )
       
  6647             {
       
  6648             iExtension->iFlags.Set(
       
  6649                     CEikMenuPaneExtension::EHideItemActionCommands );
       
  6650             }
       
  6651 
       
  6652         for ( TInt i = 0; i < iItemArray->Count(); ++i )
       
  6653             {
       
  6654             CEikMenuPaneItem* item = iItemArray->At( i );
       
  6655             TBool itemActionItem(
       
  6656                     item->iData.iFlags & EEikMenuItemAction );
       
  6657             // Dim item specific items
       
  6658             if ( aDimmed && itemActionItem )
       
  6659                 {
       
  6660                 item->iData.iFlags |= EEikMenuItemDimmed;
       
  6661                 }
       
  6662             }
       
  6663         }
       
  6664     }
  7805 
  6665 
  7806 // -----------------------------------------------------------------------------
  6666 // -----------------------------------------------------------------------------
  7807 // CEikMenuPane::AddMenuItemsToItemActionMenuL
  6667 // CEikMenuPane::AddMenuItemsToItemActionMenuL
  7808 // -----------------------------------------------------------------------------
  6668 // -----------------------------------------------------------------------------
  7809 //
  6669 //
  7823             // If menu item is not list query and it has cascade menu
  6683             // If menu item is not list query and it has cascade menu
  7824             // add cascade menu items to menu data directly
  6684             // add cascade menu items to menu data directly
  7825             if ( !( item->iData.iFlags & EEikMenuItemSpecificListQuery )
  6685             if ( !( item->iData.iFlags & EEikMenuItemSpecificListQuery )
  7826                     && item->iData.iCascadeId )
  6686                     && item->iData.iCascadeId )
  7827                 {
  6687                 {
  7828                 AddCascadeMenuItemsToActionMenuL(
  6688                 AddCascadeMenuItemsToMenuL(
  7829                         item->iData.iCascadeId, EFalse, aMenuData );
  6689                         item->iData.iCascadeId, EFalse, ETrue, &aMenuData );
  7830                 }
  6690                 }
  7831             // If menu item is list query or it does not have cascade menu
  6691             // If menu item is list query or it does not have cascade menu
  7832             else
  6692             else
  7833                 {
  6693                 {
  7834                 aMenuData.AddMenuItemToDataArrayL(
  6694                 aMenuData.AddMenuItemToDataArrayL(
  7840         // If item is not item specific, add its item specific cascade menu
  6700         // If item is not item specific, add its item specific cascade menu
  7841         // items if the item itself isn't dimmed.
  6701         // items if the item itself isn't dimmed.
  7842         else if ( item->iData.iCascadeId && 
  6702         else if ( item->iData.iCascadeId && 
  7843                 !( item->iData.iFlags & EEikMenuItemDimmed ) )
  6703                 !( item->iData.iFlags & EEikMenuItemDimmed ) )
  7844             {
  6704             {
  7845             AddCascadeMenuItemsToActionMenuL(
  6705             AddCascadeMenuItemsToMenuL(
  7846                     item->iData.iCascadeId, ETrue, aMenuData );
  6706                     item->iData.iCascadeId, ETrue, ETrue, &aMenuData );
  7847             }
  6707             }
  7848         }
  6708         }
  7849     }
  6709     }
  7850 
  6710 
  7851 
  6711 
  7852 // -----------------------------------------------------------------------------
  6712 // -----------------------------------------------------------------------------
  7853 // CEikMenuPane::AddCascadeMenuItemsToActionMenuL
  6713 // CEikMenuPane::AddCascadeMenuItemsToMenuL
  7854 // -----------------------------------------------------------------------------
  6714 // -----------------------------------------------------------------------------
  7855 //
  6715 //
  7856 void CEikMenuPane::AddCascadeMenuItemsToActionMenuL(
  6716 void CEikMenuPane::AddCascadeMenuItemsToMenuL(
  7857         TInt aCascadeId,
  6717         TInt aCascadeId,
  7858         TBool aItemSpecific,
  6718         TBool aItemSpecific,
  7859         CAknItemActionMenuData& aMenuData )
  6719         TBool aAddToItemActionMenu,
       
  6720         CAknItemActionMenuData* aMenuData,
       
  6721         TInt aItemIndex )
  7860     {
  6722     {
  7861     if ( aCascadeId && iCoeEnv->IsResourceAvailableL( aCascadeId ) )
  6723     if ( aCascadeId && iCoeEnv->IsResourceAvailableL( aCascadeId ) )
  7862         {
  6724         {
  7863         CEikMenuPane* cascadeMenu =
  6725         CEikMenuPane* cascadeMenu =
  7864             CEikMenuPane::NewItemCommandMenuL( iMenuObserver );
  6726             CEikMenuPane::NewItemCommandMenuL( iMenuObserver );
  7873             if ( ( aItemSpecific
  6735             if ( ( aItemSpecific
  7874                     && CEikMenuPaneExtension::ItemSpecificCommand( *item ) )
  6736                     && CEikMenuPaneExtension::ItemSpecificCommand( *item ) )
  7875                 || ( !aItemSpecific
  6737                 || ( !aItemSpecific
  7876                         && !( item->iData.iFlags & EEikMenuItemDimmed ) ) )
  6738                         && !( item->iData.iFlags & EEikMenuItemDimmed ) ) )
  7877                 {
  6739                 {
  7878                 aMenuData.AddMenuItemToDataArrayL(
  6740                 if ( aAddToItemActionMenu )
  7879                         item->iData.iCommandId,
  6741                     {
  7880                         item->iData.iCascadeId,
  6742                     aMenuData->AddMenuItemToDataArrayL(
  7881                         item->iData.iText );
  6743                             item->iData.iCommandId,
       
  6744                             item->iData.iCascadeId,
       
  6745                             item->iData.iText );
       
  6746                     }
       
  6747                 else 
       
  6748                     {
       
  6749                     InsertMenuItemL( item->iData, ++aItemIndex );
       
  6750                     }
  7882                 }
  6751                 }
  7883             }
  6752             }
  7884         CleanupStack::PopAndDestroy( cascadeMenu );
  6753         CleanupStack::PopAndDestroy( cascadeMenu );
  7885         }
  6754         }
  7886     }
  6755     }
  7896         {
  6765         {
  7897         iExtension->SetDefaultHighlight();
  6766         iExtension->SetDefaultHighlight();
  7898         }
  6767         }
  7899     }
  6768     }
  7900 
  6769 
       
  6770 // -----------------------------------------------------------------------------
       
  6771 // CEikMenuPane::HideMarkAndUnmark
       
  6772 // -----------------------------------------------------------------------------
       
  6773 //
       
  6774 void CEikMenuPane::HideMarkAndUnmark( TBool aHide )
       
  6775     {
       
  6776     if ( aHide )
       
  6777         {
       
  6778         iExtension->iFlags.Set( CEikMenuPaneExtension::EHideMarkAndUnmark );
       
  6779         }
       
  6780     else 
       
  6781         {
       
  6782         iExtension->iFlags.Clear( CEikMenuPaneExtension::EHideMarkAndUnmark );
       
  6783         }
       
  6784     }
       
  6785 	
       
  6786 // -----------------------------------------------------------------------------
       
  6787 // CEikMenuPane::CleanLocalRef
       
  6788 // -----------------------------------------------------------------------------
       
  6789 //
       
  6790 void CEikMenuPane::CleanLocalRef( TAny* aParam )
       
  6791     {
       
  6792     static_cast<CEikMenuPane*>( aParam )->iIsDeleted = NULL;
       
  6793     }
       
  6794 
       
  6795 
  7901 // end of file
  6796 // end of file
  7902 
  6797