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