|
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: Declaration of CFsFastAddressingList class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_FSFASTADDRESSINGLIST_H |
|
21 #define C_FSFASTADDRESSINGLIST_H |
|
22 |
|
23 #include <e32base.h> |
|
24 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
25 //#include <fsconfig.h> |
|
26 //#ifdef __FS_ALFRED_SUPPORT |
|
27 #include <alf/alfcontrol.h> |
|
28 #include <alf/alfenv.h> |
|
29 /*#else // !__FS_ALFRED_SUPPORT |
|
30 #include <HuiControl.h> |
|
31 #include <HuiImage.h> |
|
32 #endif // __FS_ALFRED_SUPPORT*/ |
|
33 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
34 |
|
35 #include "fstextinputfieldobserver.h" |
|
36 |
|
37 class MFsFastAddressingListObserver; |
|
38 class CFsTextInputField; |
|
39 class CFsFastAddressingVisualizer; |
|
40 class CFsTreeList; |
|
41 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
42 /*#ifdef __FS_ALFRED_SUPPORT |
|
43 #else // !__FS_ALFRED_SUPPORT |
|
44 class CHuiEnv; |
|
45 class CHuiVisual; |
|
46 class THuiEvent; |
|
47 #endif // __FS_ALFRED_SUPPORT*/ |
|
48 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
49 class CFbsBitmap; |
|
50 class CCoeControl; |
|
51 class CFsTreeVisualizerBase; |
|
52 class CFsTreeList; |
|
53 class MFsTreeItemData; |
|
54 class MFsTreeItemVisualizer; |
|
55 |
|
56 |
|
57 /** |
|
58 * Fast Addresssing List (FAL). |
|
59 * |
|
60 * This is the UI component part of fast addressing list. FAL is heavily |
|
61 * dependant on an associated component, Fast Addressing Controller |
|
62 * The FAL is created and owned by the Controller. |
|
63 * |
|
64 * The FAL consists of four parts: a list component, two icons and a text |
|
65 * input field. When the FAL is created the text input field is always |
|
66 * visible. The icons reside on the either side of the text input field. |
|
67 * They are specified by the Controller. The controller can choose to |
|
68 * omit both icons, load either one of them or both. |
|
69 * |
|
70 * The text input field can be used the end user to input text, e.g. email |
|
71 * addresses. The text is passed to the Controller which is responsible |
|
72 * for searching for matching items in e.g. the phonebook. If it finds |
|
73 * matches, it will ask the FAL to display the list component. The end |
|
74 * user can then either enter more text or select any item from the list. |
|
75 * |
|
76 * The controller will search for the matching text in the background so |
|
77 * that the end user can enter more text during the searching. |
|
78 * |
|
79 */ |
|
80 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
81 //#ifdef __FS_ALFRED_SUPPORT |
|
82 NONSHARABLE_CLASS( CFsFastAddressingList ) : public CAlfControl, |
|
83 public MFsTextInputFieldObserver |
|
84 /*#else // !__FS_ALFRED_SUPPORT |
|
85 NONSHARABLE_CLASS( CFsFastAddressingList ) : public CHuiControl, |
|
86 public MFsTextInputFieldObserver |
|
87 #endif // __FS_ALFRED_SUPPORT*/ |
|
88 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
89 { |
|
90 |
|
91 public: // icon manipulation |
|
92 |
|
93 enum TIconID |
|
94 { |
|
95 EIconA, |
|
96 EIconB |
|
97 }; |
|
98 |
|
99 public: |
|
100 /** |
|
101 * Two phase constructor. |
|
102 * |
|
103 * @param aEnv Reference to CHuiEnv environment |
|
104 * @param aObserver Observer which will receive events |
|
105 * from Fast Addressing List |
|
106 */ |
|
107 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
108 //#ifdef __FS_ALFRED_SUPPORT |
|
109 IMPORT_C static CFsFastAddressingList* NewL( CAlfEnv& aEnv, |
|
110 MFsFastAddressingListObserver& aObserver ); |
|
111 /*#else // !__FS_ALFRED_SUPPORT |
|
112 IMPORT_C static CFsFastAddressingList* NewL( CHuiEnv& aEnv, |
|
113 MFsFastAddressingListObserver& aObserver ); |
|
114 #endif // __FS_ALFRED_SUPPORT*/ |
|
115 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
116 |
|
117 /** |
|
118 * Destructor. |
|
119 */ |
|
120 virtual ~CFsFastAddressingList(); |
|
121 |
|
122 /** |
|
123 * Sets selected icon using a filename. |
|
124 * |
|
125 * @param aIconID point to which icon is to be set {EIconA, EIconB} |
|
126 * @param aFilename Filename containing an icon graph. |
|
127 */ |
|
128 IMPORT_C void SetIconL( const TIconID aIconID, const TDesC& aFilename ); |
|
129 |
|
130 /** |
|
131 * Sets selected icon using a Bitmap. |
|
132 * |
|
133 * @param aIconID point to which icon is to be set {EIconA, EIconB} |
|
134 * @param aBitmap Icon bitmap. |
|
135 */ |
|
136 IMPORT_C void SetIconL( const TIconID aIconID, const CFbsBitmap* aBitmap ); |
|
137 |
|
138 /** |
|
139 * Sets visibility of the icon. |
|
140 * |
|
141 * @param aIconID point to which icon is to be set {EIconA, EIconB} |
|
142 * @param aVisible Visibility status to set {ETrue, EFalse} |
|
143 */ |
|
144 IMPORT_C void SetIconVisible( const TIconID aIconID, |
|
145 const TBool aVisible ); |
|
146 |
|
147 /** |
|
148 * Returns the status of icon visibility. |
|
149 * |
|
150 * @param aIconID point to which icon is to be set {EIconA, EIconB} |
|
151 * @return Visibility status. |
|
152 */ |
|
153 IMPORT_C TBool IconVisible( const TIconID aIconID ) const; |
|
154 |
|
155 public: // text input field manipulation |
|
156 |
|
157 /** |
|
158 * Sets status of Atomic mode of the text input field. |
|
159 * |
|
160 * @param aAtomic Status to be set {ETrue, EFalse} |
|
161 */ |
|
162 IMPORT_C void SetTextInputFieldAtomic( const TBool aAtomic ); |
|
163 |
|
164 /** |
|
165 * Returns the status of Atomic mode of the text input field. |
|
166 * |
|
167 * @return Status of Atomic mode {ETrue, EFalse} |
|
168 */ |
|
169 IMPORT_C TBool TextInputFieldAtomic() const; |
|
170 |
|
171 |
|
172 /** |
|
173 * Sets the ReadOnly mode of the text input field. |
|
174 * |
|
175 * @param aReadOnly Status to be set {ETrue, EFalse} |
|
176 */ |
|
177 IMPORT_C void SetTextInputFieldReadOnly( const TBool aReadOnly ); |
|
178 |
|
179 /** |
|
180 * Returns the status of ReadOnly mode of the text input field. |
|
181 * |
|
182 * @return Status of ReadOnly mode {ETrue, EFalse} |
|
183 */ |
|
184 IMPORT_C TBool TextInputFieldReadOnly() const; |
|
185 |
|
186 /** |
|
187 * Sets content of the text input field to aText. |
|
188 * |
|
189 * @param aText Text to be set in the text input field |
|
190 */ |
|
191 IMPORT_C void SetTextFieldContentsL( const TDesC& aText ); |
|
192 |
|
193 /** |
|
194 * Returns content of the text input field. |
|
195 * |
|
196 * @param aText TDesC to which the content will be copied. |
|
197 */ |
|
198 IMPORT_C void TextFieldContents( TDes& aText ) const; |
|
199 |
|
200 |
|
201 /** |
|
202 * Sets the text input field visibility. |
|
203 * |
|
204 * @param aVisibility of the text input field. |
|
205 */ |
|
206 IMPORT_C void SetTextFieldVisibile( const TBool aVisibility ); |
|
207 |
|
208 /** |
|
209 * Retruns the text input field visibility |
|
210 * |
|
211 * @return TBool visibility of the text input field. |
|
212 */ |
|
213 IMPORT_C TBool IsTextFieldVisible() const; |
|
214 |
|
215 |
|
216 public: // list manipulation |
|
217 |
|
218 enum TFsListPosition |
|
219 { |
|
220 EListOnTopOfTextField, |
|
221 EListBelowTextField |
|
222 }; |
|
223 |
|
224 /** |
|
225 * Sets visibility of the list. |
|
226 * |
|
227 * @param aVisible Visibility status to set {ETrue, EFalse} |
|
228 */ |
|
229 IMPORT_C void SetListVisibility( const TBool aVisible ); |
|
230 |
|
231 /** |
|
232 * Returns the status of the list visibility. |
|
233 * |
|
234 * @return Visibility status. |
|
235 */ |
|
236 IMPORT_C TBool ListVisibile() const; |
|
237 |
|
238 /** |
|
239 * Sets items in the list. |
|
240 * |
|
241 * @param aItemTexts Items to be set in the list. |
|
242 */ |
|
243 IMPORT_C void SetListItemsL( const RPointerArray<HBufC>& aItemTexts ); |
|
244 |
|
245 /** |
|
246 * Adds item to the list. |
|
247 * |
|
248 * @param aItemText Item to be added to the list. |
|
249 */ |
|
250 IMPORT_C void AddListItemL( const TDesC& aItemText ); |
|
251 |
|
252 /** |
|
253 * Highilght passed text. |
|
254 * |
|
255 * @param aText Text to be highlighted. |
|
256 */ |
|
257 IMPORT_C void HighlightText( const TDesC& aText ); |
|
258 |
|
259 |
|
260 /** |
|
261 * Sets position of the list |
|
262 * |
|
263 * @param aPos Position to be set {EListOnTopOfTextField, |
|
264 * EListBelowTextField} |
|
265 */ |
|
266 IMPORT_C void SetListPosition( const TFsListPosition aPos ); |
|
267 |
|
268 /** |
|
269 * Returns the position of the list. |
|
270 * |
|
271 * @return Position of the list {EListOnTopOfTextField, |
|
272 * EListBelowTextField} |
|
273 */ |
|
274 TFsListPosition ListPosition() const; |
|
275 |
|
276 /** |
|
277 * Sets visibility of the scrollbar. |
|
278 * |
|
279 * @param aVisible Visibility status to set {ETrue, EFalse} |
|
280 */ |
|
281 // use enum from CFsTreeList: on, off, automatic |
|
282 IMPORT_C void SetScrollbarVisibility( const TBool aVisible ); |
|
283 |
|
284 /** |
|
285 * Returns the status of the scrollbar visibility. |
|
286 * |
|
287 * @return Visibility status. |
|
288 */ |
|
289 // use enum from CFsTreeList: on, off, automatic |
|
290 IMPORT_C TBool ScrollbarVisibility() const; |
|
291 |
|
292 /** |
|
293 * Access to the list component is provided as a convenience - |
|
294 * this allows the controller the liberty to use all public methods |
|
295 * of CFsTreeList directly. |
|
296 * |
|
297 * @return Reference to the CFsTreeList component. |
|
298 */ |
|
299 IMPORT_C CFsTreeList& List() const; |
|
300 |
|
301 public: // from class CHuiControl |
|
302 /** |
|
303 * From CHuiControl. |
|
304 * Called when an input event is being offered to the control. |
|
305 * |
|
306 * @param aEvent Event to be handled. |
|
307 * @return ETrue, if the event was handled. Otherwise EFalse. |
|
308 */ |
|
309 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
310 //#ifdef __FS_ALFRED_SUPPORT |
|
311 IMPORT_C TBool OfferEventL( const TAlfEvent &aEvent ); |
|
312 /*#else // !__FS_ALFRED_SUPPORT |
|
313 IMPORT_C TBool OfferEventL( const THuiEvent &aEvent ); |
|
314 #endif // __FS_ALFRED_SUPPORT*/ |
|
315 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
316 |
|
317 /** |
|
318 * From CHuiControl |
|
319 * Notifies the control that one of the visuals it ows has been laid out. |
|
320 * Called automatically from CHuiVisual::UpdateChildrenLayout(). |
|
321 * For example, occurs when a parent layout is resized. |
|
322 * |
|
323 * @param aVisual Visual whose layout was updated. |
|
324 */ |
|
325 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
326 //#ifdef __FS_ALFRED_SUPPORT |
|
327 IMPORT_C void VisualLayoutUpdated( CAlfVisual& aVisual ); |
|
328 /*#else // !__FS_ALFRED_SUPPORT |
|
329 IMPORT_C void VisualLayoutUpdated( CHuiVisual& aVisual ); |
|
330 #endif // __FS_ALFRED_SUPPORT*/ |
|
331 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
332 |
|
333 |
|
334 /** |
|
335 * From CHuiControl. |
|
336 * Notifies the control that its visible has been changed on a display. |
|
337 * This is the earliest time when the control knows the dimensions of the |
|
338 * display it is being shown on. |
|
339 * |
|
340 * @param aIsVisible ETrue, if the control is now visible on the display. |
|
341 * EFalse, if the control is about to the hidden |
|
342 * on the display. |
|
343 * @param aDisplay The display on which the control's |
|
344 * visibility is changing. |
|
345 */ |
|
346 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
347 //#ifdef __FS_ALFRED_SUPPORT |
|
348 IMPORT_C void NotifyControlVisibility( TBool aIsVisible, |
|
349 CAlfDisplay& aDisplay ); |
|
350 /*#else // !__FS_ALFRED_SUPPORT |
|
351 IMPORT_C void NotifyControlVisibility( TBool aIsVisible, |
|
352 CHuiDisplay& aDisplay ); |
|
353 #endif // __FS_ALFRED_SUPPORT*/ |
|
354 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
355 |
|
356 |
|
357 public: // From class MFsTextInputFieldObserver |
|
358 |
|
359 /** |
|
360 * From MFsTextInputFieldObserver |
|
361 * Called by input text field when an event occures. |
|
362 * |
|
363 * @param aTextInputField Event sender |
|
364 * @param aEventType Event type |
|
365 */ |
|
366 IMPORT_C void HandleTextInputEventL( CFsTextInputField* aTextInputField, |
|
367 MFsTextInputFieldObserver::TFsTextInputEventType aEventType ); |
|
368 |
|
369 |
|
370 |
|
371 private: |
|
372 /** |
|
373 * Constructor |
|
374 * |
|
375 * @param aEnv Reference to CHuiEnv environment |
|
376 * @param aObserver Observer which will receive events from |
|
377 * Fast Addressing List |
|
378 */ |
|
379 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
380 //#ifdef __FS_ALFRED_SUPPORT |
|
381 CFsFastAddressingList( CAlfEnv& aEnv, |
|
382 MFsFastAddressingListObserver& aObserver ); |
|
383 /*#else // !__FS_ALFRED_SUPPORT |
|
384 CFsFastAddressingList( CHuiEnv& aEnv, |
|
385 MFsFastAddressingListObserver& aObserver ); |
|
386 #endif // __FS_ALFRED_SUPPORT*/ |
|
387 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
388 |
|
389 /** |
|
390 * Two phase constructor. |
|
391 */ |
|
392 //<cmail> removed __FS_ALFRED_SUPPORT flag#ifdef __FS_ALFRED_SUPPORT |
|
393 void ConstructL( CAlfEnv& aEnv ); |
|
394 #else // !__FS_ALFRED_SUPPORT |
|
395 void ConstructL( CHuiEnv& aEnv ); |
|
396 #endif // __FS_ALFRED_SUPPORT |
|
397 |
|
398 /** |
|
399 * Select highlighted text and copies into text input field |
|
400 */ |
|
401 void MakeSelection(); |
|
402 |
|
403 /** |
|
404 * Select next item on the list. |
|
405 */ |
|
406 void MoveSelectionDown(); |
|
407 |
|
408 /** |
|
409 * Select previous item on the list. |
|
410 */ |
|
411 void MoveSelectionUp(); |
|
412 |
|
413 /** |
|
414 * Sets text input mode |
|
415 */ |
|
416 void SetTextInputMode(); |
|
417 |
|
418 /** |
|
419 * Called when text input field was modified. |
|
420 */ |
|
421 void TextInputFieldModified(); |
|
422 |
|
423 private: // data |
|
424 |
|
425 /** |
|
426 * Fied where the text is typed. |
|
427 * Owned. |
|
428 */ |
|
429 CFsTextInputField* iTextInputField; |
|
430 |
|
431 /** |
|
432 * FAL observer. It is informed about changes in FAL. |
|
433 * Not owned. |
|
434 */ |
|
435 MFsFastAddressingListObserver& iObserver; |
|
436 |
|
437 /** |
|
438 * Image for Icon A |
|
439 */ |
|
440 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
441 //#ifdef __FS_ALFRED_SUPPORT |
|
442 TAlfImage iIconA; |
|
443 /*#else // !__FS_ALFRED_SUPPORT |
|
444 THuiImage iIconA; |
|
445 #endif // __FS_ALFRED_SUPPORT*/ |
|
446 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
447 /** |
|
448 * Image for Icon B |
|
449 */ |
|
450 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
451 //#ifdef __FS_ALFRED_SUPPORT |
|
452 TAlfImage iIconB; |
|
453 /*#else // !__FS_ALFRED_SUPPORT |
|
454 THuiImage iIconB; |
|
455 #endif // __FS_ALFRED_SUPPORT*/ |
|
456 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
457 /** |
|
458 * List with set of items that matches the typed text. |
|
459 * Owned. |
|
460 */ |
|
461 CFsTreeList* iTreeList; |
|
462 |
|
463 /** |
|
464 * Visualisation of the FAL component. |
|
465 * Owned. |
|
466 */ |
|
467 CFsFastAddressingVisualizer* iVisualizer; |
|
468 |
|
469 /** |
|
470 * Visualisation of the list passed to tree list component. |
|
471 * Not owned. |
|
472 */ |
|
473 CFsTreeVisualizerBase* iTreeVisualizer; |
|
474 |
|
475 /** |
|
476 * Array of items added to the tree list. |
|
477 */ |
|
478 RPointerArray<MFsTreeItemData> iPlainItemDataArr; |
|
479 |
|
480 /** |
|
481 * Array of visualizers for items added to the tree list. |
|
482 */ |
|
483 RPointerArray<MFsTreeItemVisualizer> iPlainItemVisualizerArr; |
|
484 |
|
485 }; |
|
486 |
|
487 #endif // C_FSFASTADDRESSINGLIST_H |