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