phonebookui/Phonebook2/inc/CPbk2UIExtensionMenu.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Phonebook 2 UI Extension menu information.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2UIEXTENSIONMENU_H
       
    20 #define CPBK2UIEXTENSIONMENU_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <e32base.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class TResourceReader;
       
    27 class CPbk2UIExtensionMenu;
       
    28 
       
    29 /**
       
    30  * Phonebook 2 UI Extension menu information.
       
    31  */
       
    32 NONSHARABLE_CLASS(CPbk2UIExtensionMenu) : public CBase
       
    33     {
       
    34     public: // Construction and destruction
       
    35         /**
       
    36          * Creates a new instance of this class by reading the
       
    37          * data from the resource reader (PHONEBOOK2_EXTENSION_MENU_RESOURCE).
       
    38          *
       
    39          * @param aReader   Resource reader where the menu data
       
    40          *                  is read from.
       
    41          * @return  A new instance of this class.
       
    42          */
       
    43         static CPbk2UIExtensionMenu* NewLC(
       
    44                 TResourceReader& aReader );
       
    45 
       
    46         /**
       
    47          * Creates a new instance of this class.
       
    48          *
       
    49          * @param aViewId   Id of the view whose menu these items are brought to.
       
    50          * @param aMenuFilteringFlags   Flags that must have been turned on to 
       
    51          *                              enable this menu. 
       
    52          *                              See TPbk2UIExtensionMenuFilteringFlags.
       
    53          * @param aParentMenuResourceId Resource id of the menu that these 
       
    54          *                              items will be added to.
       
    55          * @param aPreviousCommandId    Command id of the item that these menu 
       
    56          *                              items will follow.
       
    57          * @param aMenuResourceId       Menu resource id that will be appended.
       
    58          * @param aCascadingMenuCmd     In case the menuPane is a cascading menu 
       
    59          *                              pane and the same cascading menu pane is 
       
    60          *                              used from multiple extensions, this has 
       
    61          *                              to be the command id of the cascading 
       
    62          *                              menu pane.
       
    63          * @return  A new instance of this class.
       
    64          */
       
    65         IMPORT_C static CPbk2UIExtensionMenu* NewLC(TUid aViewId, 
       
    66                 TUint32 aMenuFilteringFlags,
       
    67                 TInt aParentMenuResourceId, TInt aPreviousCommandId, 
       
    68                 TInt aMenuResourceId, TInt aCascadingMenuCmd = 0 );
       
    69 
       
    70         /**
       
    71          * Destructor.
       
    72          */
       
    73         ~CPbk2UIExtensionMenu();
       
    74 
       
    75     public: // Interface
       
    76         /**
       
    77          * Returns the id of the view that this menu is attached to.
       
    78          *
       
    79          * @return  Id of the view that this menu is attached to.
       
    80          */
       
    81         TUid ViewId() const;
       
    82 
       
    83         /**
       
    84          * Returns the id of the menu that this menu is part of.
       
    85          *
       
    86          * @return  Id of the menu that this menu is part of.
       
    87          */
       
    88         TInt ParentMenuId() const;
       
    89 
       
    90         /**
       
    91          * Returns the id of the command that this menu pane should follow.
       
    92          *
       
    93          * @return  Id of the command that this menu pane should follow.
       
    94          */
       
    95         TInt PreviousCommand() const;
       
    96 
       
    97         /**
       
    98          * Returns the id of this menu in the resources.
       
    99          *
       
   100          * @return  Id of this menu in the resources.
       
   101          */
       
   102         TInt MenuResId() const;
       
   103 
       
   104         /**
       
   105          * Returns the command id of this menu in case
       
   106          * this is a cascading menu.
       
   107          *
       
   108          * @return  Command id of this menu in case this
       
   109          *          is a cascading menu.
       
   110          */
       
   111         TInt CascadingMenuCmd() const;
       
   112 
       
   113         /**
       
   114          * Returns ETrue if this menu pane is visible in the given view
       
   115          * and in the given menu when the given flags are on.
       
   116          *
       
   117          * @param aViewId           Id of the view where the menu
       
   118          *                          should be on.
       
   119          * @param aParentMenuId     Id of the menu that will be
       
   120          *                          the parent of the menu.
       
   121          * @param aFilteringFlags   Menu filtering flags that are on
       
   122          *                          in the current state of the UI.
       
   123          * @return  ETrue if this menu pane is visible when
       
   124          *          the given flags are on.
       
   125          */
       
   126         TBool IsVisible(
       
   127                 TUid aViewId,
       
   128                 TInt aParentMenuId,
       
   129                 TUint32 aFilteringFlags ) const;
       
   130 
       
   131     private: // Implementation
       
   132         CPbk2UIExtensionMenu();
       
   133         CPbk2UIExtensionMenu(TUid aViewId, TUint32 aMenuFilteringFlags, 
       
   134                 TInt aParentMenuResourceId, TInt aPreviousCommandId, 
       
   135                 TInt aMenuResourceId, TInt aCascadingMenuCmd );
       
   136         void ConstructL(
       
   137                 TResourceReader& aReader );
       
   138         void ConstructL();
       
   139 
       
   140     private: // Data
       
   141         /// Own: Id of the view that this menu is attached to
       
   142         TUid iViewId;
       
   143         /// Own: Menu filtering flags that has to be on for
       
   144         ///      this menu pane to be visible
       
   145         TUint32 iMenuFilteringFlags;
       
   146         /// Own: Id of the menu that this menu is part of
       
   147         TInt iParentMenuResId;
       
   148         /// Own: Id of the command that this menu pane should follow
       
   149         TInt iPreviousCommand;
       
   150         /// Own: Id of this menu in the resources
       
   151         TInt iMenuResId;
       
   152         /// Own: Command id of this menu in case this is a cascading menu
       
   153         TInt iCascadingMenuCmd;
       
   154     };
       
   155 
       
   156 #endif // CPBK2UIEXTENSIONMENU_H
       
   157 
       
   158 // End of File