|
1 /* |
|
2 * Copyright (c) 2006 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: interface for creating custom extensions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __M_ALF_EXTENSION_FACTORY__ |
|
21 #define __M_ALF_EXTENSION_FACTORY__ |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 class CAlfLayoutManager; |
|
26 class CHuiEnv; |
|
27 |
|
28 // binary |
|
29 enum THuiInterfaceSupport |
|
30 { // Cast to: |
|
31 EHuiObjectTypeVisual = 0x0001, // CHuiVisual |
|
32 EHuiObjectTypeLayout = 0x0002, // CHuiLayout |
|
33 EHuiObjectTypeControl = 0x0004 , // CHuiControl |
|
34 EHuiObjectTypeControlGroup = 0x0008,// CHuiControlGroup |
|
35 EHuiObjectTypeBrush = 0x0010, // CHuiBrush |
|
36 EHuiObjectTypeDisplay = 0x0020, // CHuiDisplay |
|
37 EHuiObjectTypeCustom = 0x0040, // For extension to decide |
|
38 EHuiObjectTypeCurvePathProvider = 0x0080, // Implemented by object which shares curve path |
|
39 |
|
40 EHuiInterfaceMappingFunction = 0x00010000, // MHuiMappingFunction |
|
41 EHuiInterfaceVisualOwner = 0x00020000, // MHuiVisualOwner |
|
42 EAlfBrushHandler = 0x00040000, // CAlfBrushHandler, needed for controlling brush ownership |
|
43 EAlfTextStyleHandler = 0x00080000, // TAlfTextStyleHandler, needed for mapping client and server side text styles |
|
44 EAlfVisualHandler = 0x00100000 // CAlfVisualHandler |
|
45 }; |
|
46 |
|
47 |
|
48 |
|
49 class MAlfInterfaceProvider |
|
50 { |
|
51 public: |
|
52 /** |
|
53 * Request to pointer of given type matching to given handle. |
|
54 * Leaves if object not found i.e. always returns pointer on completion |
|
55 */ |
|
56 virtual TAny* GetInterfaceL(const THuiInterfaceSupport& aType, TInt aHandle) = 0; |
|
57 |
|
58 /** |
|
59 * Request identifier for pointer of given type |
|
60 * On error returns KErrNotFound |
|
61 */ |
|
62 virtual TInt GetHandleFromInterface(const THuiInterfaceSupport& aType, TAny* aInterface) = 0; |
|
63 |
|
64 /** |
|
65 * Returns common layoutmanager or null |
|
66 */ |
|
67 virtual CAlfLayoutManager* LayoutManager() const = 0; |
|
68 |
|
69 /** |
|
70 * Returns common hitchcock environment or null |
|
71 */ |
|
72 virtual CHuiEnv* SharedHuiEnv() const = 0; |
|
73 |
|
74 /** |
|
75 * Request to make current command (during MAlfExtension::HandleCmd) asynchronous |
|
76 * returns command id that is needed for completing the command later on |
|
77 * |
|
78 * exntension should take references to buffers (in/out) in case it wants to modify client message |
|
79 * before completing it |
|
80 */ |
|
81 virtual TInt HandleCurrentCommanndAsynch() = 0; |
|
82 |
|
83 /** |
|
84 * Complete asynch command, if MAlfExtension implementing object utilizes asynch commands |
|
85 * it should also take care that those messages are completed at latest when the extension is being |
|
86 * destoryed. FW will panic the client in case of orphean messages |
|
87 */ |
|
88 virtual void CompleteCmd(TInt aCommadIdentifier, TInt aResult = KErrNone) = 0; |
|
89 |
|
90 /** ! Future proofing */ |
|
91 virtual void AlfInterfaceProviderExtension(const TUid& aExtensionUid, TAny** aExtensionParams) = 0; |
|
92 }; |
|
93 |
|
94 |
|
95 class MAlfExtension |
|
96 { |
|
97 public: |
|
98 /** |
|
99 * Free resources for instance, usually delete this |
|
100 */ |
|
101 virtual void Release() = 0; |
|
102 |
|
103 /** |
|
104 * Returns pointer of correct type or null |
|
105 * @param aInterface type of interface requested |
|
106 * @return Pointer or null depending whether interface is implemented |
|
107 */ |
|
108 virtual TAny* GetInterface(const THuiInterfaceSupport& aInterface) = 0; |
|
109 |
|
110 /** |
|
111 * Handles command from controller |
|
112 * @param aCommandId Command identifier, values below EAlfLastReservedOpCmd (= 10000) |
|
113 * are reserved for tookit fw and should not be utilized in app |
|
114 * specific extensions. |
|
115 * @param aInputBuffer Additional data attached to command |
|
116 * @param aResponse Response to be passed back to commander |
|
117 * @leave Any system wide error code |
|
118 */ |
|
119 virtual void HandleCmdL(TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse) = 0; |
|
120 |
|
121 }; |
|
122 |
|
123 |
|
124 class MAlfExtensionFactory |
|
125 { |
|
126 public: |
|
127 /** |
|
128 * Creates new instace of required type (unique for factory) |
|
129 * Must not take ownership of created object |
|
130 * |
|
131 * @param aObjectId Object type required |
|
132 * @param aInputBuffer Additional data attached to object construction |
|
133 * @param aResolver Reference to Interface resolver |
|
134 * @leave Any system wide error code |
|
135 */ |
|
136 virtual MAlfExtension* CreateExtensionL(const TInt aObjectId, const TDesC8& aInitialParams, MAlfInterfaceProvider& aResolver) = 0; |
|
137 |
|
138 /** |
|
139 * Free resources for instance, usually delete this |
|
140 */ |
|
141 virtual void Release() = 0; |
|
142 |
|
143 }; |
|
144 |
|
145 #endif |