author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:50:15 +0300 | |
branch | RCL_3 |
changeset 72 | a5e7a4f63858 |
parent 59 | 978afdc0236f |
permissions | -rw-r--r-- |
56 | 1 |
/* |
2 |
* Copyright (c) 1997-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: Base class for an on-screen list box control from |
|
15 |
* which one or more items can be selected. |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
#ifndef __EIKLBX_H__ |
|
20 |
#define __EIKLBX_H__ |
|
21 |
||
22 |
// INCLUDES |
|
23 |
#include <gdi.h> |
|
24 |
#include <eikbctrl.h> |
|
25 |
#include <eiklbo.h> |
|
26 |
#include <eiksbfrm.h> |
|
27 |
#include <eiklbm.h> |
|
28 |
#include <eiklbv.h> |
|
29 |
#include <gulbordr.h> |
|
30 |
#include <eiklbed.h> |
|
31 |
#include <gulutil.h> |
|
32 |
#include <lafpublc.h> |
|
33 |
||
34 |
// FORWARD DECLARATIONS |
|
35 |
enum TKeyCode; |
|
36 |
class RIncrMatcherBase; |
|
37 |
class CListItemDrawer; |
|
38 |
class CEikScrollBarFrame; |
|
39 |
class CEikButtonBase; |
|
40 |
class CMatchBuffer; |
|
41 |
class CListBoxExt; |
|
42 |
class CEikListBox; |
|
43 |
class MAknMarkingModeObserver; |
|
44 |
||
45 |
// CLASS DECLARATION |
|
46 |
||
47 |
/** |
|
48 |
* Item change observer will be notified when list box items have been added or |
|
49 |
* removed or the list box has been reset. Observers can be added and removed by |
|
50 |
* using @c CEikListBox methods @c AddItemChangeObserverL() and |
|
51 |
* @c RemoveItemChangeObserver(). |
|
52 |
* |
|
53 |
* @since 3.0 |
|
54 |
*/ |
|
55 |
class MListBoxItemChangeObserver |
|
56 |
{ |
|
57 |
public: |
|
58 |
/** |
|
59 |
* Notification and handling of a list box item change. |
|
60 |
* |
|
61 |
* @param aListBox The source list box of this message. |
|
62 |
*/ |
|
63 |
virtual void ListBoxItemsChanged(CEikListBox* aListBox) = 0; |
|
64 |
}; |
|
65 |
||
66 |
||
67 |
/** |
|
68 |
* Item selection (marking) observer is used to let application control item marking |
|
69 |
* (in markable lists). Observers can be added and removed by using |
|
70 |
* @c CEikListBox methods @c AddSelectionObserverL() and |
|
71 |
* @c RemoveSelectionObserver(). |
|
72 |
* |
|
73 |
* @since 3.2 |
|
74 |
*/ |
|
75 |
class MListBoxSelectionObserver |
|
76 |
{ |
|
77 |
public: |
|
78 |
/** |
|
79 |
* Notification of entering and leaving marking mode. Marking mode |
|
80 |
* is enabled by long pressing shift, ctrl or hash keys (when hash key marking is enabled). |
|
81 |
* |
|
82 |
* @param aListBox The source list box of this message. |
|
83 |
* @param aSelectionModeEnabled ETrue, when entering selection (marking) mode. |
|
84 |
*/ |
|
85 |
virtual void SelectionModeChanged(CEikListBox* aListBox, TBool aSelectionModeEnabled) = 0; |
|
86 |
}; |
|
87 |
||
88 |
||
89 |
// CLASS DECLARATION |
|
90 |
||
91 |
/** |
|
92 |
* Base class for an on-screen list box control from which one or more items |
|
93 |
* can be selected. |
|
94 |
* |
|
95 |
* @c CEikListBox implements the basics of a list box. It has a scroll bar |
|
96 |
* frame, an item drawer, and a model, and reports events to a list box |
|
97 |
* observer. |
|
98 |
* |
|
99 |
* List boxes display a number of items within a scrolling frame; the items |
|
100 |
* in a list box which are visible at one time are represented by a list |
|
101 |
* box view. |
|
102 |
* |
|
103 |
* Writing derived classes: |
|
104 |
* |
|
105 |
* This class may be derived from to provide specialisations of the basic |
|
106 |
* list box behaviour. It is usual when subclassing CEikListBox to also |
|
107 |
* provide specialisations of CListItemDrawer and CListBoxView for |
|
108 |
* representing the data of such a list box effectively |
|
109 |
*/ |
|
110 |
class CEikListBox : public CEikBorderedControl, public MEikScrollBarObserver |
|
111 |
{ |
|
112 |
||
113 |
public: |
|
114 |
||
115 |
friend class CListBoxExt; |
|
116 |
||
117 |
public: |
|
118 |
||
119 |
/** |
|
120 |
* Construction flags. |
|
121 |
*/ |
|
122 |
enum TFlags |
|
123 |
{ |
|
124 |
||
125 |
/** |
|
126 |
* Construction flag for a list box from which the user can |
|
127 |
* select multiple items. |
|
128 |
*/ |
|
129 |
EMultipleSelection = SLafListBox::EMultipleSelection, |
|
130 |
||
131 |
/** |
|
132 |
* Construction flag for disabling extended selection. |
|
133 |
* If this is set the user cannot select multiple items by |
|
134 |
* using @c SHIFT button. |
|
135 |
*/ |
|
136 |
ENoExtendedSelection = SLafListBox::ENoExtendedSelection, |
|
137 |
||
138 |
/** |
|
139 |
* Construction flag that sets the list box to match user?s keystrokes |
|
140 |
* incrementally. |
|
141 |
*/ |
|
142 |
EIncrementalMatching = SLafListBox::EIncrementalMatching, |
|
143 |
||
144 |
/** |
|
145 |
* Construction flag for setting the list box as a pop-out list box. |
|
146 |
* Pop-out list boxes handle certain keystrokes and events differently. |
|
147 |
*/ |
|
148 |
EPopout = SLafListBox::EPopout, |
|
149 |
||
150 |
/** |
|
151 |
* Construction flag that enables the indication of pointer press |
|
152 |
* inside the view of the list box. |
|
153 |
*/ |
|
154 |
ELeftDownInViewRect = SLafListBox::ELeftDownInViewRect, |
|
155 |
||
156 |
/** |
|
157 |
* Construction flag for enabling @c CEiklist box item double click |
|
158 |
* indication. |
|
159 |
*/ |
|
160 |
EItemDoubleClicked = SLafListBox::EItemDoubleClicked, |
|
161 |
||
162 |
/** |
|
163 |
* Construction flag for removing the ownership of the supplied list box |
|
164 |
* model from the @c CEikListBox so that the list box model will not be |
|
165 |
* deleted with the @c CEikListBoxes destruction. |
|
166 |
*/ |
|
167 |
EKeepModel = SLafListBox::EKeepModel, |
|
168 |
||
169 |
/** |
|
170 |
* Construction flag for excluding the scroll bar. |
|
171 |
* If the flag is set the scroll bas is drawn ouside the window that |
|
172 |
* describes the scroll bars extent. |
|
173 |
*/ |
|
174 |
EScrollBarSizeExcluded = SLafListBox::EScrollBarSizeExcluded, |
|
175 |
||
176 |
/** |
|
177 |
* Construction flag for enabling @c CEikListBox change indication. |
|
178 |
*/ |
|
179 |
EStateChanged = SLafListBox::EStateChanged, |
|
180 |
||
181 |
/** |
|
182 |
* Construction flag that indicates that the list box should be created |
|
183 |
* to its own window. |
|
184 |
*/ |
|
185 |
ECreateOwnWindow = SLafListBox::ECreateOwnWindow, |
|
186 |
||
187 |
/** |
|
188 |
* Construction flag for disabling key matching. |
|
189 |
*/ |
|
190 |
ENoFirstLetterMatching = SLafListBox::ENoFirstLetterMatching, |
|
191 |
||
192 |
/** |
|
193 |
* Construction flag for enabling painting of selected items. |
|
194 |
*/ |
|
195 |
EPaintedSelection = SLafListBox::EPaintedSelection , |
|
196 |
||
197 |
/** |
|
198 |
* Construction flag for enabling loop scrolling in which the list box |
|
199 |
* jumps from the last item to the first item. |
|
200 |
*/ |
|
201 |
ELoopScrolling = 0x1000, |
|
202 |
||
203 |
/** |
|
204 |
* Construction flag for enabling @c Avkon multiselection list. |
|
205 |
*/ |
|
206 |
EEnterMarks = 0x2000, // Avkon multiselection list |
|
207 |
||
208 |
/** |
|
209 |
* Construction flag for enabling Avkon markable list which enables the |
|
210 |
* marking of several items from the list. |
|
211 |
*/ |
|
212 |
EShiftEnterMarks = 0x4000, // Avkon markable list |
|
213 |
||
214 |
/** |
|
215 |
* Construction flag that combines @c EPageAtOnceScrolling and |
|
216 |
* @c EDisableHighlight flags |
|
217 |
*/ |
|
218 |
EViewerFlag = 0x8000, // combined the two flags to fit to WORD. |
|
219 |
||
220 |
/** |
|
221 |
* Construction flag for enabling scrolling at a page per time so that |
|
222 |
* the whole list box page is scrolled to the next. |
|
223 |
*/ |
|
224 |
EPageAtOnceScrolling = 0x8000, // Avkon viewers |
|
225 |
||
226 |
/** |
|
227 |
* Construction flag for disabling the highlighting of the selected item. |
|
228 |
*/ |
|
229 |
EDisableHighlight = 0x8000, // Avkon viewers |
|
230 |
||
231 |
/** |
|
232 |
* Construction flag for enabling S60 style selection of multiple items |
|
233 |
* from the list box. |
|
234 |
*/ |
|
235 |
ES60StyleMultiselection = SLafListBox::ES60StyleMultiselection, |
|
236 |
||
237 |
/** |
|
238 |
* Construction flag for enabling S60 style markable items. |
|
239 |
*/ |
|
240 |
ES60StyleMarkable = SLafListBox::ES60StyleMarkable, |
|
241 |
||
242 |
/** |
|
243 |
* Construction flag for disabling item specific stylus popup menu. |
|
244 |
*/ |
|
245 |
EDisableItemSpecificMenu = 0x00040000, |
|
246 |
||
247 |
/** |
|
248 |
* Construction flag to make item specific stylus popup menu always |
|
249 |
* shown regardless of list's marking state if the tapped item has |
|
250 |
* associated commands. |
|
251 |
*/ |
|
252 |
EItemSpecificMenuAlwaysShown = 0x00080000 |
|
253 |
}; |
|
254 |
||
255 |
enum {KEikMaxMatchingBufferLength = 2}; |
|
256 |
||
257 |
/** |
|
258 |
* Indicates who owns the scroll bar. |
|
259 |
*/ |
|
260 |
enum TScrollBarOwnerShip |
|
261 |
{ |
|
262 |
/** |
|
263 |
* Indicates that the scrollbar is not owned by an external class. |
|
264 |
*/ |
|
265 |
ENotOwnedExternally=0x0000, |
|
266 |
/** |
|
267 |
* Indicates that the scrollbar is owned by an external class. |
|
268 |
*/ |
|
269 |
EOwnedExternally =0x0001 |
|
270 |
}; |
|
271 |
||
272 |
protected: |
|
273 |
||
274 |
/** |
|
275 |
* Used for indicating the reason why the item lost focus. |
|
276 |
*/ |
|
277 |
enum TReasonForFocusLost |
|
278 |
{ |
|
279 |
/** |
|
280 |
* Focus has been lost from the list box to an external control. |
|
281 |
*/ |
|
282 |
EFocusLostToExternalControl, |
|
283 |
/** |
|
284 |
* Focus has been moved from the list box to an internal editor. |
|
285 |
*/ |
|
286 |
EFocusLostToInternalEditor |
|
287 |
}; |
|
288 |
||
289 |
public: |
|
290 |
/** |
|
291 |
* Destructor. |
|
292 |
*/ |
|
293 |
IMPORT_C ~CEikListBox(); |
|
294 |
||
295 |
/** |
|
296 |
* C++ default constructor. |
|
297 |
*/ |
|
298 |
IMPORT_C CEikListBox(); |
|
299 |
/** |
|
300 |
* Handles 2nd phase construction. |
|
301 |
* |
|
302 |
* Sets list box model and list item drawer. Request another @c ConstructL |
|
303 |
* to handle @c aParent and @c aFlags. |
|
304 |
* |
|
305 |
* @param aListBoxModel List box model that is to be used with the list box. |
|
306 |
* @param aListItemDrawer List item drawer that is to be used with the |
|
307 |
* list box. |
|
308 |
* @param aParent Host @c CoeControl for the list box. |
|
309 |
* @param aFlags Construction flags (@c TFlags) for the list box. |
|
310 |
*/ |
|
311 |
IMPORT_C void ConstructL(MListBoxModel* aListBoxModel, |
|
312 |
CListItemDrawer* aListItemDrawer, |
|
313 |
const CCoeControl* aParent, |
|
314 |
TInt aFlags = 0); |
|
315 |
||
316 |
/** |
|
317 |
* Handles 2nd phase construction. |
|
318 |
* |
|
319 |
* |
|
320 |
* Sets the border that is to be drawn outside the list box. Request another |
|
321 |
* @c ConstructL to handle list box model, list item drawer, @c aParent |
|
322 |
* and @c aFlags. |
|
323 |
* |
|
324 |
* @param aListBoxModel List box model that is to be used with the list box. |
|
325 |
* @param aListItemDrawer List item drawer that is to be used with the |
|
326 |
* list box. |
|
327 |
* @param aParent Host @c CoeControl for the list box. |
|
328 |
* @param aBorder Border to be drawn outside the list box. |
|
329 |
* @param aFlags Construction flags (@c TFlags) for the list box. |
|
330 |
*/ |
|
331 |
IMPORT_C void ConstructL(MListBoxModel* aListBoxModel, |
|
332 |
CListItemDrawer* aListItemDrawer, |
|
333 |
const CCoeControl* aParent, |
|
334 |
TGulBorder aBorder, |
|
335 |
TInt aFlags = 0); |
|
336 |
/** |
|
337 |
* Informs the @c CEikListbox of a key press. |
|
338 |
* |
|
339 |
* @param aKeyEvent Details of the key event that is being handled. |
|
340 |
* @param aType Defines what kind of key event is being handled e.g. |
|
341 |
* @c EEventKeyUp. |
|
342 |
* @return @c EKeyWasConsumed if the key was handled by the method. |
|
343 |
* @c EKeyWasNotConsumed if the key was not handled. |
|
344 |
*/ |
|
345 |
IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
346 |
TEventCode aType); |
|
347 |
||
348 |
/** |
|
349 |
* Handling of pointer event within the @c CEikListBox. |
|
350 |
* Used for e.g. selecting an item from the list box. |
|
351 |
* |
|
352 |
* @param aPointerEvent Details of the pointer event that is being handled. |
|
353 |
*/ |
|
354 |
IMPORT_C virtual void HandlePointerEventL( |
|
355 |
const TPointerEvent& aPointerEvent); |
|
356 |
||
357 |
/** |
|
358 |
* Creates an own window for the list box or draws the list box to an old |
|
359 |
* window defined by the @c aContainer. |
|
360 |
* |
|
361 |
* @param aContainer Defines the container where the list box will be drawn. |
|
362 |
*/ |
|
363 |
IMPORT_C virtual void SetContainerWindowL(const CCoeControl& aContainer); |
|
364 |
||
365 |
/** |
|
366 |
* Checks the minimum size needed for the list box. |
|
367 |
* |
|
368 |
* @return The two dimensional minimum size for the list box. |
|
369 |
*/ |
|
370 |
IMPORT_C virtual TSize MinimumSize(); |
|
371 |
||
372 |
/** |
|
373 |
* This function sets a flag within the control which indicates |
|
374 |
* whether or not the control is dimmed (greyed out). |
|
375 |
* |
|
376 |
* @param aDimmed @c ETrue dimmed. @c EFalse not dimmed. |
|
377 |
*/ |
|
378 |
IMPORT_C virtual void SetDimmed(TBool aDimmed); |
|
379 |
||
380 |
/** |
|
381 |
* Used for scrolling through the items in the list box. |
|
382 |
* |
|
383 |
* @param aScrollBar Scroll bar for the list box. |
|
384 |
* @param aEventType Type of the event that occured. |
|
385 |
*/ |
|
386 |
IMPORT_C virtual void HandleScrollEventL(CEikScrollBar* aScrollBar, |
|
387 |
TEikScrollEvent aEventType); |
|
388 |
||
389 |
// model/view access functions |
|
390 |
/** |
|
391 |
* Gets the list box data model. |
|
392 |
* |
|
393 |
* @return Interface to the list box data model. |
|
394 |
*/ |
|
395 |
IMPORT_C MListBoxModel* Model() const; |
|
396 |
||
397 |
/** |
|
398 |
* Gets the list box view. |
|
399 |
* |
|
400 |
* @return Interface to the list box view. |
|
401 |
*/ |
|
402 |
IMPORT_C CListBoxView* View() const; |
|
403 |
||
404 |
// functions for accessing top/current/bottom item index |
|
405 |
/** |
|
406 |
* Gets the index number of the top item. |
|
407 |
* |
|
408 |
* @return Index number for the top item. |
|
409 |
*/ |
|
410 |
IMPORT_C TInt TopItemIndex() const; |
|
411 |
||
412 |
/** |
|
413 |
* Sets the selected item to be the top item. |
|
414 |
* |
|
415 |
* @param aItemIndex Index for the item to be set as the top item. |
|
416 |
*/ |
|
417 |
IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex) const; |
|
418 |
||
419 |
/** |
|
420 |
* Gets for the bottom items index. |
|
421 |
* |
|
422 |
* @return Index for the bottom item. |
|
423 |
*/ |
|
424 |
IMPORT_C TInt BottomItemIndex() const; |
|
425 |
||
426 |
/** |
|
427 |
* Gets the index number of the selected item. |
|
428 |
* |
|
429 |
* @return Index of the selected item. |
|
430 |
*/ |
|
431 |
IMPORT_C TInt CurrentItemIndex() const; |
|
432 |
||
433 |
/** |
|
434 |
* Changes the current item index to the selected item index. Does not |
|
435 |
* redraw the list. If the item was not previously visible it is set to the |
|
436 |
* top item in the view. |
|
437 |
* |
|
438 |
* @param aItemIndex Defines the index of the selected item. |
|
439 |
*/ |
|
440 |
IMPORT_C void SetCurrentItemIndex(TInt aItemIndex) const; |
|
441 |
||
442 |
/** |
|
443 |
* Changes the current item index to the selected item index and |
|
444 |
* redraws the view. |
|
445 |
* |
|
446 |
* @param aItemIndex Defines the index of the selected item. |
|
447 |
*/ |
|
448 |
IMPORT_C void SetCurrentItemIndexAndDraw(TInt aItemIndex) const; |
|
449 |
||
450 |
// functions for dealing with the selection state |
|
451 |
/** |
|
452 |
* Gets for list boxes selection indexes. |
|
453 |
* |
|
454 |
* @return Pointer to the list boxes in array of selection indexes. |
|
455 |
*/ |
|
456 |
IMPORT_C const CListBoxView::CSelectionIndexArray* SelectionIndexes() const; |
|
457 |
||
458 |
/** |
|
459 |
* Assigns a array of selection indexes for the list box. |
|
460 |
* |
|
461 |
* @param aArrayOfSelectionIndexes The index array that is to be assigned |
|
462 |
* to the list Box. |
|
463 |
*/ |
|
464 |
IMPORT_C void SetSelectionIndexesL( |
|
465 |
CListBoxView::CSelectionIndexArray* aArrayOfSelectionIndexes); |
|
466 |
||
467 |
/** |
|
468 |
* Clears the selection from the view. |
|
469 |
*/ |
|
470 |
IMPORT_C void ClearSelection(); |
|
471 |
||
472 |
// Functions for updating a list box's internal state after its model has |
|
473 |
// been updated, all of them will emit item change event to item change |
|
474 |
// observers. |
|
475 |
/** |
|
476 |
* Handles the addition of item to the list box. |
|
477 |
*/ |
|
478 |
IMPORT_C void HandleItemAdditionL(); |
|
479 |
||
480 |
/** |
|
481 |
* Handles the removal of an item from the list box. |
|
482 |
*/ |
|
483 |
IMPORT_C void HandleItemRemovalL(); |
|
484 |
||
485 |
/** |
|
486 |
* Handles the addition of new items to the list box and updates |
|
487 |
* selection indexes array. |
|
488 |
* |
|
489 |
* NOTE. This algorithm can not handle position of the list highlight |
|
490 |
* nor can it update the top item index correctly. |
|
491 |
* |
|
492 |
* @param aArrayOfNewIndexesAfterAddition Array of new indexes to be added. |
|
493 |
*/ |
|
494 |
IMPORT_C void HandleItemAdditionL( |
|
495 |
CArrayFix<TInt> &aArrayOfNewIndexesAfterAddition); |
|
496 |
||
497 |
/** |
|
498 |
* Handles the removal of items to the list box and updates |
|
499 |
* selection indexes array. |
|
500 |
* |
|
501 |
* NOTE. This algorithm cannot handle position of the list highlight |
|
502 |
* nor can it update the top item index correctly. |
|
503 |
* |
|
504 |
* @param aArrayOfOldIndexesBeforeRemoval Array of indexes to be removed. |
|
505 |
*/ |
|
506 |
IMPORT_C void HandleItemRemovalL( |
|
507 |
CArrayFix<TInt> &aArrayOfOldIndexesBeforeRemoval); |
|
508 |
||
509 |
/** |
|
510 |
* Deletes the item editor |
|
511 |
*/ |
|
512 |
IMPORT_C void Reset(); |
|
513 |
||
514 |
/** |
|
515 |
* Adds an item change observer to the listbox. Duplicates are not checked |
|
516 |
* (i.e. adding the same observer multiple times is not prevented). |
|
517 |
* |
|
518 |
* @since 3.0 |
|
519 |
* @param aObserver Must be non-NULL. |
|
520 |
*/ |
|
521 |
IMPORT_C void AddItemChangeObserverL( MListBoxItemChangeObserver* aObserver ); |
|
522 |
/** |
|
523 |
* Removes an item change observer from the listbox. |
|
524 |
* |
|
525 |
* @since 3.0 |
|
526 |
* @param aObserver The observer to be removed. |
|
527 |
* @return ETrue if removal ok, EFalse if observer was not removed (not |
|
528 |
* found from the list of observers). |
|
529 |
*/ |
|
530 |
IMPORT_C TBool RemoveItemChangeObserver( MListBoxItemChangeObserver* aObserver ); |
|
531 |
||
532 |
// functions for accessing the item height |
|
533 |
/** |
|
534 |
* Sets the height of the item to the selected value. |
|
535 |
* |
|
536 |
* @param aHeight New height for the item. |
|
537 |
*/ |
|
538 |
IMPORT_C virtual void SetItemHeightL(TInt aHeight); |
|
539 |
||
540 |
/** |
|
541 |
* Gets height of the item. |
|
542 |
* |
|
543 |
* @return Height of the item. |
|
544 |
*/ |
|
545 |
IMPORT_C TInt ItemHeight() const; |
|
546 |
||
547 |
// functions for scrollbars |
|
548 |
/** |
|
549 |
* Creates a scrollbar frame. |
|
550 |
* |
|
551 |
* @param aPreAlloc Boolean defining if there should be initial |
|
552 |
* memory allocations. |
|
553 |
* @return The new scroll bar frame. |
|
554 |
*/ |
|
555 |
IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc=EFalse); |
|
556 |
||
557 |
/** |
|
558 |
* Sets the given scroll bar frame for the list box with the given |
|
559 |
* ownership leve. |
|
560 |
* |
|
561 |
* @param aScrollBarFrame The new frame that is going to be used. |
|
562 |
* @param aOwnerShip Ownership level of the scroll bar frame. |
|
563 |
*/ |
|
564 |
IMPORT_C void SetScrollBarFrame(CEikScrollBarFrame* aScrollBarFrame, TScrollBarOwnerShip aOwnerShip); |
|
565 |
||
566 |
/** |
|
567 |
* Gets pointer for the scroll bar frame. |
|
568 |
* |
|
569 |
* @return Pointer to the scroll bar frame. |
|
570 |
*/ |
|
571 |
IMPORT_C CEikScrollBarFrame* const ScrollBarFrame(); |
|
572 |
||
573 |
/** |
|
574 |
* Updates all scroll bars. |
|
575 |
*/ |
|
576 |
IMPORT_C virtual void UpdateScrollBarsL(); |
|
577 |
||
578 |
// construction support functions |
|
579 |
/** |
|
580 |
* Gets the size of the rectangle required to display a pop out. |
|
581 |
* |
|
582 |
* @param aTargetItemIndex The item from which the popout originates. |
|
583 |
* @param aTargetYPos Vertical position of the item from which the popout |
|
584 |
* originates. |
|
585 |
* @param aListBoxRect The list box rectangle. |
|
586 |
* @param aMinHeightInNumOfItems The minimum number of items for the popout. |
|
587 |
*/ |
|
588 |
IMPORT_C void CalculatePopoutRect( TInt aTargetItemIndex, |
|
589 |
TInt aTargetYPos, |
|
590 |
TRect& aListBoxRect, |
|
591 |
TInt aMinHeightInNumOfItems = 1 ); |
|
592 |
/** |
|
593 |
* Gets the size of the list box in pixels based on the height of |
|
594 |
* the list box in items and the length of the items in characters. |
|
595 |
* |
|
596 |
* Returns @c TSize element consisting of two elements, the height |
|
597 |
* and the width. Height is the number of items times the height |
|
598 |
* of the font in pixels. Width is the number of characters in a |
|
599 |
* single line times the width of the font in pixels. |
|
600 |
* |
|
601 |
* @param aWidthAsNumOfChars Width of list box in characters. |
|
602 |
* @param aHeightAsNumOfItems Height of list box in characters. |
|
603 |
* @return The size of the list box in pixels as TSize. |
|
604 |
*/ |
|
605 |
IMPORT_C TSize CalcSizeInPixels(TInt aWidthAsNumOfChars, |
|
606 |
TInt aHeightAsNumOfItems) const; |
|
607 |
||
608 |
/** |
|
609 |
* Gets the width of the list box in pixels based on the width of the list |
|
610 |
* box in characters. |
|
611 |
* |
|
612 |
* Returns the number of characters times the width of a character |
|
613 |
* in pixels. |
|
614 |
* |
|
615 |
* @param aNumOfChars The number of characters. |
|
616 |
* @return The width of the list box in pixels. |
|
617 |
*/ |
|
618 |
IMPORT_C TInt CalcWidthBasedOnNumOfChars(TInt aNumOfChars) const; |
|
619 |
||
620 |
/** |
|
621 |
* Gets the height of the list box in pixels based on the width of the |
|
622 |
* list box in characters. |
|
623 |
* |
|
624 |
* Returns the number of items times the height of the font in pixels. |
|
625 |
* |
|
626 |
* @param aNumOfItems The number of items. |
|
627 |
* @return The height of the list box in pixels. |
|
628 |
*/ |
|
629 |
IMPORT_C TInt CalcHeightBasedOnNumOfItems(TInt aNumOfItems) const; |
|
630 |
||
631 |
/** |
|
632 |
* Gets the width of the list box in pixels based on the width of the |
|
633 |
* list box text in pixels. |
|
634 |
* |
|
635 |
* returns the width of the whole list box in pixels, which includes |
|
636 |
* the text width and the width of elements in the list box that have |
|
637 |
* an effect on the overall width. |
|
638 |
* |
|
639 |
* @param aTextWidthInPixels Width of list box text in pixels. |
|
640 |
* @return Required width of whole list box in pixels. |
|
641 |
*/ |
|
642 |
IMPORT_C TInt CalcWidthBasedOnRequiredItemWidth( |
|
643 |
TInt aTextWidthInPixels) const; |
|
644 |
||
645 |
// drawing/scrolling functions |
|
646 |
/** |
|
647 |
* Draws a list box item, first scrolling the list to make it visible |
|
648 |
* if it is not already. |
|
649 |
* |
|
650 |
* @c DrawItem() panics if there is no list box view currently set. |
|
651 |
* @param aItemIndex Index of the item to reveal. |
|
652 |
*/ |
|
653 |
IMPORT_C void DrawItem(TInt aItemIndex) const; |
|
654 |
||
655 |
/** |
|
656 |
* Makes an item visible in the list, scrolling it if necessary. |
|
657 |
* |
|
658 |
* @param aItemIndex Index of the item to reveal. |
|
659 |
*/ |
|
660 |
IMPORT_C void ScrollToMakeItemVisible(TInt aItemIndex) const; |
|
661 |
||
662 |
/** |
|
663 |
* Redraws list item. |
|
664 |
* @param aItemIndex index of item to be redrawn. |
|
665 |
* @since 3.2 |
|
666 |
*/ |
|
667 |
IMPORT_C void RedrawItem( TInt aItemIndex ); |
|
668 |
||
669 |
// observer support |
|
670 |
/** |
|
671 |
* Sets the observer for the list box. |
|
672 |
* |
|
673 |
* @param aObserver Wanted observer for the list box. |
|
674 |
*/ |
|
675 |
IMPORT_C void SetListBoxObserver(MEikListBoxObserver* aObserver); |
|
676 |
||
677 |
||
678 |
/** |
|
679 |
* Gets the size of the vertical gap between items. This space is used |
|
680 |
* by the view to allow a box to be drawn around each item. |
|
681 |
* |
|
682 |
* @return Size of the vertical gap in pixels. |
|
683 |
*/ |
|
684 |
IMPORT_C TInt VerticalInterItemGap() const; |
|
685 |
||
686 |
// popouts only |
|
687 |
/** |
|
688 |
* Provides a call back mechanism to the button which just launched a |
|
689 |
* popout menu. |
|
690 |
* |
|
691 |
* @param aButton The button which just launched a popout menu. |
|
692 |
*/ |
|
693 |
IMPORT_C void SetLaunchingButton(CEikButtonBase* aButton); |
|
694 |
||
695 |
// Editing support |
|
696 |
/** |
|
697 |
* Selects an item editor for the list box. |
|
698 |
* |
|
699 |
* @param aEditor The editor that has been selected for usage. |
|
700 |
*/ |
|
701 |
IMPORT_C void SetItemEditor(MEikListBoxEditor* aEditor); |
|
702 |
||
703 |
/** |
|
704 |
* Resets the list boxes item editor. |
|
705 |
*/ |
|
706 |
IMPORT_C void ResetItemEditor(); |
|
707 |
/** |
|
708 |
* Gets item editor for the current class. |
|
709 |
* |
|
710 |
* @return The item editor used by the list box class. |
|
711 |
*/ |
|
712 |
IMPORT_C MEikListBoxEditor* ItemEditor(); |
|
713 |
||
714 |
/** |
|
715 |
* Creates an item editor and starts editing the current item. |
|
716 |
* |
|
717 |
* The editor can edit the current item up to a maximum length of |
|
718 |
* @c aMaxLength characters. Also reports an @c EEventEditingStarted event |
|
719 |
* to any list box observer by default. |
|
720 |
* |
|
721 |
* The function only creates a new editor if one does not already exist. |
|
722 |
* |
|
723 |
* @param aMaxLength Maximum length of characters to edit. |
|
724 |
*/ |
|
725 |
IMPORT_C virtual void EditItemL(TInt aMaxLength); |
|
726 |
||
727 |
/** |
|
728 |
* Stops editing and deletes the item editor. |
|
729 |
* |
|
730 |
* The function reports an @c EEventEditingStopped event to any list box |
|
731 |
* observer, and updates the list box model if @c aUpdateModel is @c ETrue. |
|
732 |
* |
|
733 |
* @param aUpdateModel If @c ETrue the list box model is updated. |
|
734 |
*/ |
|
735 |
IMPORT_C void StopEditingL(TBool aUpdateModel); |
|
736 |
||
737 |
// functions needed for Avkon shortcuts, |
|
738 |
// passing information from one list to another |
|
739 |
||
740 |
/** |
|
741 |
* No Implementation. |
|
742 |
* |
|
743 |
* @return Always returns 0. |
|
744 |
*/ |
|
745 |
IMPORT_C virtual TInt ShortcutValueForNextList(); |
|
746 |
||
747 |
/** |
|
748 |
* No Implementation. |
|
749 |
* |
|
750 |
* @param aValue Not Used. |
|
751 |
*/ |
|
752 |
IMPORT_C virtual void SetShortcutValueFromPrevList(TInt aValue); |
|
753 |
||
754 |
// pop-up positioning support |
|
755 |
/** |
|
756 |
* Gets the position and the size of the list box. |
|
757 |
* |
|
758 |
* @return A rectangle with the correct position data as |
|
759 |
* well as size data for the list box. |
|
760 |
*/ |
|
761 |
IMPORT_C TRect HighlightRect() const; |
|
762 |
||
763 |
/** |
|
764 |
* Checks whether background drawing is suppressed on item level i.e. each |
|
765 |
* list item doesn't draw its background. |
|
766 |
* |
|
767 |
* @since S60 5.0 |
|
768 |
* @return ETrue if background drawing is suppressed. |
|
769 |
*/ |
|
770 |
IMPORT_C TBool BackgroundDrawingSuppressed() const; |
|
771 |
||
772 |
public: // from CCoeControl |
|
773 |
||
774 |
/** |
|
775 |
* From @c CCoeControl |
|
776 |
* |
|
777 |
* Gets the list of logical colours employed in the drawing of the control, |
|
778 |
* paired with an explanation of how they are used. Appends the list to |
|
779 |
* @c aColorUseList. |
|
780 |
* |
|
781 |
* @param aColorUseList List of logical colours. |
|
782 |
*/ |
|
783 |
IMPORT_C virtual void GetColorUseListL( |
|
784 |
CArrayFix<TCoeColorUse>& aColorUseList) const; |
|
785 |
// not available before Release 005u |
|
786 |
||
787 |
/** |
|
788 |
* From @c CCoeControl |
|
789 |
* |
|
790 |
* Handles a change to the list box?s resources of type @c aType which are |
|
791 |
* shared across the environment, colours or fonts for example. |
|
792 |
* |
|
793 |
* @param aType The type of resources that have changed. |
|
794 |
*/ |
|
795 |
IMPORT_C virtual void HandleResourceChange(TInt aType); |
|
796 |
// not available before Release 005u |
|
797 |
||
798 |
/** |
|
799 |
* From @c CCoeControl |
|
800 |
* |
|
801 |
* Sets the control as ready to be drawn. |
|
802 |
* |
|
803 |
* The application should call this function on all controls that are not |
|
804 |
* components in a compound control. |
|
805 |
* |
|
806 |
* The purpose of this function is that controls are not always ready to |
|
807 |
* be drawn as soon as they have been constructed. For example, it may |
|
808 |
* not be possible to set the control's extent during construction, but |
|
809 |
* its extent should always be set before it is drawn. Similarly, if a |
|
810 |
* control is to be made invisible, this should be done before it is |
|
811 |
* activated. |
|
812 |
* |
|
813 |
* The default implementation sets a flag in the control to indicate it is |
|
814 |
* ready to be drawn. If the control is a compound control, the default |
|
815 |
* implementation also calls @c ActivateL() for all the control's components. |
|
816 |
* To get the control's components it uses @c CountComponentControls() and |
|
817 |
* @c ComponentControl(), which should be implemented by the compound control. |
|
818 |
* |
|
819 |
* @c ActivateL() is typically called from the control's @c ConstructL() |
|
820 |
* function. |
|
821 |
* |
|
822 |
* Notes: |
|
823 |
* |
|
824 |
* This function can be overridden. This is useful for doing late |
|
825 |
* initialisation of the control, using information that was not available |
|
826 |
* at the time the control was created. For example, a text editor might |
|
827 |
* override @c ActivateL() and use it to enquire whether it is focused: if |
|
828 |
* it is, it makes the cursor and any highlighting visible. At the time when |
|
829 |
* the editor is created, it doesn't know whether or not it has keyboard |
|
830 |
* focus. |
|
831 |
* |
|
832 |
* If overriding @c ActivateL(), the implementation must include a base |
|
833 |
* call to @c CCoeControl's @c ActivateL(). |
|
834 |
*/ |
|
835 |
IMPORT_C virtual void ActivateL(); |
|
836 |
||
837 |
/** |
|
838 |
* From @c CCoeControl. |
|
839 |
* |
|
840 |
* Gets the input capabilities of the control and all its components. |
|
841 |
* |
|
842 |
* @return The input capabilities of the control. |
|
843 |
*/ |
|
844 |
IMPORT_C TCoeInputCapabilities InputCapabilities() const; |
|
845 |
||
846 |
private: |
|
847 |
/** |
|
848 |
* From CAknControl |
|
849 |
*/ |
|
850 |
IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
851 |
||
852 |
protected: |
|
853 |
// Shortcuts need access to Incremental matching |
|
854 |
// The shortcuts will be used inside OfferkeyEventL(). |
|
855 |
friend class AknListBoxShortCutsImplementation; |
|
856 |
// Avkon layout uses SetVerticalMargin, which is protected. |
|
857 |
friend class AknListBoxLayouts; |
|
858 |
||
859 |
/** |
|
860 |
* Responds to a change in focus. |
|
861 |
* |
|
862 |
* This is called whenever the control gains or loses focus, |
|
863 |
* as a result of a call to @c SetFocus(). A typical use of |
|
864 |
* @c FocusChanged() is to change the appearance of the control, |
|
865 |
* for example by drawing a focus rectangle around it. |
|
866 |
* |
|
867 |
* The default implementation is empty, and should be |
|
868 |
* overridden by the @c CCoeControl-derived class. |
|
869 |
* |
|
870 |
* @param aDrawNow Contains the value that was passed to it |
|
871 |
* by @c SetFocus(). |
|
872 |
*/ |
|
873 |
IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow); |
|
874 |
||
875 |
/** |
|
876 |
* Responds to changes to the size and position of the contents |
|
877 |
* of this control. |
|
878 |
* |
|
879 |
* For a simple control this might include text or graphics. |
|
880 |
* For a compound control it sets the size and position of the |
|
881 |
* components. It has an empty default implementation and should |
|
882 |
* be implemented by the CCoeControl-derived class. |
|
883 |
* |
|
884 |
* The function is called whenever @c SetExtent(), @c SetSize(), |
|
885 |
* @c SetRect(), @c SetCornerAndSize(), or @c SetExtentToWholeScreen() |
|
886 |
* are called on the control. Note that the window server does not |
|
887 |
* generate size-changed events: @c SizeChanged() gets called only as |
|
888 |
* a result of calling the functions listed above. Therefore, if a |
|
889 |
* resize of one control affects the size of other controls, it is |
|
890 |
* up to the application to ensure that it handles the re-sizing |
|
891 |
* of all affected controls. |
|
892 |
*/ |
|
893 |
IMPORT_C virtual void SizeChanged(); |
|
894 |
||
895 |
/** |
|
896 |
* Handles the change in case that the size of the view rectangle |
|
897 |
* for the list box changes. |
|
898 |
*/ |
|
899 |
IMPORT_C virtual void HandleViewRectSizeChangeL(); |
|
900 |
||
901 |
/** |
|
902 |
* Gets the number of controls contained in a compound control. |
|
903 |
* |
|
904 |
* There are two ways to implement a compound control. One way is to |
|
905 |
* override this function. The other way is to use the @c CCoeControlArray |
|
906 |
* functionality (see the @c InitComponentArrayL method). |
|
907 |
* |
|
908 |
* @return The number of component controls contained by this control. |
|
909 |
*/ |
|
910 |
IMPORT_C virtual TInt CountComponentControls() const; |
|
911 |
||
912 |
/** |
|
913 |
* Gets an indexed component of a compound control. |
|
914 |
* |
|
915 |
* There are two ways to implement a compound control. One way is to |
|
916 |
* override this function. The other way is to use the @c CCoeControlArray |
|
917 |
* functionality (see the @c InitComponentArrayL method). |
|
918 |
* |
|
919 |
* Note: Within a compound control each component control is identified |
|
920 |
* by an index, where the index depends on the order the controls were |
|
921 |
* added: the first is given an index of 0, the next an index of 1, and |
|
922 |
* so on. |
|
923 |
* |
|
924 |
* @param aIndex The index of the control. |
|
925 |
* @return The component control with an index of aIndex. |
|
926 |
*/ |
|
927 |
IMPORT_C virtual CCoeControl* ComponentControl(TInt aIndex) const; |
|
928 |
||
929 |
// functions that implement first letter and incremental matching |
|
930 |
/** |
|
931 |
* Creates a buffer for checking how well two strings match up. |
|
932 |
*/ |
|
933 |
IMPORT_C void CreateMatchBufferL(); |
|
934 |
||
935 |
/** |
|
936 |
* Empties the match buffer . |
|
937 |
*/ |
|
938 |
IMPORT_C void ClearMatchBuffer() const; |
|
939 |
||
940 |
/** |
|
941 |
* Checks matching for the given character. |
|
942 |
* |
|
943 |
* @param aCode Character code. |
|
944 |
*/ |
|
945 |
IMPORT_C void MatchTypedCharL(TUint aCode); |
|
946 |
||
947 |
/** |
|
948 |
* Undoes changes from the match buffer that have been caused |
|
949 |
* by the last match with a character. |
|
950 |
*/ |
|
951 |
IMPORT_C void UndoLastChar(); |
|
952 |
/** |
|
953 |
* Checks if the last character matched with the string. |
|
954 |
* |
|
955 |
* @return @c ETrue if a match was found from the buffer with the character. |
|
956 |
*/ |
|
957 |
IMPORT_C TBool LastCharMatched() const; |
|
958 |
||
959 |
// functions needed for supporting scrollbars |
|
960 |
/** |
|
961 |
* Updates the position of this list box?s scroll bars? thumbs to reflect |
|
962 |
* the horizontal and vertical position of the list view within the list. |
|
963 |
*/ |
|
964 |
IMPORT_C virtual void UpdateScrollBarThumbs() const; |
|
965 |
||
966 |
/** |
|
967 |
* Get horizontal scroll granularity in pixels. |
|
968 |
* The granularity is the minimum size of a horizontal move of the client |
|
969 |
* area. |
|
970 |
* |
|
971 |
* @return Grain size for horizontal scrolling in pixels. |
|
972 |
*/ |
|
973 |
IMPORT_C virtual TInt HorizScrollGranularityInPixels() const; |
|
974 |
||
975 |
/** |
|
976 |
* Gets the number of grains to move horizontally when a nudge button is |
|
977 |
* tapped. |
|
978 |
* For simple list boxes, this value is a fraction of the width of the |
|
979 |
* client area. |
|
980 |
* |
|
981 |
* @return Number of grains to move left or right on each nudge |
|
982 |
*/ |
|
983 |
IMPORT_C virtual TInt HorizontalNudgeValue() const; |
|
984 |
||
985 |
/** |
|
986 |
* Called by various functions of this class to ensure that the top |
|
987 |
* item index is always a sane value. The implementation in @c CEikListBox |
|
988 |
* tries to ensure the minimum amount of white space at the bottom of |
|
989 |
* the list box. Note that this function does not affect the |
|
990 |
* current item index. |
|
991 |
*/ |
|
992 |
IMPORT_C virtual void AdjustTopItemIndex() const; |
|
993 |
||
994 |
// navigation support functions |
|
995 |
/** |
|
996 |
* Simulates an arrow key event. |
|
997 |
* |
|
998 |
* If the list box flags include @c EMultipleSelection, this has the effect |
|
999 |
* of pressing @c SHIFT with the arrow key represented by @c aKeyCode. |
|
1000 |
* Calls @c CEikListBox::OfferKeyEventL() with aKeyCode translated into a |
|
1001 |
* key event. |
|
1002 |
* |
|
1003 |
* @param aKeyCode A key code. |
|
1004 |
*/ |
|
1005 |
IMPORT_C void SimulateArrowKeyEventL(TKeyCode aKeyCode); |
|
1006 |
||
1007 |
/** |
|
1008 |
* Handles a left arrow key event. |
|
1009 |
* |
|
1010 |
* The method used to handle the event depends on the selection mode, e.g. |
|
1011 |
* whether the user has pressed the @c SHIFT or @c CONTROL key. |
|
1012 |
* |
|
1013 |
* @param aSelectionMode Not used |
|
1014 |
*/ |
|
1015 |
IMPORT_C virtual void HandleLeftArrowKeyL(CListBoxView::TSelectionMode aSelectionMode); |
|
1016 |
||
1017 |
/** |
|
1018 |
* Handles a right arrow key event. |
|
1019 |
* |
|
1020 |
* The method used to handle the event depends on the selection mode, |
|
1021 |
* e.g. whether the user has pressed the @c SHIFT or @c CONTROL key. |
|
1022 |
* |
|
1023 |
* @param aSelectionMode Not used. |
|
1024 |
*/ |
|
1025 |
IMPORT_C virtual void HandleRightArrowKeyL(CListBoxView::TSelectionMode aSelectionMode); |
|
1026 |
||
1027 |
// construction support functions |
|
1028 |
/** |
|
1029 |
* Restores the list box properties shared by all subclasses from a resource |
|
1030 |
* reader. This function is not called within @c CEikListBox itself, but is |
|
1031 |
* used by subclasses which support construction from resources. |
|
1032 |
* |
|
1033 |
* @param aReader A resource reader. |
|
1034 |
*/ |
|
1035 |
IMPORT_C void RestoreCommonListBoxPropertiesL(TResourceReader& aReader); |
|
1036 |
||
1037 |
/** |
|
1038 |
* Second-phase constructor. |
|
1039 |
* |
|
1040 |
* This protected form is overridden non-virtually by the second-phase |
|
1041 |
* constructors of each subclass, and should be invoked by them using |
|
1042 |
* @c CEikListBox::ConstructL(). |
|
1043 |
* |
|
1044 |
* @param aParent The parent control. May be NULL. |
|
1045 |
* @param aFlags Construction flags. |
|
1046 |
*/ |
|
1047 |
IMPORT_C virtual void ConstructL(const CCoeControl* aParent, TInt aFlags = 0); |
|
1048 |
||
1049 |
/** |
|
1050 |
* Completes the list box view?s construction. |
|
1051 |
* |
|
1052 |
* This function is called by @c ConstructL() to complete construction |
|
1053 |
* of the resource view, calling its @c ConstructL() with appropriate |
|
1054 |
* arguments and assigning it to @c iView. Also prepares the view for use. |
|
1055 |
*/ |
|
1056 |
IMPORT_C virtual void CreateViewL(); |
|
1057 |
||
1058 |
/** |
|
1059 |
* Creates the list box view. |
|
1060 |
* |
|
1061 |
* The function is called by @c ConstructL() to create an instance of |
|
1062 |
* the appropriate list box view class for this list box. The returned |
|
1063 |
* instance is owned by this object, and does not have to have its |
|
1064 |
* second-phase constructor run. This function is called by @c CreateViewL(). |
|
1065 |
* |
|
1066 |
* @return Pointer to a newly constructed list box view for this object. |
|
1067 |
*/ |
|
1068 |
IMPORT_C virtual CListBoxView* MakeViewClassInstanceL(); |
|
1069 |
||
1070 |
/** |
|
1071 |
* Sets the view rectangle from the client rectangle making sure a whole |
|
1072 |
* number of items is displayed. |
|
1073 |
* |
|
1074 |
* @param aClientRect The client rectangle |
|
1075 |
*/ |
|
1076 |
IMPORT_C void SetViewRectFromClientRect(const TRect& aClientRect); |
|
1077 |
||
1078 |
/** |
|
1079 |
* Calculates the client area. |
|
1080 |
* |
|
1081 |
* This method is called by various functions of this class to |
|
1082 |
* recalculate the extent of the client area from @c iViewRect. This |
|
1083 |
* implementation takes into account any rounding of the viewing |
|
1084 |
* rectangle made to fit a whole number of items. |
|
1085 |
* |
|
1086 |
* @param aClientRect On return contains a size for the client area |
|
1087 |
* in pixels. |
|
1088 |
*/ |
|
1089 |
IMPORT_C virtual void RestoreClientRectFromViewRect( TRect& aClientRect) const; |
|
1090 |
||
1091 |
/** |
|
1092 |
* Rounds down the height of the rectangle (if necessary) so that |
|
1093 |
* only a whole number of items can be displayed inside the list box. |
|
1094 |
* |
|
1095 |
* @param aRect The rectangle to be modified. |
|
1096 |
* @return The number of pixels reduced. |
|
1097 |
*/ |
|
1098 |
IMPORT_C virtual TInt AdjustRectHeightToWholeNumberOfItems( TRect& aRect) const; |
|
1099 |
||
1100 |
// accessor for Laf members |
|
1101 |
/** |
|
1102 |
* Gets list box margins. |
|
1103 |
* |
|
1104 |
* @return The list box margins in pixels. |
|
1105 |
*/ |
|
1106 |
IMPORT_C TMargins8 ListBoxMargins() const; |
|
1107 |
||
1108 |
// various accessors for private data members |
|
1109 |
/** |
|
1110 |
* This function gets the horizontal margin. Use |
|
1111 |
* @c CEikListBox::ListBoxMargins() instead, as this |
|
1112 |
* provides a more accurate value due to the bit shifting involved. |
|
1113 |
* |
|
1114 |
* @deprecated Use @c CEikListBox::ListBoxMargins() |
|
1115 |
* @return The horizontal margin in pixels. |
|
1116 |
*/ |
|
1117 |
IMPORT_C TInt HorizontalMargin() const; |
|
1118 |
||
1119 |
/** |
|
1120 |
* This function gets the vertical margin. This function |
|
1121 |
* is deprecated, use @c CEikListBox::ListBoxMargins() instead, |
|
1122 |
* this provides a more accurate value due to the bit |
|
1123 |
* shifting involved. |
|
1124 |
* |
|
1125 |
* @deprecated Use @c CEikListBox::ListBoxMargins() |
|
1126 |
* @return The vertical margin in pixels. |
|
1127 |
*/ |
|
1128 |
IMPORT_C TInt VerticalMargin() const; |
|
1129 |
||
1130 |
/** |
|
1131 |
* Sets the horizontal margin. |
|
1132 |
* |
|
1133 |
* @param aMargin The required horizontal margin. |
|
1134 |
*/ |
|
1135 |
IMPORT_C void SetHorizontalMargin(TInt aMargin); |
|
1136 |
||
1137 |
/** |
|
1138 |
* Sets the vertical margin. |
|
1139 |
* |
|
1140 |
* @param aMargin The required vertical margin. |
|
1141 |
*/ |
|
1142 |
IMPORT_C void SetVerticalMargin(TInt aMargin); |
|
1143 |
||
1144 |
/** |
|
1145 |
* Gets a pointer to the match buffer. Returns |
|
1146 |
* NULL if the match buffer does not exist. |
|
1147 |
* |
|
1148 |
* @return Pointer to the match buffer. |
|
1149 |
*/ |
|
1150 |
IMPORT_C RIncrMatcherBase* MatchBuffer() const; |
|
1151 |
||
1152 |
/** |
|
1153 |
* Gets the view rectangle height adjustment. |
|
1154 |
* |
|
1155 |
* These are the adjustments that were made to the |
|
1156 |
* view rectangle when the @c SetViewRectFromClientRect() |
|
1157 |
* function was called. |
|
1158 |
* |
|
1159 |
* @return Height adjustment. |
|
1160 |
*/ |
|
1161 |
IMPORT_C TInt ViewRectHeightAdjustment() const; |
|
1162 |
||
1163 |
/** |
|
1164 |
* Gets the background colour. |
|
1165 |
* |
|
1166 |
* @return The background colour. |
|
1167 |
*/ |
|
1168 |
IMPORT_C TRgb BackColor() const; |
|
1169 |
||
1170 |
/** |
|
1171 |
* Sets the view rectangle height adjustment. |
|
1172 |
* |
|
1173 |
* @param aAdjustment New adjustment. |
|
1174 |
*/ |
|
1175 |
IMPORT_C void SetViewRectHeightAdjustment(TInt aAdjustment); |
|
1176 |
||
1177 |
// misc functions |
|
1178 |
||
1179 |
/** |
|
1180 |
* Reports a list box event to any observer of this list box. |
|
1181 |
* This function returns immediately if no observer is set. |
|
1182 |
* |
|
1183 |
* @param aEvent The event to report. |
|
1184 |
*/ |
|
1185 |
IMPORT_C virtual void ReportListBoxEventL( MEikListBoxObserver::TListBoxEvent aEvent ); |
|
1186 |
||
1187 |
/** |
|
1188 |
* Redraws the specified area of this list box into the specified rectangle. |
|
1189 |
* |
|
1190 |
* @param aRect Rectangle to be redrawn. Specified relative to the |
|
1191 |
* origin of this control. |
|
1192 |
*/ |
|
1193 |
IMPORT_C virtual void Draw(const TRect& aRect) const; |
|
1194 |
||
1195 |
/** |
|
1196 |
* Clears the list box margins. The list box is redrawn only if redraws |
|
1197 |
* are enabled for the list box view. |
|
1198 |
*/ |
|
1199 |
IMPORT_C void ClearMargins() const; |
|
1200 |
||
1201 |
/** |
|
1202 |
* Sets an item as the current item, even if it is not currently |
|
1203 |
* visible. Redraws the list box to reflect the change. This |
|
1204 |
* should not be called from within another Draw function. |
|
1205 |
* |
|
1206 |
* @param aItemIndex The index of the list box item to update. |
|
1207 |
*/ |
|
1208 |
IMPORT_C virtual void UpdateCurrentItem(TInt aItemIndex) const; |
|
1209 |
||
1210 |
/** |
|
1211 |
* Handles drag events. |
|
1212 |
* |
|
1213 |
* This function is called by @c HandlePointerEventL() to handle pointer |
|
1214 |
* drag events appropriately. |
|
1215 |
* |
|
1216 |
* @param aPointerPos The position of the @c TPointerEvent for which this |
|
1217 |
* handler is invoked. |
|
1218 |
*/ |
|
1219 |
IMPORT_C virtual void HandleDragEventL(TPoint aPointerPos); |
|
1220 |
||
1221 |
/** |
|
1222 |
* Tests whether an item exists. |
|
1223 |
* |
|
1224 |
* @param aItemIndex Index to test. |
|
1225 |
* @return @c ETrue if the specified item exists, EFalse otherwise. |
|
1226 |
*/ |
|
1227 |
IMPORT_C TBool ItemExists(TInt aItemIndex) const; |
|
1228 |
||
1229 |
/** |
|
1230 |
* Draws the matcher cursor in the correct location for the current match. |
|
1231 |
* If there is no match buffer, this function returns immediately; |
|
1232 |
* otherwise the cursor is drawn on the current item using |
|
1233 |
* @c CListBoxView::DrawMatcherCursor() after scrolling to make the current |
|
1234 |
* item visible. |
|
1235 |
* |
|
1236 |
* A list box control?s matcher cursor is an on-screen cursor which is |
|
1237 |
* drawn to indicate to the user the location of the current text. Whether |
|
1238 |
* the cursor is drawn is dependent on the |
|
1239 |
* @c CListBoxView::TFlags::EHasMatcherCursor flag, which may be set on the |
|
1240 |
* list box?s view. |
|
1241 |
* |
|
1242 |
* Note, that CListBoxView::DrawMatcherCursor() is not implemented in S60. |
|
1243 |
*/ |
|
1244 |
IMPORT_C void DrawMatcherCursor() const; |
|
1245 |
||
1246 |
/** |
|
1247 |
* Gets the vertical gap between elements in the list box. |
|
1248 |
* |
|
1249 |
* @return The vertical gap between elements in the list box. |
|
1250 |
*/ |
|
1251 |
IMPORT_C static TInt InterItemGap(); |
|
1252 |
||
1253 |
/** |
|
1254 |
* Updates the view colours in line with the colours in effect for the |
|
1255 |
* Uikon environment. Has no effect if there is no view. |
|
1256 |
*/ |
|
1257 |
IMPORT_C void UpdateViewColors(); |
|
1258 |
||
1259 |
/** |
|
1260 |
* Updates the item drawer colours in line with the colours in effect |
|
1261 |
* for the Uikon environment. Has no effect if there is no item drawer. |
|
1262 |
*/ |
|
1263 |
IMPORT_C void UpdateItemDrawerColors(); |
|
1264 |
||
1265 |
/** |
|
1266 |
* Notifies item change observers about item change. Subclasses must call |
|
1267 |
* this method if they have implemented item handling functions (e.g. |
|
1268 |
* @c HandleItemAdditionL or @c HandleItemRemovalL). |
|
1269 |
* |
|
1270 |
* @since S60 3.0 |
|
1271 |
*/ |
|
1272 |
IMPORT_C void FireItemChange(); |
|
1273 |
||
1274 |
||
1275 |
protected: // functions which deal with extension |
|
1276 |
/** |
|
1277 |
* Sets the reason for the list box?s loss of focus. |
|
1278 |
* |
|
1279 |
* This is required so the list box can determine whether |
|
1280 |
* loss of focus is due to an external control or an internal component. |
|
1281 |
* |
|
1282 |
* @param aReasonForFocusLost The reason for the loss of focus. |
|
1283 |
*/ |
|
1284 |
IMPORT_C void SetReasonForFocusLostL( TReasonForFocusLost aReasonForFocusLost ); |
|
1285 |
||
1286 |
/** |
|
1287 |
* Gets the reason for the list box?s loss of focus. |
|
1288 |
* |
|
1289 |
* @return The reason for the loss of focus. |
|
1290 |
*/ |
|
1291 |
IMPORT_C TReasonForFocusLost ReasonForFocusLostL(); |
|
1292 |
||
1293 |
/** |
|
1294 |
* Tests whether the list box match buffer exists. |
|
1295 |
* |
|
1296 |
* @return @c ETrue if the list box match buffer exists. |
|
1297 |
@c EFalse if the list box match buffer does not exist. |
|
1298 |
*/ |
|
1299 |
IMPORT_C TBool IsMatchBuffer() const; |
|
1300 |
||
1301 |
/** |
|
1302 |
* Checks for a list box extension. Attempts to create one if not present. |
|
1303 |
* |
|
1304 |
* This function leaves if an extension cannot be created. |
|
1305 |
*/ |
|
1306 |
void CheckCreateExtensionL(); |
|
1307 |
||
1308 |
/** |
|
1309 |
* Checks for a list box extension. Creates one if not present. |
|
1310 |
* |
|
1311 |
* @return @c ETrue if a list box extension already existed or |
|
1312 |
* if there was no previous extension and a new extension |
|
1313 |
* class was created successfully. |
|
1314 |
* @c EFalse if there was no previous extension and a new one |
|
1315 |
* could not be constructed. |
|
1316 |
*/ |
|
1317 |
TBool CheckCreateExtension(); |
|
1318 |
||
1319 |
/** |
|
1320 |
* Checks the list box match buffer exists. If a buffer does not |
|
1321 |
* exist, one is created. |
|
1322 |
*/ |
|
1323 |
void CheckCreateBufferL(); |
|
1324 |
||
1325 |
/** |
|
1326 |
* Gets the list box match buffer. |
|
1327 |
* |
|
1328 |
* @return The list box match buffer. |
|
1329 |
*/ |
|
1330 |
CMatchBuffer* Buffer() const; |
|
1331 |
||
1332 |
protected: |
|
1333 |
/** |
|
1334 |
* Creates a scroll bar frame layout according to @c aLayout. |
|
1335 |
* |
|
1336 |
* @param aLayout Defines the layout. |
|
1337 |
*/ |
|
1338 |
IMPORT_C void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const; |
|
1339 |
||
1340 |
/** |
|
1341 |
* If MiddleSoftKey is either Mark or Unmark, this method sets MSK |
|
1342 |
* according to the current item selection state. |
|
1343 |
*/ |
|
1344 |
void UpdateMarkUnmarkMSKL() const; |
|
1345 |
||
1346 |
public: |
|
1347 |
/** |
|
1348 |
* @return Event modifiers for the @c CEikListBox. |
|
1349 |
*/ |
|
1350 |
IMPORT_C TInt EventModifiers(); |
|
1351 |
||
1352 |
/* |
|
1353 |
* Returns ETrue if list has ES60StyleMultiselection flag. |
|
1354 |
*/ |
|
1355 |
IMPORT_C TBool IsMultiselection(); |
|
1356 |
||
1357 |
/** |
|
1358 |
* Creates a scrollbar for the listbox. The caller may choose if the scrollbar is requested |
|
1359 |
* remotely via the mop chain from parent control |
|
1360 |
* |
|
1361 |
* @param aPreAlloc Is the scrollbar created immediately or when taking in to use |
|
1362 |
* @param aRemote If True, the scrollbar is obtained via mop-chain from |
|
1363 |
* parent control. If used, the listbox only sets the scrollbar |
|
1364 |
* values. The scrollbar position and size must set in the parent |
|
1365 |
* control's code. |
|
1366 |
* |
|
1367 |
* @return CEikScrollBarFrame* pointer to scrollbar frame object |
|
1368 |
*/ |
|
1369 |
IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc, TBool aRemote); |
|
1370 |
||
1371 |
/** |
|
1372 |
* Creates a scrollbar for the listbox. The caller may choose if the scrollbar is requested |
|
1373 |
* remotely via the mop chain from parent control |
|
1374 |
* |
|
1375 |
* @param aPreAlloc Is the scrollbar created immediately or when taking in to use |
|
1376 |
* @param aRemote If True, the scrollbar is obtained via mop-chain from |
|
1377 |
* parent control. If used, the listbox only sets the scrollbar |
|
1378 |
* values. The scrollbar position and size must set in the parent |
|
1379 |
* control's code. |
|
1380 |
* @param aWindowOwning Does the created scrollbar create own window or |
|
1381 |
* is it compound control. The listbox uses a window owning |
|
1382 |
* scrollbar by default. |
|
1383 |
* |
|
1384 |
* @return CEikScrollBarFrame* pointer to scrollbar frame object |
|
1385 |
*/ |
|
1386 |
IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc, TBool aRemote, TBool aWindowOwning); |
|
1387 |
||
1388 |
/** |
|
1389 |
* By default markable listbox has middle softkey observer, which handles |
|
1390 |
* Mark / Unmark functionality. By this method, the caller may disable default |
|
1391 |
* observer. |
|
1392 |
* |
|
1393 |
* @since S60 3.1 |
|
1394 |
* |
|
1395 |
* @param aEnable If EFalse, disables default middle softkey observer |
|
1396 |
* for markable lists. ETrue enables observer again. |
|
1397 |
*/ |
|
1398 |
IMPORT_C void EnableMSKObserver(TBool aEnable); |
|
1399 |
||
1400 |
/** |
|
1401 |
* Called from MSK observer when shift+MSK have been pressed |
|
1402 |
* |
|
1403 |
* @Since S60 3.1 |
|
1404 |
*/ |
|
1405 |
void DoShiftMSKMarkingL(); |
|
1406 |
||
1407 |
/** |
|
1408 |
* This method is only called by CEikButtonGroupContainer when MSK observer |
|
1409 |
* is enabled and CEikButtonGroupContainer is deleted. |
|
1410 |
* |
|
1411 |
* @Since S60 3.1 |
|
1412 |
*/ |
|
1413 |
void InformMSKButtonGroupDeletion(); |
|
1414 |
||
1415 |
/** |
|
1416 |
* Adds a selection (item marking) observer to the listbox. Duplicates are not checked |
|
1417 |
* (i.e. adding the same observer multiple times is not prevented). |
|
1418 |
* |
|
1419 |
* @since 3.2 |
|
1420 |
* @param aObserver Must be non-NULL. |
|
1421 |
*/ |
|
1422 |
IMPORT_C void AddSelectionObserverL( MListBoxSelectionObserver* aObserver ); |
|
1423 |
||
1424 |
/** |
|
1425 |
* Removes a selection (item marking) observer from the listbox. |
|
1426 |
* |
|
1427 |
* @since 3.2 |
|
1428 |
* @param aObserver The observer to be removed. |
|
1429 |
*/ |
|
1430 |
IMPORT_C void RemoveSelectionObserver( MListBoxSelectionObserver* aObserver ); |
|
1431 |
||
1432 |
/** |
|
1433 |
* This switches listbox into selection mode. Basicly only changes MSK and |
|
1434 |
* informs selection observers about the change. |
|
1435 |
* |
|
1436 |
* @since 3.2 |
|
1437 |
* @param aEnable ETrue when entering into selection mode, EFalse when leaving |
|
1438 |
*/ |
|
1439 |
void ChangeSelectionMode(TBool aEnable); |
|
1440 |
||
1441 |
/** |
|
1442 |
* Sets the number of list items that form one grid line. |
|
1443 |
* |
|
1444 |
* @since S60 5.0 |
|
1445 |
* @param aItems Number of items in one grid line. |
|
1446 |
*/ |
|
1447 |
IMPORT_C void SetItemsInSingleLine(TInt aItems); |
|
1448 |
||
1449 |
/** |
|
1450 |
* Gets the number of list items in one line. This is more than one for |
|
1451 |
* grids only. |
|
1452 |
* |
|
1453 |
* @since S60 5.2 |
|
1454 |
* @return The number of list items in one line. |
|
1455 |
*/ |
|
1456 |
IMPORT_C TInt ItemsInSingleLine() const; |
|
1457 |
||
1458 |
/** |
|
1459 |
* Removes pointer event filtering for list items. |
|
1460 |
* |
|
1461 |
* When there are two pointer up events on the same item at short interval, |
|
1462 |
* listbox will only get the first one and drop the second one. This method forces listbox to handle all pointer up events. |
|
1463 |
* |
|
1464 |
* @since S60 5.0 |
|
1465 |
* |
|
1466 |
* @param aItemIndexes Array of item indexes to be added. |
|
1467 |
**/ |
|
1468 |
IMPORT_C void SetPointerEventFilterDisabledL( const CArrayFix<TInt>& aItemIndexes ); |
|
1469 |
||
1470 |
/** |
|
1471 |
* Scrolls the view by the given amount of pixels while keeping the |
|
1472 |
* physics parameters up-to-date. |
|
1473 |
* This should be called when scrolling the list box view except for |
|
1474 |
* when it is done by list dragging (e.g. scrolling with scroll bar). |
|
1475 |
* |
|
1476 |
* @param aDeltaPixels Amount of pixels to scroll the view. |
|
1477 |
* |
|
1478 |
* @since 5.0 |
|
1479 |
*/ |
|
1480 |
IMPORT_C void HandlePhysicsScrollEventL( TInt aDeltaPixels ); |
|
1481 |
||
1482 |
/** |
|
1483 |
* Disables the kinetic scrolling functionality in the list. |
|
1484 |
* By default the feature is enabled. |
|
1485 |
* |
|
1486 |
* @param aDisabled @c ETrue to disable kinetic scrolling, |
|
1487 |
* @c EFalse otherwise. |
|
1488 |
* |
|
1489 |
* @since 5.0 |
|
1490 |
*/ |
|
1491 |
IMPORT_C void DisableScrolling( TBool aDisabled ); |
|
1492 |
||
1493 |
/** |
|
1494 |
* Checks if the kinetic scrolling is currently enabled in the list. |
|
1495 |
* |
|
1496 |
* @return @c ETrue if kinetic scrolling is enabled, @c EFalse otherwise. |
|
1497 |
* |
|
1498 |
* @since 5.0 |
|
1499 |
*/ |
|
1500 |
IMPORT_C TBool ScrollingDisabled(); |
|
1501 |
||
1502 |
/** |
|
1503 |
* Suspends transitions effects. |
|
1504 |
* |
|
1505 |
* @since S60 5.0 |
|
1506 |
* |
|
1507 |
* @param aSuspend ETrue to suspend effects, EFalse to re-enable them. |
|
1508 |
*/ |
|
1509 |
IMPORT_C void SuspendEffects( TBool aSuspend ); |
|
1510 |
||
1511 |
/** |
|
1512 |
* Disables the single click functionality in the list. |
|
1513 |
* By default the feature is enabled. |
|
1514 |
* |
|
1515 |
* @since S60 5.2 |
|
1516 |
* |
|
1517 |
* @param aDisabled @c ETrue to disable single click |
|
1518 |
* @c EFalse does currently nothing |
|
1519 |
*/ |
|
1520 |
IMPORT_C void DisableSingleClick( TBool aDisabled ); |
|
1521 |
||
1522 |
/** |
|
1523 |
* Disables item specific menu from the list. This has the same effect as |
|
1524 |
* construction time flag @c EAknListBoxItemSpecificMenuDisabled and |
|
1525 |
* calling this method also turns that flag on. |
|
1526 |
* |
|
1527 |
* @since S60 5.2 |
|
1528 |
*/ |
|
1529 |
IMPORT_C void DisableItemSpecificMenu(); |
|
1530 |
||
1531 |
/** |
|
1532 |
* Checks if highlight drawing is enabled. If single click is |
|
1533 |
* enabled highlight drawing is by default disabled, but highlight comes |
|
1534 |
* visible with hardware keys. |
|
1535 |
* |
|
1536 |
* @return ETrue if highlight is enabled, EFalse if not. |
|
1537 |
* |
|
1538 |
* @since S60 5.2 |
|
1539 |
*/ |
|
1540 |
IMPORT_C TBool IsHighlightEnabled(); |
|
1541 |
||
1542 |
/** |
|
72
a5e7a4f63858
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
59
diff
changeset
|
1543 |
* Turns the marking mode on / off. |
56 | 1544 |
* |
1545 |
* @since S60 5.2 |
|
1546 |
* |
|
72
a5e7a4f63858
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
59
diff
changeset
|
1547 |
* @param aEnable @c ETrue to turn marking mode on |
a5e7a4f63858
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
59
diff
changeset
|
1548 |
* @c EFalse to turn marking mode off |
56 | 1549 |
*/ |
1550 |
IMPORT_C void SetMarkingMode( TBool aEnable ); |
|
1551 |
||
1552 |
/** |
|
1553 |
* Sets the marking mode observer. |
|
1554 |
* |
|
1555 |
* @since S60 5.2 |
|
1556 |
* |
|
1557 |
* @param aObserver Marking mode observer, @c NULL removes the existing |
|
1558 |
* observer. |
|
1559 |
*/ |
|
1560 |
IMPORT_C void SetMarkingModeObserver( MAknMarkingModeObserver* aObserver ); |
|
1561 |
||
1562 |
private: |
|
1563 |
IMPORT_C virtual void CEikListBox_Reserved(); // listbox use only |
|
1564 |
void HorizontalScroll(TInt aScrollAmountInPixels); |
|
1565 |
void DrawItemInView(TInt aItemIndex) const; |
|
1566 |
void ClearMargins(CWindowGc& aGc) const; |
|
1567 |
TKeyResponse DoOfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
1568 |
void UpdateScrollBarColors(CEikScrollBar* aScrollBar); |
|
1569 |
void UpdateScrollBarsColors(); |
|
1570 |
||
1571 |
void HandleItemRemovalWithoutSelectionsL(); |
|
1572 |
||
1573 |
/** |
|
1574 |
* Scrolls the view by the given amount of pixels. |
|
1575 |
* |
|
1576 |
* @param aOffset Amount of offset in pixels. |
|
1577 |
* @param aDrawNow Whether or not the view is be drawn. |
|
1578 |
* If @c EFalse then only the logical state is updated. |
|
1579 |
* |
|
1580 |
* @internal |
|
1581 |
* @since 5.0 |
|
1582 |
*/ |
|
1583 |
void ScrollView( const TInt aOffset, TBool aDrawNow ); |
|
1584 |
||
1585 |
/** |
|
1586 |
* Handles pointer events if physics are enabled. |
|
1587 |
* |
|
1588 |
* @return @c ETrue if the event was consumed by kinetic scrolling. |
|
1589 |
* |
|
1590 |
* @internal |
|
1591 |
* @since 5.0 |
|
1592 |
*/ |
|
1593 |
TBool HandlePhysicsPointerEventL( const TPointerEvent& aPointerEvent ); |
|
1594 |
||
1595 |
/** |
|
1596 |
* Selects an item and draws highlight to it. |
|
1597 |
* |
|
1598 |
* @param aItemIndex Index of the highlighted item. |
|
1599 |
* |
|
1600 |
* @internal |
|
1601 |
* @since 5.0 |
|
1602 |
*/ |
|
1603 |
void UpdateHighlightL( TInt aItemIndex ); |
|
1604 |
||
1605 |
/** |
|
1606 |
* Checks whether marking mode is on or off. |
|
1607 |
* |
|
1608 |
* @since S60 5.2 |
|
1609 |
* |
|
1610 |
* @return @c ETrue if marking mode is on, otherwise @c EFalse |
|
1611 |
*/ |
|
1612 |
TBool MarkingMode() const; |
|
1613 |
||
1614 |
/** |
|
1615 |
* Returns the marking mode observer. |
|
1616 |
* |
|
1617 |
* @since S60 5.2 |
|
1618 |
* |
|
1619 |
* @return Pointer to the marking mode observer. |
|
1620 |
*/ |
|
1621 |
MAknMarkingModeObserver* MarkingModeObserver(); |
|
1622 |
||
1623 |
public: |
|
1624 |
/** |
|
1625 |
* Sets this control as visible or invisible. |
|
1626 |
* |
|
1627 |
* @param aVisible ETrue to make the control visible, EFalse to make |
|
1628 |
* it invisible. |
|
1629 |
* @since 5.2 |
|
1630 |
*/ |
|
1631 |
IMPORT_C virtual void MakeVisible( TBool aVisible ); |
|
1632 |
||
1633 |
protected: |
|
1634 |
/** Flags for this list box */ |
|
1635 |
TInt iListBoxFlags; |
|
1636 |
||
1637 |
/** This List box's view */ |
|
1638 |
CListBoxView* iView; |
|
1639 |
||
1640 |
/** Item drawer for this list box */ |
|
1641 |
CListItemDrawer* iItemDrawer; |
|
1642 |
||
1643 |
/** Data model for this list box */ |
|
1644 |
MListBoxModel* iModel; |
|
1645 |
||
1646 |
/** Height of each item in the list */ |
|
1647 |
TInt iItemHeight; |
|
1648 |
||
1649 |
/** The scroll bar used by this control */ |
|
1650 |
CEikScrollBarFrame* iSBFrame; |
|
1651 |
||
1652 |
/** Identifies if the scroll bar is owned by this list */ |
|
1653 |
TScrollBarOwnerShip iSBFrameOwned; |
|
1654 |
||
1655 |
/** The required height of this list box expressed in |
|
1656 |
* terms of a number of items. |
|
1657 |
*/ |
|
1658 |
TInt iRequiredHeightInNumOfItems; |
|
1659 |
||
1660 |
/** |
|
1661 |
* Defines which button launched the popout. |
|
1662 |
*/ |
|
1663 |
CEikButtonBase* iLaunchingButton; // only used by popouts |
|
1664 |
||
1665 |
/** The button which just launched a popout menu. */ |
|
1666 |
MEikListBoxObserver* iListBoxObserver; |
|
1667 |
||
1668 |
private: |
|
1669 |
||
1670 |
TRgb iBackColor; |
|
1671 |
// TInt iHorizontalMargin; |
|
1672 |
// TInt iVerticalMargin; |
|
1673 |
TMargins8 iMargins ; |
|
1674 |
CListBoxExt* iListBoxExt; |
|
1675 |
TInt iViewRectHeightAdjustment; |
|
1676 |
MEikListBoxEditor* iItemEditor; |
|
1677 |
TBool* iLbxDestroyed; |
|
1678 |
TBool iLastCharMatched; |
|
1679 |
TInt iSpare; |
|
1680 |
}; |
|
1681 |
||
1682 |
||
1683 |
||
1684 |
/** |
|
1685 |
* This is a list box that scrolls horizontally, displaying its items |
|
1686 |
* in as many vertical columns as needed. Columns are arranged across |
|
1687 |
* the control from left to right; within columns, items are arranged |
|
1688 |
* from top to bottom. The flow of items or text ?snakes? across the |
|
1689 |
* face of the control. |
|
1690 |
* |
|
1691 |
* This is a flexible control class that makes good use of short, wide |
|
1692 |
* display areas; for instance, subclasses of @c CEikSnakingListBox could |
|
1693 |
* be used for file lists or for a control panel. A standard user |
|
1694 |
* subclass, @c CEikSnakingTextListBox, also exists. |
|
1695 |
* |
|
1696 |
* @since Symbian 5.0 |
|
1697 |
*/ |
|
1698 |
class CEikSnakingListBox : public CEikListBox |
|
1699 |
{ |
|
1700 |
public: |
|
1701 |
/** |
|
1702 |
* C++ standard constructor |
|
1703 |
*/ |
|
1704 |
IMPORT_C CEikSnakingListBox(); |
|
1705 |
||
1706 |
/** |
|
1707 |
* Destructor |
|
1708 |
*/ |
|
1709 |
IMPORT_C ~CEikSnakingListBox(); |
|
1710 |
||
1711 |
/** |
|
1712 |
* Creates an instance of the view class. |
|
1713 |
* |
|
1714 |
* This function is called during construction to create |
|
1715 |
* (but not second-phase construct) an instance of the correct view |
|
1716 |
* class for this list box control. In the case of the snaking list |
|
1717 |
* box, a @c CSnakingListBoxView is returned. |
|
1718 |
* |
|
1719 |
* This function overrides @c CEikListBox::MakeViewClassInstanceL(). |
|
1720 |
* |
|
1721 |
* @return The view which will be used by the list box being created |
|
1722 |
*/ |
|
1723 |
IMPORT_C virtual CListBoxView* MakeViewClassInstanceL(); |
|
1724 |
||
1725 |
/** |
|
1726 |
* Sets the top item?s index. |
|
1727 |
* |
|
1728 |
* @param aItemIndex Index of the item to set as the top item. |
|
1729 |
*/ |
|
1730 |
IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex) const; |
|
1731 |
||
1732 |
/** |
|
1733 |
* Gets the width of this list box?s columns. |
|
1734 |
* |
|
1735 |
* @return Width of each column. |
|
1736 |
*/ |
|
1737 |
IMPORT_C TInt ColumnWidth() const; |
|
1738 |
||
1739 |
/** |
|
1740 |
* Sets the width of all columns in the list box. |
|
1741 |
* |
|
1742 |
* @param aColumnWidth New column width. |
|
1743 |
*/ |
|
1744 |
IMPORT_C void SetColumnWidth(TInt aColumnWidth); |
|
1745 |
||
1746 |
public: //from CCoeControl |
|
1747 |
||
1748 |
/** |
|
1749 |
* From @c CCoeControl. |
|
1750 |
* |
|
1751 |
* Handles pointer events. |
|
1752 |
* |
|
1753 |
* @param aPointerEvent The pointer event. |
|
1754 |
*/ |
|
1755 |
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
1756 |
||
1757 |
protected: |
|
1758 |
||
1759 |
/** |
|
1760 |
* Handles a change in size of the viewing rectangle. |
|
1761 |
* |
|
1762 |
* This function is called by framework functions to update the content, |
|
1763 |
* view, and scroll bars of this list box after the viewing rectangle has |
|
1764 |
* changed size. This implementation ensures that the current item is |
|
1765 |
* visible after a resize. |
|
1766 |
*/ |
|
1767 |
IMPORT_C virtual void HandleViewRectSizeChangeL(); |
|
1768 |
||
1769 |
/** |
|
1770 |
* Handles a left arrow key event. |
|
1771 |
* |
|
1772 |
* Moves the cursor into the correct column and clears any matcher buffer |
|
1773 |
* that may have been built up. |
|
1774 |
* |
|
1775 |
* @param aSelectionMode Not used. |
|
1776 |
*/ |
|
1777 |
IMPORT_C virtual void HandleLeftArrowKeyL( |
|
1778 |
CListBoxView::TSelectionMode aSelectionMode); |
|
1779 |
||
1780 |
/** |
|
1781 |
* Handles a right arrow key event. |
|
1782 |
* |
|
1783 |
* Moves the cursor into the correct column and clears any matcher buffer |
|
1784 |
* that may have been built up. |
|
1785 |
* |
|
1786 |
* @param aSelectionMode Not used. |
|
1787 |
*/ |
|
1788 |
IMPORT_C virtual void HandleRightArrowKeyL( |
|
1789 |
CListBoxView::TSelectionMode aSelectionMode); |
|
1790 |
||
1791 |
/** |
|
1792 |
* Gets the number of grains to move horizontally when a nudge button |
|
1793 |
* is tapped. |
|
1794 |
* |
|
1795 |
* For simple list boxes, this value is a fraction of the width of the |
|
1796 |
* client area. |
|
1797 |
* |
|
1798 |
* @return Number of grains to move left or right on each nudge. |
|
1799 |
*/ |
|
1800 |
IMPORT_C virtual TInt HorizontalNudgeValue() const; |
|
1801 |
||
1802 |
/** |
|
1803 |
* Gets the granularity for horizontal scrolls. |
|
1804 |
* |
|
1805 |
* The granularity is the minimum size of a horizontal move of the |
|
1806 |
* client area. |
|
1807 |
* |
|
1808 |
* @return Grain size for horizontal scrolling in pixels. |
|
1809 |
*/ |
|
1810 |
IMPORT_C virtual TInt HorizScrollGranularityInPixels() const; |
|
1811 |
||
1812 |
/** |
|
1813 |
* Called by various functions of this class to ensure that the top |
|
1814 |
* item index is always a sane value. The implementation in @c CEikListBox |
|
1815 |
* tries to ensure the minimum amount of white space at the bottom of |
|
1816 |
* the list box. Note that this function does not affect the current |
|
1817 |
* item index. |
|
1818 |
*/ |
|
1819 |
IMPORT_C virtual void AdjustTopItemIndex() const; |
|
1820 |
||
1821 |
/** |
|
1822 |
* Handles drag events. |
|
1823 |
* |
|
1824 |
* This function is called by @c HandlePointerEventL() to handle |
|
1825 |
* pointer drag events appropriately. |
|
1826 |
* |
|
1827 |
* @param aPointerPos The position of the @c TPointerEvent for which this |
|
1828 |
* handler is invoked. |
|
1829 |
*/ |
|
1830 |
IMPORT_C virtual void HandleDragEventL(TPoint aPointerPos); |
|
1831 |
||
1832 |
/** |
|
1833 |
* Calculates the client area. |
|
1834 |
* |
|
1835 |
* This method is called by various functions of this class to recalculate |
|
1836 |
* the extent of the client area from @c iViewRect. This implementation |
|
1837 |
* takes into account any rounding of the viewing rectangle made to fit a |
|
1838 |
* whole number of items. |
|
1839 |
* |
|
1840 |
* @param aClientRect On return contains a size for the client area in |
|
1841 |
* pixels. |
|
1842 |
*/ |
|
1843 |
IMPORT_C virtual void RestoreClientRectFromViewRect( |
|
1844 |
TRect& aClientRect) const; |
|
1845 |
||
1846 |
/** |
|
1847 |
* Rounds down the height of the rectangle (if necessary) so that only a |
|
1848 |
* whole number of items can be displayed inside the list box. |
|
1849 |
* |
|
1850 |
* @param aRect The rectangle to be modified. |
|
1851 |
* @return The number of pixels reduced. |
|
1852 |
*/ |
|
1853 |
IMPORT_C virtual TInt AdjustRectHeightToWholeNumberOfItems( |
|
1854 |
TRect& aRect) const; |
|
1855 |
||
1856 |
/** |
|
1857 |
* Move to next or previous item according to the given parameter. |
|
1858 |
* |
|
1859 |
* @param aPoint Position which defines the moving direction. |
|
1860 |
*/ |
|
1861 |
IMPORT_C void MoveToNextOrPreviousItemL(TPoint aPoint); |
|
1862 |
||
1863 |
protected: //from CCoeControl |
|
1864 |
||
1865 |
/** |
|
1866 |
* From @c CCoeControl |
|
1867 |
* |
|
1868 |
* Updates the viewing rectangle of this control appropriately. The function |
|
1869 |
* updates the viewing rectangle, and invokes @c HandleViewRectSizeChangeL(). |
|
1870 |
*/ |
|
1871 |
IMPORT_C virtual void SizeChanged(); |
|
1872 |
||
1873 |
/** |
|
1874 |
* From @c CCoeControl |
|
1875 |
* |
|
1876 |
* Gets the list of logical colours employed in the drawing of the control, |
|
1877 |
* paired with an explanation of how they are used. Appends the list to |
|
1878 |
* @c aColorUseList. |
|
1879 |
* |
|
1880 |
* @param aColorUseList List of logical colours. |
|
1881 |
*/ |
|
1882 |
IMPORT_C virtual void GetColorUseListL( |
|
1883 |
CArrayFix<TCoeColorUse>& aColorUseList) const; |
|
1884 |
// not available before Release 005u |
|
1885 |
/** |
|
1886 |
* From @c CCoeControl. |
|
1887 |
* |
|
1888 |
* Handles a change to the list box?s resources of type @c aType which are |
|
1889 |
* shared across the environment, colours or fonts for example. |
|
1890 |
* |
|
1891 |
* @param aType The type of resources that have changed. |
|
1892 |
*/ |
|
1893 |
IMPORT_C virtual void HandleResourceChange(TInt aType); |
|
1894 |
// not available before Release 005u |
|
1895 |
||
1896 |
private: // from CCoeControl |
|
1897 |
IMPORT_C void Reserved_1(); |
|
1898 |
||
1899 |
IMPORT_C void Reserved_2(); |
|
1900 |
||
1901 |
private: |
|
1902 |
/** |
|
1903 |
* From CAknControl |
|
1904 |
*/ |
|
1905 |
IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
1906 |
||
1907 |
private: |
|
1908 |
IMPORT_C virtual void CEikListBox_Reserved(); // listbox use only |
|
1909 |
}; |
|
1910 |
||
1911 |
#endif // __EIKLBX_H__ |