emailuis/uicomponents/inc/fsactionmenu.h
branchRCL_3
changeset 25 3533d4323edc
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Freestyle action menu component
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSACTIONMENU_H
       
    20 #define C_FSACTIONMENU_H
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <eikcmobs.h>
       
    25 
       
    26 #include "fsactionmenudefines.h"
       
    27 #include "fstreelist.h"
       
    28 #include "fstreelistobserver.h"
       
    29 
       
    30 
       
    31 //////TOOLKIT CLASSES
       
    32 class CAlfEnv;
       
    33 class CAlfControlGroup;
       
    34 class CAlfDeckLayout;
       
    35 class CAlfControl;
       
    36 class CAlfDisplay;
       
    37 
       
    38 //////PROJECT CLASSES
       
    39 class CFsTreeVisualizerBase;
       
    40 class CFsActionMenuControl;
       
    41 class CFsLayoutManager;
       
    42 
       
    43 /////SYSTEM CLASSES
       
    44 class CEikButtonGroupContainer;
       
    45 
       
    46 /**
       
    47  * CFsActionMenu is a component for creating and displaying an action menu.
       
    48  *
       
    49  * @code
       
    50  *
       
    51  * @endcode
       
    52  *
       
    53  * @lib 
       
    54  */
       
    55 class CFsActionMenu : public CFsTreeList,
       
    56                       public MEikCommandObserver,
       
    57                       public MFsTreeListObserver
       
    58     {
       
    59 
       
    60 public: // Construction
       
    61     
       
    62     /**
       
    63      * Two-phased constructor.
       
    64      * 
       
    65      * @param aDisplay Display.
       
    66      * @param aCbaResource Softkey pane to display while pop-up is active.
       
    67      *
       
    68      */
       
    69     IMPORT_C static CFsActionMenu* NewL( CAlfDisplay& aDisplay, TInt aCbaResource );
       
    70     
       
    71     /**
       
    72      * C++ destructor
       
    73      */
       
    74     IMPORT_C virtual ~CFsActionMenu();
       
    75     
       
    76 public: //API    
       
    77     
       
    78     /**
       
    79      * Exetutes action menu at predefined vertical position.
       
    80      * The method returns with TFsActionMenuResult result code.
       
    81      *                        
       
    82      * @param aPos Action Menu's vertical position.
       
    83      */
       
    84     IMPORT_C virtual TFsActionMenuResult ExecuteL( TFsVActionMenuPosition aPos );
       
    85 
       
    86     
       
    87     /**
       
    88      * Exetutes action menu at a custom vertical position.
       
    89      * The method returns with TFsActionMenuResult result code.
       
    90      * 
       
    91      * @param aYPos Action Menu's top edge custom vertical position.
       
    92      */    
       
    93     IMPORT_C TFsActionMenuResult ExecuteL( const TInt aYPos );
       
    94     
       
    95     /**
       
    96      * The function returns size of Action Menu with the curent number of item.
       
    97      * This can be useful to calculate AM's custom vertical position.
       
    98      * 
       
    99      * @return Size of action menu.
       
   100      */
       
   101     IMPORT_C TSize ActionMenuSize ( );
       
   102     
       
   103 public: //From CFsTreeList
       
   104 
       
   105     /**
       
   106      * Sets visiblity of the border
       
   107      */
       
   108     IMPORT_C void SetBorderL( const TBool aVisible, CAlfTexture* aBorderTexture = 0 );
       
   109     
       
   110     /**
       
   111      * The function returns a button group container.
       
   112      * 
       
   113      * @return A button group container.
       
   114      */
       
   115     IMPORT_C CEikButtonGroupContainer* ButtonGroupContainer();     
       
   116     
       
   117 protected: //From MEikCommandObserver
       
   118 
       
   119     /**
       
   120      * From MEikCommandObserver
       
   121      * Processes user commands.
       
   122      */
       
   123     virtual void ProcessCommandL(TInt aCommandId);
       
   124     
       
   125     
       
   126 protected: //From MFsTreeListObserver
       
   127 
       
   128     /**
       
   129      * From MFsTreeListObserver
       
   130      * Observer of the tree list is notified of changes in the tree list
       
   131      * through this function.
       
   132      */
       
   133     // <cmail> Touch
       
   134     virtual void TreeListEventL( const TFsTreeListEvent aEvent, 
       
   135                                  const TFsTreeItemId aId,
       
   136                                  const TPoint& aPoint );
       
   137     // </cmail>
       
   138     
       
   139 public: //used by Action Menu's control
       
   140 
       
   141     void RootLayoutUpdatedL();
       
   142     
       
   143 protected:
       
   144 
       
   145     /**
       
   146      * Shows action menu's cba.
       
   147      */
       
   148     void ShowCbaButtonsL();
       
   149     
       
   150     /**
       
   151      * Hides action menu's cba.
       
   152      */
       
   153     void HideCbaButtonsL();
       
   154         
       
   155     /**
       
   156      * Executes action menu.
       
   157      * 
       
   158      */
       
   159     void DoExecuteL();
       
   160     
       
   161     /**
       
   162      * Dismiss action menu.
       
   163      */
       
   164     void DoDismissL();
       
   165     
       
   166     /**
       
   167      * 
       
   168      */
       
   169     void StartWait();
       
   170     
       
   171     /**
       
   172      * 
       
   173      */
       
   174     void StopWait();
       
   175     
       
   176     /**
       
   177      * The function sets size and position of Action Menu. 
       
   178      */
       
   179     void UpdateActionMenuWindowL( );
       
   180     
       
   181     /**
       
   182      * The function retrieves Action Menu's size from Layout Manager. The size
       
   183      * depends on a number of items in the list.
       
   184      */
       
   185     virtual void SetAMSizeFromLayoutMgrL( );
       
   186 
       
   187     /**
       
   188      * The function calculates AM's position based on it's size and predefined vertical
       
   189      * position (top,center,bottom) or custom vertical position set by the user.
       
   190      *      
       
   191      */
       
   192     virtual void CalculatePosition( );
       
   193     
       
   194     /**
       
   195      * The function returns whether the slide in effect is set.
       
   196      */
       
   197     virtual TBool IsSlideIn();
       
   198     
       
   199     /**
       
   200      * The function returns whether the fade in effect is set.
       
   201      */
       
   202     virtual TBool IsFadeIn();
       
   203     
       
   204     /**
       
   205      * The function returns whether the slide out effect is set.
       
   206      */
       
   207     virtual TBool IsSlideOut();
       
   208     
       
   209     /**
       
   210      * The function returns whether the fade out effect is set.
       
   211      */
       
   212     virtual TBool IsFadeOut();
       
   213     
       
   214     /**
       
   215      * The function sets first list item as focused.
       
   216      */
       
   217     virtual void SetFirstItemAsFocusedL();
       
   218     
       
   219     /**
       
   220      * The function fades screen behind popup.
       
   221      * @param aFaded ETrue to fade behind Action Menu, EFalse to un-fade. 
       
   222      */
       
   223     virtual void FadeBehindActionMenuL( TBool aFaded );
       
   224     
       
   225 protected: //Construction
       
   226 
       
   227     /**
       
   228      * C++ constructor
       
   229      */
       
   230     IMPORT_C CFsActionMenu( CAlfDisplay& aDisplay );
       
   231 
       
   232     /**
       
   233      * Second phase constructor
       
   234      *
       
   235      * @param aCbaResource Softkey pane to display while pop-up is active.     
       
   236      */
       
   237     IMPORT_C void ConstructL( TInt aCbaResource );
       
   238 
       
   239 private:
       
   240     
       
   241     /**
       
   242      * A display in use.
       
   243      * Not own.
       
   244      */
       
   245     CAlfDisplay* iDisplay;
       
   246     
       
   247     /**
       
   248      * A control group for AM.
       
   249      * Not own.
       
   250      */
       
   251     CAlfControlGroup* iCtrlGroup;
       
   252     
       
   253     /**
       
   254      * A layout used for fading AM's background.
       
   255      * Own.
       
   256      */
       
   257     CAlfDeckLayout* iFadeLayout;
       
   258     
       
   259     /**
       
   260      * A root layout for AM.
       
   261      * Not own.
       
   262      */
       
   263     CAlfDeckLayout* iRootLayout;
       
   264     
       
   265     /**
       
   266      * A visualizer for tree list.
       
   267      * Not own. Ownership passed to a baseclasses.
       
   268      */
       
   269     CFsTreeVisualizerBase* iVisualizer;
       
   270     
       
   271     /**
       
   272      * A parent control for AM's control
       
   273      * Not own.
       
   274      */
       
   275     CFsActionMenuControl* iControl;
       
   276     
       
   277     /**
       
   278      * Action Menu's position.
       
   279      */
       
   280     TFsVActionMenuPosition iVPos;
       
   281     
       
   282     /**
       
   283      * AM's size.
       
   284      */
       
   285     TAlfRealSize iSize;
       
   286         
       
   287     /**
       
   288      * AM's position. 
       
   289      */
       
   290     TAlfRealPoint iPos;
       
   291     
       
   292     /**
       
   293      * Action Menu's custom vertical position.
       
   294      */
       
   295     TInt iCustVPos;
       
   296     
       
   297     /**
       
   298      * Custom position is used or not.
       
   299      */
       
   300     TBool iIsCustVPos;
       
   301     
       
   302     /**
       
   303      * Button group container for menu's softkeys
       
   304      *  Owned
       
   305      */
       
   306     CEikButtonGroupContainer* iButtonGroupContainer;
       
   307     
       
   308     /**
       
   309      * Wait loop for ExecuteL
       
   310      *  Owned
       
   311      */
       
   312     CActiveSchedulerWait* iWait;
       
   313     
       
   314     /**
       
   315      * Action Menu's result code.
       
   316      */
       
   317     TFsActionMenuResult iResult;
       
   318     
       
   319     /**
       
   320      * Temporary, before layout mgr taken into use
       
   321      */
       
   322     const TInt KListBorderPadding;
       
   323     
       
   324     /**
       
   325      * Temporary, before layout mgr taken into use
       
   326      */
       
   327     TInt iAmXPadd;
       
   328     
       
   329     /**
       
   330      * Temporary, before layout mgr taken into use
       
   331      */
       
   332     TInt iAmYPadd;
       
   333     
       
   334     };
       
   335 
       
   336 #endif //C_FSACTIONMENU_H