phonebookui/Phonebook2/inc/CPbk2UIExtensionInformation.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 information.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2UIEXTENSIONINFORMATION_H
       
    20 #define CPBK2UIEXTENSIONINFORMATION_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <e32base.h>
       
    24 #include <TPbk2UIExtensionRange.h>
       
    25 #include <RPbk2LocalizedResourceFile.h>
       
    26 #include <Pbk2UIExtension.hrh>
       
    27 #include <Pbk2IconId.hrh>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class TResourceReader;
       
    31 class CPbk2UIExtensionMenu;
       
    32 class CPbk2UIExtensionIconInformation;
       
    33 
       
    34 /**
       
    35  * Phonebook 2 UI Extension view id structure.
       
    36  * An instance of this class is created from
       
    37  * PHONEBOOK2_EXTENSION_VIEW_ID resource definition.
       
    38  */
       
    39 class TPbk2UIExtensionViewId
       
    40     {
       
    41     public: // Construction
       
    42         /**
       
    43          * Constructor.
       
    44          *
       
    45          * @param aReader   Resource reader.
       
    46          */
       
    47         TPbk2UIExtensionViewId(
       
    48                 TResourceReader& aReader );
       
    49 
       
    50         /**
       
    51          * Constructor.
       
    52          *
       
    53          * @param aViewId   View identifier.
       
    54          * @param aViewResourceId   Id to a AVKON_VIEW resource structure.
       
    55          */
       
    56         IMPORT_C TPbk2UIExtensionViewId(TUid aViewId, 
       
    57                 TInt aViewResourceId);
       
    58 
       
    59     public: // Interface
       
    60         /**
       
    61          * Returns the view id.
       
    62          *
       
    63          * @return  View id.
       
    64          */
       
    65         TUid ViewId() const;
       
    66 
       
    67         /**
       
    68          * Returns the view resource id.
       
    69          *
       
    70          * @return  View resource id.
       
    71          */
       
    72         TInt ViewResourceId() const;
       
    73 
       
    74     private: // Data
       
    75         /// Own: View id
       
    76         TUid iViewId;
       
    77         /// Own: View resource id.
       
    78         TInt iViewResourceId;
       
    79     };
       
    80 
       
    81 /**
       
    82  * Phonebook 2 UI Extension information.
       
    83  * An instance of this class is created from
       
    84  * PHONEBOOK2_EXTENSION_INFORMATION resource definition.
       
    85  */
       
    86 NONSHARABLE_CLASS(CPbk2UIExtensionInformation) : public CBase
       
    87     {
       
    88     public: // Construction and destruction
       
    89 
       
    90         /**
       
    91          * Creates a new instance of this class by reading the
       
    92          * data from the resources.
       
    93          *
       
    94          * @param aFileName     File that contains the
       
    95          *                      resources for this object.
       
    96          * @return  A new instance of this class.
       
    97          */
       
    98         static CPbk2UIExtensionInformation* NewLC(
       
    99                 const TDesC& aFileName );
       
   100 
       
   101         /**
       
   102          * Destructor.
       
   103          */
       
   104         ~CPbk2UIExtensionInformation();
       
   105 
       
   106     public: // Interface
       
   107 
       
   108         /**
       
   109          * Returns the number of menus that the plug-in
       
   110          * brings to application.
       
   111          *
       
   112          * @return  Number of menus the plug-in brings to application.
       
   113          */
       
   114         TInt MenuCount() const;
       
   115 
       
   116         /**
       
   117          * Returns the menu at the given index.
       
   118          *
       
   119          * @param aIndex    Index of the menu to return.
       
   120          * @return  The menu at given index.
       
   121          */
       
   122         CPbk2UIExtensionMenu& MenuAt(
       
   123                 TInt aIndex );
       
   124 
       
   125         /**
       
   126          * Adds aMenu to the extension information.
       
   127          *
       
   128          * @param aExtensionMenu    Menu to add to this information.
       
   129          */
       
   130         IMPORT_C void AddMenuL( CPbk2UIExtensionMenu* aExtensionMenu );
       
   131 
       
   132         /**
       
   133          * Returns the implementation uid of the plug-in.
       
   134          *
       
   135          * @return  Implementation uid of the plug-in.
       
   136          */
       
   137         TUid ImplementationUid() const;
       
   138 
       
   139         /**
       
   140          * Returns the loading policy of the extension.
       
   141          *
       
   142          * @return  Loading policy of the extension.
       
   143          */
       
   144         TUint LoadingPolicy() const;
       
   145 
       
   146         /**
       
   147          * Checks if the plug-in represented by this resource implements
       
   148          * given menu command. Note that the this may return ETrue even
       
   149          * though the plug-in does not actually implement the command but
       
   150          * only has the command in its command id range.
       
   151          *
       
   152          * @param aCommandId    Command id to check.
       
   153          * @return  ETrue if the plug-in represented by this resource
       
   154          *          implements given menu command, EFalse otherwise.
       
   155          */
       
   156         TBool ImplementsMenuCommand(
       
   157                 TInt aCommandId );
       
   158 
       
   159         /**
       
   160          * Checks if the plug-in represented by this resource implements
       
   161          * view with the given view id. Note that this may return ETrue even
       
   162          * though the plug-in does not actually implement the view but only
       
   163          * has the view in its view id range.
       
   164          *
       
   165          * @param aViewId   View id to check.
       
   166          * @return  ETrue if the plug-in represented by this resource
       
   167          *          implements given view, EFalse otherwise.
       
   168          */
       
   169         TBool ImplementsView(
       
   170                 TUid aViewId );
       
   171 
       
   172         /**
       
   173          * Returns ETrue if this extension has modifications to
       
   174          * the view graph, EFalse otherwise.
       
   175          *
       
   176          * @return  ETrue if this extension has modifications to
       
   177          *          the view graph, EFalse otherwise.
       
   178          */
       
   179         TBool HasViewGraphModifications() const;
       
   180 
       
   181         /**
       
   182          * Creates a resource reader for the view graph modifications.
       
   183          *
       
   184          * @param aReader   The reader to create.
       
   185          */
       
   186         void CreateViewGraphModificationReaderLC(
       
   187                 TResourceReader& aReader ) const;
       
   188 
       
   189         /**
       
   190          * Returns an array of extension view ids.
       
   191          *
       
   192          * @return  An array of extension view ids.
       
   193          */
       
   194         TArray<TPbk2UIExtensionViewId> ViewIds() const;
       
   195 
       
   196         /**
       
   197          * Adds a View id object to the extension view ids.
       
   198          *
       
   199          * @param aViewId   Extension view id.
       
   200          */
       
   201         IMPORT_C void AddViewIdL(TPbk2UIExtensionViewId& aViewId);
       
   202 
       
   203         /**
       
   204          * Returns ETrue if the extension has own icons.
       
   205          *
       
   206          * @return  ETrue if the extension has own icons.
       
   207          */
       
   208         TBool HasIconExtension() const;
       
   209 
       
   210         /**
       
   211          * Returns the icon information of the extension.
       
   212          *
       
   213          * @return  The icon information of the extension.
       
   214          */
       
   215         CPbk2UIExtensionIconInformation& IconInformation() const;
       
   216 
       
   217         /**
       
   218          * Returns ETrue if the extension has defined store
       
   219          * property array in the resource.
       
   220          *
       
   221          * @return  ETrue if the extension has defined store property array.
       
   222          */
       
   223         TBool HasStorePropertyArray() const;
       
   224 
       
   225         /**
       
   226          * Creates a resource reader for the store property array.
       
   227          * Not to be called if HasStorePropertyArray returns EFalse.
       
   228          *
       
   229          * @param aReader   The reader to create.
       
   230          */
       
   231         void CreateStorePropertyArrayReaderLC(
       
   232                 TResourceReader& aReader );
       
   233 
       
   234     private: // Implementation
       
   235         CPbk2UIExtensionInformation();
       
   236         void ConstructL(
       
   237                 const TDesC& aFileName );
       
   238 
       
   239     private: // Data
       
   240         /// Own: Resource file
       
   241         RPbk2LocalizedResourceFile iResourceFile;
       
   242         /// Own: Implementation UID
       
   243         TUid iImplementationUid;
       
   244         /// Own: Loading policy
       
   245         TUint iLoadingPolicy;
       
   246         /// Own: Extension's menu command range
       
   247         TPbk2UIExtensionRange iMenuCommandRange;
       
   248         /// Own: Array of extension menus
       
   249         RPointerArray<CPbk2UIExtensionMenu> iMenus;
       
   250         /// Own: Array of extension's view ids
       
   251         RArray<TPbk2UIExtensionViewId> iViewIds;
       
   252         /// Own: View graph modification resource id
       
   253         TInt iViewGraphModificationResId;
       
   254         /// Own: The icon information of the extension
       
   255         CPbk2UIExtensionIconInformation* iIconInformation;
       
   256         /// Own: An array for commands ids that are
       
   257         ///      overwritten by the extension
       
   258         RArray<TInt> iOverWrittenCmds;
       
   259         /// Own: The id of the store property array
       
   260         TInt iStorePropertyArrayResId;
       
   261     };
       
   262 
       
   263 #endif // CPBK2UIEXTENSIONINFORMATION_H
       
   264 
       
   265 // End of File