uiservicetab/inc/cmenuextension.h
changeset 0 5e5d6b214f4f
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     1 /*
       
     2 * Copyright (c) 2008 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: cmenuextension.h
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef __CMENUEXTENSION_H__
       
    19 #define __CMENUEXTENSION_H__
       
    20 
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <ecom/ecom.h>
       
    25 
       
    26 //  FORWARD DECLARATIONS
       
    27 class CEikMenuPane;
       
    28 class MCommandMapper;
       
    29 class MVIMPSTUiAIWControl;
       
    30 
       
    31 
       
    32 //CONSTANTS
       
    33 const TUid KMenuCustomisationInterfaceUid = { 0x2002139E };
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38  * Abstract interface for menuextensions. extension plugins  can
       
    39  * extend service tab menu  by implementing a class derived from this.
       
    40  */
       
    41 class CMenuExtension : public CBase
       
    42     {
       
    43     
       
    44     public:
       
    45         
       
    46        static CMenuExtension* CreateImplementationL( TUid aUid );
       
    47        
       
    48        virtual ~CMenuExtension();
       
    49        
       
    50     public: // Interface
       
    51         /**
       
    52          * Filters the menu pane of the plugin connected to this.
       
    53          *
       
    54          * @param aPreviousId Menu command id after which the plugins menu
       
    55          *  should come.
       
    56          * @param aMenuPane Menu pane which will be filtered.
       
    57          * @param aServiceId service id.
       
    58          * @param aMenuExtManager, MenuExtention manager of service tab
       
    59          */
       
    60         virtual void DynInitMenuPaneL
       
    61             (TInt aPreviousId, CEikMenuPane& aMenuPane,TUint aServiceId, MVIMPSTUiAIWControl& aMenuExtManager) = 0;
       
    62             
       
    63         /**
       
    64          * Handles service tab extension commands.
       
    65          *
       
    66          * @param aCommandId Command ID.
       
    67          *
       
    68          * @return ETrue if command was handled, otherwise EFalse.
       
    69          */
       
    70         virtual TBool HandleCommandL(const TInt& aCommand  ) = 0;
       
    71         
       
    72         /**
       
    73          * Registers command ID mapper. This method is called automatically
       
    74          * by Servicetab menu extneions  at initialization phase.
       
    75          *
       
    76          * @param aMapper Command ID mapper
       
    77          */  
       
    78         virtual void RegisterCommandMapper( MCommandMapper& aMapper ) = 0;
       
    79               
       
    80         /**
       
    81          * Gets STM_COMMAND_INFO_ARRAY resource. Resource should be loaded.
       
    82          *
       
    83          * @return Resource ID or KErrNotFound
       
    84          */        
       
    85         virtual TInt CommandInfoResource() const = 0;  
       
    86 
       
    87                
       
    88     private:
       
    89            /**
       
    90             * Instance identifier key. When instance of an implementation is
       
    91             * created by ECOM framework, the framework will assign a UID for
       
    92             * it. The UID is used in the destructor to notify framework that
       
    93             * this instance is being destroyed and resources can be released.
       
    94             * Plugin implementations should leave this untouched, as the inline
       
    95             * destructor and constructor method take care of ECom releasing.
       
    96             */
       
    97            TUid iDtor_ID_Key; 
       
    98                                
       
    99   
       
   100     };
       
   101 inline CMenuExtension* CMenuExtension::CreateImplementationL( TUid aUid )
       
   102     {
       
   103     TAny* ptr = REComSession::CreateImplementationL( aUid, _FOFF( CMenuExtension, iDtor_ID_Key ) );
       
   104     CMenuExtension* impl = static_cast<CMenuExtension*> (ptr);
       
   105     return impl;
       
   106     }
       
   107 
       
   108 inline CMenuExtension::~CMenuExtension()
       
   109     {
       
   110     REComSession::DestroyedImplementation( iDtor_ID_Key );
       
   111     }
       
   112 
       
   113 #endif // __MXSPVIEW_H__