1 /* |
|
2 * Copyright (c) 2009 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: File imeplemets the widgetfactory for interfaces. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //Symbian includes |
|
20 #include <ecom/ecom.h> |
|
21 |
|
22 //Alfred client includes |
|
23 #include <alf/alfenv.h> |
|
24 |
|
25 //OSN core includes |
|
26 #include <osn/ustring.h> |
|
27 #include <osn/osnnew.h> |
|
28 #include <osn/osncommon.h> |
|
29 |
|
30 //Widget utils includes |
|
31 #include <alf/alftypes.h> |
|
32 |
|
33 //Local includes |
|
34 #include "alfwidgetfactoryplugin.h" |
|
35 #include "alfwidgetfactory.h" |
|
36 |
|
37 //Namespaces |
|
38 using namespace Alf; |
|
39 using namespace osncore; |
|
40 |
|
41 |
|
42 namespace Alf |
|
43 { |
|
44 |
|
45 const TInt KWidgetFactoryPluginUid = {0x10201256}; |
|
46 const int KProductCount = 1; |
|
47 static const char* const KAlfWidgetFactory = "alfwidgetfactory"; |
|
48 |
|
49 |
|
50 IAlfFactoryPlugin* AlfWidgetFactoryPlugin::NewL() |
|
51 { |
|
52 // Must use (ELeave), because ECOM won't undestand bad_alloc |
|
53 return new(ELeave)AlfWidgetFactoryPlugin; |
|
54 } |
|
55 |
|
56 AlfWidgetFactoryPlugin::~AlfWidgetFactoryPlugin() |
|
57 { |
|
58 } |
|
59 |
|
60 IAlfInterfaceBase* AlfWidgetFactoryPlugin::createProduct( |
|
61 const char* aProduct, |
|
62 void* aInitData) |
|
63 { |
|
64 (void) aProduct; //Compiler Warning removal. |
|
65 |
|
66 CAlfEnv* env = reinterpret_cast<CAlfEnv*>(aInitData); |
|
67 AlfWidgetFactory* widgetFactory( new( EMM ) AlfWidgetFactory(*env) ); |
|
68 // This basically returns the widgetFactory object. |
|
69 // The ownership of that object is transferred to the caller. |
|
70 return widgetFactory->makeInterface(IAlfWidgetFactory::type()); |
|
71 } |
|
72 |
|
73 IAlfInterfaceBase* AlfWidgetFactoryPlugin::makeInterface(const IfId& aType) |
|
74 { |
|
75 UString param(aType.mImplementationId); |
|
76 if(param == UString(IAlfFactoryPlugin::type().mImplementationId)) |
|
77 { |
|
78 return static_cast<IAlfFactoryPlugin*>(this); |
|
79 } |
|
80 return NULL; |
|
81 } |
|
82 |
|
83 int AlfWidgetFactoryPlugin::productCount()const |
|
84 { |
|
85 return KProductCount; |
|
86 } |
|
87 |
|
88 const char* AlfWidgetFactoryPlugin::productInfo(int aIndex)const |
|
89 { |
|
90 if(aIndex == 0) |
|
91 { |
|
92 return KAlfWidgetFactory; |
|
93 } |
|
94 return 0; |
|
95 } |
|
96 |
|
97 } // namespace Alf |
|
98 |
|
99 |
|
100 |
|
101 const TImplementationProxy ImplementationTable[] = |
|
102 { |
|
103 #ifdef __EABI__ |
|
104 IMPLEMENTATION_PROXY_ENTRY( |
|
105 KWidgetFactoryPluginUid, |
|
106 AlfWidgetFactoryPlugin::NewL), |
|
107 #else |
|
108 {{KWidgetFactoryPluginUid}, AlfWidgetFactoryPlugin::NewL} |
|
109 #endif |
|
110 }; |
|
111 |
|
112 OSN_EXPORT const TImplementationProxy* ImplementationGroupProxy( |
|
113 TInt& aTableCount) |
|
114 { |
|
115 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
116 |
|
117 return ImplementationTable; |
|
118 } |
|
119 |
|
120 // End of File |
|