|
1 /* |
|
2 * Copyright (c) 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: Implements class TFsScrollBarFactory |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "emailtrace.h" |
|
21 #include <ecom/implementationproxy.h> |
|
22 #include <alf/alfconstants.h> |
|
23 #include <alf/alflayouthandlers.h> |
|
24 #include "fsscrollbarfactory.h" |
|
25 #include "fsscrollbarlayouthandler.h" |
|
26 #include "fsscrollbarpluginconstants.h" |
|
27 |
|
28 |
|
29 // ======== LOCAL FUNCTIONS ======== |
|
30 |
|
31 MAlfExtensionFactory* Instance() |
|
32 { |
|
33 FUNC_LOG; |
|
34 TFsScrollbarFactory* me = NULL; |
|
35 me = new TFsScrollbarFactory; |
|
36 return me; |
|
37 } |
|
38 |
|
39 |
|
40 const TImplementationProxy ImplementationTable[] = |
|
41 { |
|
42 //<cmail> |
|
43 IMPLEMENTATION_PROXY_ENTRY( KFsScrollbarImplementationId, |
|
44 Instance ) |
|
45 //</cmail> |
|
46 }; |
|
47 |
|
48 |
|
49 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( |
|
50 TInt& aTableCount ) |
|
51 { |
|
52 aTableCount = sizeof( ImplementationTable ) |
|
53 / sizeof( TImplementationProxy ) ; |
|
54 return ImplementationTable; |
|
55 } |
|
56 |
|
57 |
|
58 // ======== MEMBER FUNCTIONS ======== |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // From class MAlfExtensionFactory. |
|
62 // Creates new instace of required type (unique for factory) Must not take |
|
63 // ownership of created object. |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 MAlfExtension* TFsScrollbarFactory::CreateExtensionL( |
|
67 const TInt aObjectId, |
|
68 const TDesC8& aInitialParams, |
|
69 MAlfInterfaceProvider& aResolver ) |
|
70 { |
|
71 FUNC_LOG; |
|
72 MAlfExtension* result( NULL ); |
|
73 switch ( aObjectId ) |
|
74 { |
|
75 case EFsScrollbarCreateScreenLayout: |
|
76 { |
|
77 TInt2* params = ( TInt2* )aInitialParams.Ptr(); |
|
78 |
|
79 CHuiControl* owner( NULL ); |
|
80 CHuiLayout* parentLayout( NULL ); |
|
81 |
|
82 if ( !params->iInt1 ) |
|
83 { |
|
84 User::Leave( KErrArgument ); |
|
85 } |
|
86 else |
|
87 { |
|
88 // currently we must use concrete owner as interface does not |
|
89 // provide means to transfer ownership |
|
90 owner = ( CHuiControl* )aResolver.GetInterfaceL( |
|
91 EHuiObjectTypeControl, params->iInt1 ); |
|
92 } |
|
93 |
|
94 if (params->iInt2) // not compulsory |
|
95 { |
|
96 parentLayout = ( CHuiLayout* )aResolver.GetInterfaceL( |
|
97 EHuiObjectTypeLayout, params->iInt2 ); |
|
98 } |
|
99 |
|
100 result = CFsScrollbarLayoutHandler::NewL( |
|
101 aResolver, owner, parentLayout ); |
|
102 break; |
|
103 } |
|
104 |
|
105 default: |
|
106 User::Leave( KErrNotSupported ); |
|
107 } |
|
108 return result; |
|
109 } |
|
110 |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // From class MAlfExtensionFactory. |
|
114 // Free resources for instance, usually delete this |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void TFsScrollbarFactory::Release() |
|
118 { |
|
119 FUNC_LOG; |
|
120 delete this; |
|
121 } |
|
122 |