|
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: Class for extended input capabilities |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "aknextendedinputcapabilities.h" |
|
20 |
|
21 // ======== MEMBER FUNCTIONS ======== |
|
22 |
|
23 EXPORT_C CAknExtendedInputCapabilities* CAknExtendedInputCapabilities::NewL() |
|
24 { |
|
25 CAknExtendedInputCapabilities* self = CAknExtendedInputCapabilities::NewLC(); |
|
26 CleanupStack::Pop( self ); |
|
27 return self; |
|
28 } |
|
29 |
|
30 |
|
31 EXPORT_C CAknExtendedInputCapabilities* CAknExtendedInputCapabilities::NewLC() |
|
32 { |
|
33 CAknExtendedInputCapabilities* self = new( ELeave ) CAknExtendedInputCapabilities; |
|
34 CleanupStack::PushL( self ); |
|
35 self->ConstructL(); |
|
36 return self; |
|
37 } |
|
38 |
|
39 |
|
40 EXPORT_C CAknExtendedInputCapabilities::~CAknExtendedInputCapabilities() |
|
41 { |
|
42 iObserverArray.Close(); |
|
43 } |
|
44 |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // Sets the given simple capabilitites (does not add) |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 EXPORT_C void CAknExtendedInputCapabilities::SetCapabilities( TUint aCapabilities ) |
|
51 { |
|
52 iInputCapabilities = aCapabilities; |
|
53 } |
|
54 |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // Gets the simple capabilities |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 EXPORT_C TUint CAknExtendedInputCapabilities::Capabilities() const |
|
61 { |
|
62 return iInputCapabilities; |
|
63 } |
|
64 |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // Tests if the given simple capabilities are supported |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 EXPORT_C TBool CAknExtendedInputCapabilities::SupportsCapabilities( TUint aCapabilities ) const |
|
71 { |
|
72 TBool supportsCapabilities( EFalse ); |
|
73 |
|
74 if ( iInputCapabilities & aCapabilities == aCapabilities ) |
|
75 { |
|
76 supportsCapabilities = ETrue; |
|
77 } |
|
78 |
|
79 return supportsCapabilities; |
|
80 } |
|
81 |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // Sets the given MIDP constraints (does not add) |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 EXPORT_C void CAknExtendedInputCapabilities::SetMIDPConstraints( TUint aConstraints ) |
|
88 { |
|
89 iMIDPConstraints = aConstraints; |
|
90 } |
|
91 |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // Gets the MIDP constraints |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 EXPORT_C TUint CAknExtendedInputCapabilities::MIDPConstrainst() const |
|
98 { |
|
99 return iMIDPConstraints; |
|
100 } |
|
101 |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // Sets the editor type |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 EXPORT_C void CAknExtendedInputCapabilities::SetEditorType( TInt aEditorType ) |
|
108 { |
|
109 iEditorType = aEditorType; |
|
110 } |
|
111 |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // Gets the editor type |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 EXPORT_C TInt CAknExtendedInputCapabilities::EditorType() const |
|
118 { |
|
119 return iEditorType; |
|
120 } |
|
121 |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // Registers an observer |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 EXPORT_C void CAknExtendedInputCapabilities::RegisterObserver( MAknEventObserver* aObserver ) |
|
128 { |
|
129 UnregisterObserver( aObserver ); // to prevent double entries |
|
130 iObserverArray.Append( aObserver ); |
|
131 } |
|
132 |
|
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // Unregisters an observer |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 EXPORT_C void CAknExtendedInputCapabilities::UnregisterObserver( MAknEventObserver* aObserver ) |
|
139 { |
|
140 TInt index = iObserverArray.Find( aObserver ); |
|
141 |
|
142 if ( index != KErrNotFound ) |
|
143 { |
|
144 iObserverArray.Remove( index ); |
|
145 } |
|
146 } |
|
147 |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // Sends an event to observers (if any) |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 EXPORT_C void CAknExtendedInputCapabilities::ReportEventL( TInt aEvent, TAny* aParams ) |
|
154 { |
|
155 for ( TInt i = 0; i < iObserverArray.Count(); ++i ) |
|
156 { |
|
157 iObserverArray[i]->HandleInputCapabilitiesEventL( aEvent, aParams ); |
|
158 } |
|
159 } |
|
160 |
|
161 CAknExtendedInputCapabilities::CAknExtendedInputCapabilities() |
|
162 { |
|
163 } |
|
164 |
|
165 |
|
166 void CAknExtendedInputCapabilities::ConstructL() |
|
167 { |
|
168 } |
|
169 |
|
170 |
|
171 EXPORT_C CAknExtendedInputCapabilities::CAknExtendedInputCapabilitiesProvider:: |
|
172 CAknExtendedInputCapabilitiesProvider() |
|
173 { |
|
174 } |
|
175 |
|
176 |
|
177 EXPORT_C CAknExtendedInputCapabilities::CAknExtendedInputCapabilitiesProvider:: |
|
178 ~CAknExtendedInputCapabilitiesProvider() |
|
179 { |
|
180 } |
|
181 |
|
182 |
|
183 EXPORT_C void CAknExtendedInputCapabilities:: |
|
184 CAknExtendedInputCapabilitiesProvider::SetExtendedInputCapabilities( |
|
185 CAknExtendedInputCapabilities* aExtendedInputCapabilities ) |
|
186 { |
|
187 iExtendedInputCapabilities = aExtendedInputCapabilities; |
|
188 } |
|
189 |
|
190 |
|
191 EXPORT_C CAknExtendedInputCapabilities* CAknExtendedInputCapabilities:: |
|
192 CAknExtendedInputCapabilitiesProvider::ExtendedInputCapabilities() const |
|
193 { |
|
194 return iExtendedInputCapabilities; |
|
195 } |
|
196 |
|
197 |
|
198 EXPORT_C void CAknExtendedInputCapabilities:: |
|
199 CAknExtendedInputCapabilitiesProvider::SetMopParent( |
|
200 MObjectProvider* aObjectProvider ) |
|
201 { |
|
202 iParent = aObjectProvider; |
|
203 } |
|
204 |
|
205 |
|
206 TTypeUid::Ptr CAknExtendedInputCapabilities:: |
|
207 CAknExtendedInputCapabilitiesProvider::MopSupplyObject( TTypeUid aId ) |
|
208 { |
|
209 if ( aId.iUid == CAknExtendedInputCapabilities::ETypeId && |
|
210 iExtendedInputCapabilities ) |
|
211 { |
|
212 return aId.MakePtr( iExtendedInputCapabilities ); |
|
213 } |
|
214 |
|
215 return TTypeUid::Null(); |
|
216 } |
|
217 |
|
218 |
|
219 MObjectProvider* CAknExtendedInputCapabilities:: |
|
220 CAknExtendedInputCapabilitiesProvider::MopNext() |
|
221 { |
|
222 return iParent; // NULL is also valid |
|
223 } |
|
224 |
|
225 |
|
226 // End of file |