56
|
1 |
/*
|
|
2 |
* Copyright (c) 1997-1999 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#if !defined(__EIKCLB_H__)
|
|
20 |
#define __EIKCLB_H__
|
|
21 |
|
|
22 |
|
|
23 |
#include <eiklbi.h>
|
|
24 |
#include <eiktxlbx.h>
|
|
25 |
#include <eiklbed.h>
|
|
26 |
|
|
27 |
class CColumnListBoxData;
|
|
28 |
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Draws the contents of list box items.
|
|
32 |
*
|
|
33 |
* @since 5.0
|
|
34 |
*/
|
|
35 |
class CColumnListBoxItemDrawer : public CTextListItemDrawer
|
|
36 |
{
|
|
37 |
|
|
38 |
public:
|
|
39 |
/* C++ default constructor.
|
|
40 |
*
|
|
41 |
* @since 3.2
|
|
42 |
*/
|
|
43 |
|
|
44 |
IMPORT_C CColumnListBoxItemDrawer();
|
|
45 |
|
|
46 |
/**
|
|
47 |
* C++ default constructor.
|
|
48 |
*
|
|
49 |
* Initialises the list box item drawer with the specified model,
|
|
50 |
* font and data.
|
|
51 |
*
|
|
52 |
* @param aTextListBoxModel The model whose items will be drawn.
|
|
53 |
* This provides the item text that is drawn using
|
|
54 |
* @c DrawItemText().
|
|
55 |
* @param aFont The font in which the items will be drawn.
|
|
56 |
* @param aColumnData The column list box data. This comprises:
|
|
57 |
* the column widths, gaps, fonts, aligments and bitmaps.
|
|
58 |
*/
|
|
59 |
|
|
60 |
IMPORT_C CColumnListBoxItemDrawer(MTextListBoxModel* aTextListBoxModel,
|
|
61 |
const CFont* aFont,
|
|
62 |
CColumnListBoxData* aColumnData);
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Destructor.
|
|
66 |
*/
|
|
67 |
IMPORT_C ~CColumnListBoxItemDrawer();
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Gets a pointer to the column list box data as set during construction.
|
|
71 |
* Does not transfer ownership.
|
|
72 |
*
|
|
73 |
* @return The column list box data.
|
|
74 |
*/
|
|
75 |
IMPORT_C CColumnListBoxData* ColumnData() const;
|
|
76 |
|
|
77 |
public:
|
|
78 |
|
|
79 |
|
|
80 |
/**
|
|
81 |
* The structure holding given item properties.
|
|
82 |
*
|
|
83 |
* Used for storing information given through @c SetProperties() method.
|
|
84 |
*/
|
|
85 |
struct SListProperties
|
|
86 |
{
|
|
87 |
/** Item identifier. */
|
|
88 |
TInt iItem; // must be first
|
|
89 |
|
|
90 |
/** Properties of the item. */
|
|
91 |
TListItemProperties iProperties;
|
|
92 |
};
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Clears all properties from the @c CColumnListBoxItemDrawer.
|
|
96 |
*/
|
|
97 |
IMPORT_C void ClearAllPropertiesL();
|
|
98 |
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Set the property for an item with @c aItemIndex
|
|
102 |
*
|
|
103 |
* @param aItemIndex Item index
|
|
104 |
* @param aProperty The new property setting
|
|
105 |
* The SetProperties is convinience method for normal cases.
|
|
106 |
* NOTE that it does NOT work correctly if you can insert/delete
|
|
107 |
* items from the list -- You need to update all properties if
|
|
108 |
* any changes to the item text array happen! Often it is convinient
|
|
109 |
* to override the Properties() method. Further, use this only
|
|
110 |
* for small lists as it causes O(n) time if you need to set
|
|
111 |
* all properties.
|
|
112 |
*/
|
|
113 |
IMPORT_C void SetPropertiesL(TInt aItemIndex,
|
|
114 |
TListItemProperties aProperty);
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Get properties for an item.
|
|
118 |
*
|
|
119 |
* @param aItemIndex Item's index for identifying.
|
|
120 |
* @return Wanted property set.
|
|
121 |
*/
|
|
122 |
IMPORT_C virtual TListItemProperties Properties(TInt aItemIndex) const;
|
|
123 |
|
|
124 |
public: // from CTextListItemDrawer
|
|
125 |
|
|
126 |
/**
|
|
127 |
* From @c CTextListItemDrawer.
|
|
128 |
*
|
|
129 |
* Draw item text.
|
|
130 |
*
|
|
131 |
* @param aItemIndex Index of the item to draw.
|
|
132 |
* @param aItemTextRect Area to draw into.
|
|
133 |
* @param aItemIsCurrent @c ETrue if the item is current.
|
|
134 |
* @param aViewIsEmphasized @c ETrue if the view is emphasised.
|
|
135 |
* @param aItemIsSelected @c ETrue if the item is selected.
|
|
136 |
*/
|
|
137 |
IMPORT_C void DrawItemText(TInt aItemIndex,
|
|
138 |
const TRect& aItemTextRect,
|
|
139 |
TBool aItemIsCurrent,
|
|
140 |
TBool aViewIsEmphasized,
|
|
141 |
TBool aItemIsSelected) const;
|
|
142 |
// the next one is for avkon
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Not used in S60.
|
|
146 |
*/
|
|
147 |
IMPORT_C void DrawItemMark(TBool aItemIsSelected,
|
|
148 |
TBool aViewIsDimmed,
|
|
149 |
const TPoint& aMarkPos) const;
|
|
150 |
|
|
151 |
public: // from CListItemDrawer
|
|
152 |
|
|
153 |
/**
|
|
154 |
* From @c CListItemDrawer.
|
|
155 |
*
|
|
156 |
* Gets the minimum cell size.
|
|
157 |
*
|
|
158 |
* @return The minimum size for a cell. This is
|
|
159 |
* TSize(0, 0) in @c CListItemDrawer.
|
|
160 |
*/
|
|
161 |
IMPORT_C TSize MinimumCellSize() const;
|
|
162 |
|
|
163 |
/**
|
|
164 |
* From @c CListItemDrawer.
|
|
165 |
*
|
|
166 |
* Gets the width of the specified item.
|
|
167 |
*
|
|
168 |
* @param aItemIndex The index of the item whose width is to be returned.
|
|
169 |
* @return The width of the item. This is 0 in @c CListItemDrawer
|
|
170 |
*/
|
|
171 |
IMPORT_C TInt ItemWidthInPixels(TInt aItemIndex) const;
|
|
172 |
|
|
173 |
/**
|
|
174 |
* From @c CListItemDrawer.
|
|
175 |
*
|
|
176 |
* Sets the item cell size.
|
|
177 |
*
|
|
178 |
* The cell size is the on-screen size of the entire item, including its
|
|
179 |
* text and its item mark.
|
|
180 |
*
|
|
181 |
* @param aSizeInPixels New size for the item cell.
|
|
182 |
*/
|
|
183 |
IMPORT_C void SetItemCellSize(const TSize& aSizeInPixels);
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Get Item Cell Size.
|
|
187 |
*
|
|
188 |
* @return Cell size of an item.
|
|
189 |
*/
|
|
190 |
TSize LafItemSize() { return iItemCellSize; }
|
|
191 |
|
|
192 |
private: // from CListItemDrawer
|
|
193 |
|
|
194 |
IMPORT_C TAny* Reserved_1();
|
|
195 |
|
|
196 |
private: // defining reserved method.
|
|
197 |
|
|
198 |
IMPORT_C void CColumnListBoxItemDrawer_Reserved();
|
|
199 |
|
|
200 |
protected:
|
|
201 |
|
|
202 |
/**
|
|
203 |
* Array of properties.
|
|
204 |
*/
|
|
205 |
CArrayFix<SListProperties>* iPropertyArray;
|
|
206 |
|
|
207 |
/**
|
|
208 |
* Not used.
|
|
209 |
*/
|
|
210 |
TInt iSpare;
|
|
211 |
};
|
|
212 |
|
|
213 |
|
|
214 |
/**
|
|
215 |
* Column list box control.
|
|
216 |
*
|
|
217 |
* This is a list box whose lines consist of cells that are grouped vertically
|
|
218 |
* into columns. The columns can be either textual or graphical, and column
|
|
219 |
* widths and fonts can be set explicitly through @c CColumnListBoxData.
|
|
220 |
*
|
|
221 |
* Starting from 3.0 listbox uses highlight animations. Starting and stopping
|
|
222 |
* animation is connected to focus events. To support highlight animations
|
|
223 |
* properly you have to make sure that the list has focus when it has 'visual
|
|
224 |
* focus'. Common issues:
|
|
225 |
* - In many cases list is in a container which sits on top of the control
|
|
226 |
* stack. The container receives all focus events and should hand them to the
|
|
227 |
* list too. E.g.
|
|
228 |
* void CContainer::FocusChanged( TDrawNow aDrawNow )
|
|
229 |
* {
|
|
230 |
* ... some code ...
|
|
231 |
* if( iListBox )
|
|
232 |
* iListBox->SetFocus( IsFocused(), aDrawNow );
|
|
233 |
* }
|
|
234 |
* - When switching components programmatically, e.g. from one list to another
|
|
235 |
* in the same view, make sure that you remove focus from the other
|
|
236 |
* component.
|
|
237 |
* - In more complex cases you may have to add a dummy interceptor control to
|
|
238 |
* the top of control stack to hand focus events to list.
|
|
239 |
* - Make sure you handle resource changes correctly. If resource handle chain
|
|
240 |
* is solid it should reach CCoeControl::HandleResourceChange, which informs
|
|
241 |
*/
|
|
242 |
class CEikColumnListBox : public CEikTextListBox
|
|
243 |
{
|
|
244 |
public:
|
|
245 |
/**
|
|
246 |
* C++ default constructor.
|
|
247 |
*/
|
|
248 |
IMPORT_C CEikColumnListBox();
|
|
249 |
|
|
250 |
/**
|
|
251 |
* Second-phase construction from a resource.
|
|
252 |
*
|
|
253 |
* This function completes the construction of a column list box,
|
|
254 |
* initialising any members from the specified resource reader.
|
|
255 |
*
|
|
256 |
* @param aReader A resource file reader
|
|
257 |
*/
|
|
258 |
IMPORT_C void ConstructFromResourceL( TResourceReader& aReader );
|
|
259 |
|
|
260 |
/**
|
|
261 |
* By default Symbian 2nd phase constructor is private.
|
|
262 |
*
|
|
263 |
* This function completes the construction of a column list box.
|
|
264 |
*
|
|
265 |
* @param aParent Parent control for the column list box.
|
|
266 |
* @param aFlags Flags for the column list box.
|
|
267 |
*/
|
|
268 |
IMPORT_C void ConstructL( const CCoeControl* aParent,TInt aFlags=0);
|
|
269 |
/**
|
|
270 |
* Not supported in S60.
|
|
271 |
*/
|
|
272 |
IMPORT_C void EditItemL(TInt aColumn, TInt aMaxLength);
|
|
273 |
protected:
|
|
274 |
|
|
275 |
/**
|
|
276 |
* This member is internal and not intended for use.
|
|
277 |
*/
|
|
278 |
IMPORT_C virtual void CreateItemDrawerL();
|
|
279 |
|
|
280 |
/**
|
|
281 |
* Creates a new @c CTextListBoxModel
|
|
282 |
*/
|
|
283 |
IMPORT_C virtual void CreateModelL();
|
|
284 |
|
|
285 |
public:
|
|
286 |
|
|
287 |
/**
|
|
288 |
* Gets the list box model.
|
|
289 |
*
|
|
290 |
* @return Pointer to the model used by this list box
|
|
291 |
*/
|
|
292 |
IMPORT_C CTextListBoxModel* Model() const;
|
|
293 |
|
|
294 |
/**
|
|
295 |
* Gets the object used by this list box to draw its items.
|
|
296 |
*
|
|
297 |
* @return A pointer to the list box drawer.
|
|
298 |
*/
|
|
299 |
IMPORT_C CColumnListBoxItemDrawer* ItemDrawer() const;
|
|
300 |
|
|
301 |
/**
|
|
302 |
* This method needs to be called to enable extended drawing features
|
|
303 |
* such as skinning, pictograph drawing and marquee text in the listbox
|
|
304 |
* draw routine.
|
|
305 |
*
|
|
306 |
* Methods @c CEikFormattedCellListBox::ConstructL and
|
|
307 |
* @c CEikFormattedCellListBox::ConstructFromResourceL call this method.
|
|
308 |
* So, you only need to call this if your listbox implementation does not
|
|
309 |
* call either of those.
|
|
310 |
*
|
|
311 |
* This method can be safely called more than once.
|
|
312 |
* Item drawer must be created before calling this method, or a
|
|
313 |
* panic is raised.
|
|
314 |
*
|
|
315 |
* @since S60 2.6
|
|
316 |
*/
|
|
317 |
IMPORT_C void EnableExtendedDrawingL();
|
|
318 |
|
|
319 |
/**
|
|
320 |
* Helper function that setst icon sizes for visible list items
|
|
321 |
*/
|
|
322 |
void SetIconSizes();
|
|
323 |
|
|
324 |
/**
|
|
325 |
* Enables/disables list stretching. When a column list is stretched its
|
|
326 |
* layout is optimized to take advantage of the extra screen space.
|
|
327 |
* This is intented for devices with a large screen. This feature might be
|
|
328 |
* set as default by a product specific flag.
|
|
329 |
*
|
|
330 |
* Item drawer must be created before calling this method.
|
|
331 |
*
|
|
332 |
* @since S60 3.1
|
|
333 |
* @param aEnabled ETrue to enable list stretching.
|
|
334 |
*/
|
|
335 |
IMPORT_C void EnableStretching( const TBool aEnabled );
|
|
336 |
public: // from CEikListBox
|
|
337 |
|
|
338 |
/**
|
|
339 |
* From @c CEikListBox.
|
|
340 |
*
|
|
341 |
* Creates the list box view.
|
|
342 |
* The function is called by @ ConstructL() to create an instance of
|
|
343 |
* the appropriate list box view class for this list box. The returned
|
|
344 |
* instance is owned by this object, and does not have to have its
|
|
345 |
* second-phase constructor run. This function is called by
|
|
346 |
* @c CreateViewL().
|
|
347 |
*
|
|
348 |
* @return Pointer to a newly constructed list box
|
|
349 |
* view for this object.
|
|
350 |
*/
|
|
351 |
IMPORT_C CListBoxView* MakeViewClassInstanceL();
|
|
352 |
|
|
353 |
/**
|
|
354 |
* From @c CEikListBox
|
|
355 |
*
|
|
356 |
* Handles focus changes.
|
|
357 |
*
|
|
358 |
* The function emphasises or de-emphasises the view as needed, and
|
|
359 |
* shows or hides the matcher cursor.
|
|
360 |
*
|
|
361 |
* @param aDrawNow If @c EDrawNow, a redraw is performed immediately
|
|
362 |
*/
|
|
363 |
IMPORT_C void FocusChanged(TDrawNow aDrawNow);
|
|
364 |
|
|
365 |
public: // from CCoeControl
|
|
366 |
|
|
367 |
/**
|
|
368 |
* From @c CCoeControl.
|
|
369 |
*
|
|
370 |
* Not used in S60
|
|
371 |
* @param aColorUseList The colour list
|
|
372 |
*/
|
|
373 |
IMPORT_C void GetColorUseListL(
|
|
374 |
CArrayFix<TCoeColorUse>& aColorUseList) const;
|
|
375 |
|
|
376 |
/**
|
|
377 |
* From @c CCoeControl.
|
|
378 |
*
|
|
379 |
* Handles a change to the control's resources.
|
|
380 |
*
|
|
381 |
* The types of resources handled are those which are shared across
|
|
382 |
* the environment, e.g. colours or fonts. For colour scheme changes,
|
|
383 |
* @c DrawDeferred() is called in order to redraw the control.
|
|
384 |
*
|
|
385 |
* If overriding @c HandleResourceChange(), the implementation must
|
|
386 |
* include a base call to @c CCoeControl's @c HandleResourceChange().
|
|
387 |
*
|
|
388 |
* @param aType A message UID value
|
|
389 |
*/
|
|
390 |
IMPORT_C void HandleResourceChange(TInt aType);
|
|
391 |
|
|
392 |
/**
|
|
393 |
* From @c CCoeControl.
|
|
394 |
*
|
|
395 |
* Retrieves an object of the same type as that encapsulated in @c aId.
|
|
396 |
*
|
|
397 |
* This function is used to allow controls to ask their owners for
|
|
398 |
* access to other objects that they own.
|
|
399 |
*
|
|
400 |
* Other than in the case where NULL is returned, the object returned
|
|
401 |
* must be of the same object type - that is, the @c ETypeId member of the
|
|
402 |
* object pointed to by the pointer returned by this function must be
|
|
403 |
* equal to the @c iUid member of @c aUid.
|
|
404 |
*
|
|
405 |
* @param aUid An encapsulated object type ID.
|
|
406 |
* @return Pointer to the type UID of the wanted object.
|
|
407 |
*/
|
|
408 |
IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aUid);
|
|
409 |
|
|
410 |
/**
|
|
411 |
* From @c CCoeControl.
|
|
412 |
*
|
|
413 |
* Handles pointer events.
|
|
414 |
*
|
|
415 |
* This function gets called whenever a pointer event occurs in the
|
|
416 |
* control, i.e. when the pointer is within the control's extent, or when
|
|
417 |
* the control has grabbed the pointer. The control should implement this
|
|
418 |
* function to handle pointer events.
|
|
419 |
*
|
|
420 |
* Note: events of type @c EButton1Down are processed before
|
|
421 |
* @c HandlePointerEventL() is called, in order to transfer keyboard
|
|
422 |
* focus to the control in which the @c EButton1Down event occurred.
|
|
423 |
*
|
|
424 |
* If overriding @c HandlePointerEventL(), the implementation must
|
|
425 |
* include a base call to @c CCoeControl's @c HandlePointerEventL().
|
|
426 |
*
|
|
427 |
* @param aPointerEvent The pointer event
|
|
428 |
*/
|
|
429 |
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
|
430 |
private:
|
|
431 |
/**
|
|
432 |
* From CAknControl
|
|
433 |
*/
|
|
434 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
|
435 |
private:
|
|
436 |
IMPORT_C virtual void CEikListBox_Reserved(); // listbox use only
|
|
437 |
private: // data
|
|
438 |
TInt iSpare;
|
|
439 |
};
|
|
440 |
|
|
441 |
/**
|
|
442 |
* The @c CEikColumnListBoxEditor class implements an item editor for
|
|
443 |
* column list boxes.
|
|
444 |
* Not supported in S60
|
|
445 |
* @since ER5U
|
|
446 |
*/
|
|
447 |
class CEikColumnListBoxEditor : public CEikListBoxTextEditor
|
|
448 |
{
|
|
449 |
public:
|
|
450 |
IMPORT_C CEikColumnListBoxEditor(MListBoxModel* aModel);
|
|
451 |
IMPORT_C ~CEikColumnListBoxEditor();
|
|
452 |
IMPORT_C void ConstructL(TInt aColumn); // just set column index
|
|
453 |
public: // from MEikListBoxEditor
|
|
454 |
IMPORT_C TPtrC ItemText();
|
|
455 |
IMPORT_C TBool UpdateModelL();
|
|
456 |
public: // From CCoeControl
|
|
457 |
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
|
458 |
protected:
|
|
459 |
IMPORT_C TInt Column() const;
|
|
460 |
private:
|
|
461 |
/**
|
|
462 |
* From CAknControl
|
|
463 |
*/
|
|
464 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
|
465 |
private:
|
|
466 |
TInt iColumnIndex; // refers to list box column
|
|
467 |
};
|
|
468 |
|
|
469 |
class CColumnListBoxView : public CListBoxView
|
|
470 |
{
|
|
471 |
public: // from CListBoxView
|
|
472 |
|
|
473 |
/**
|
|
474 |
* From @c CListBoxView
|
|
475 |
* Draws every visible item into the specified rectangle.
|
|
476 |
*
|
|
477 |
* As implemented in @c CListBoxView, this function's argument is
|
|
478 |
* ignored and the internal viewing rectangle is used. See @c SetViewRect().
|
|
479 |
*
|
|
480 |
* @param aClipRect = NULL The rectangle to draw into, this is ignored
|
|
481 |
*/
|
|
482 |
IMPORT_C void Draw(const TRect* aClipRect = NULL) const;
|
|
483 |
|
|
484 |
/**
|
|
485 |
* From @c CListBoxView
|
|
486 |
* Recalculates the index of the bottom item in the list from the top item
|
|
487 |
* index and the size of the display.
|
|
488 |
*
|
|
489 |
* This function is called by the owning list box control when either the
|
|
490 |
* size of the list box or the number of items in its model changes.
|
|
491 |
*/
|
|
492 |
IMPORT_C virtual void CalcBottomItemIndex();
|
|
493 |
|
|
494 |
private: // overridden from CListBoxView
|
|
495 |
|
|
496 |
IMPORT_C virtual TAny* Reserved_1();
|
|
497 |
|
|
498 |
private: // data
|
|
499 |
TInt iSpare;
|
|
500 |
};
|
|
501 |
|
|
502 |
#endif // __EIKCLB_H__
|
|
503 |
|
|
504 |
// End of File |