|
1 /* |
|
2 * Copyright (c) 2010 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: Easy dialing listbox data. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _EASYDIALINGLISTBOXDATA_H |
|
20 #define _EASYDIALINGLISTBOXDATA_H |
|
21 |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <aknlists.h> |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 /* |
|
29 * Matching highlight separator character is used in listbox model to separate |
|
30 * matching and non-matching charaters. 0x1F is chosen for this because |
|
31 * it is a control character "INFORMATION SEPARATOR ONE" of ASCII set. |
|
32 * User of the listbox must use this character in creating list box item |
|
33 * strings. |
|
34 */ |
|
35 // FORWARD DECLARATIONS |
|
36 class CEasyDialingListBox; |
|
37 class CEasyDialingContactDataManager; |
|
38 |
|
39 // CLASS DECLARATIONS |
|
40 |
|
41 /* |
|
42 * Easy dialing listbox data class. |
|
43 */ |
|
44 |
|
45 class CEasyDialingListBoxData : public CFormattedCellListBoxData |
|
46 { |
|
47 public: |
|
48 |
|
49 class TExtendedColors : public CFormattedCellListBoxData::TColors |
|
50 { |
|
51 public: |
|
52 |
|
53 TExtendedColors(); |
|
54 |
|
55 /** The matching text colour. */ |
|
56 TRgb iMatchingText; |
|
57 |
|
58 /** The matching background colour. */ |
|
59 TRgb iMatchingBack; |
|
60 |
|
61 }; |
|
62 |
|
63 |
|
64 /** |
|
65 * Constructor. |
|
66 */ |
|
67 CEasyDialingListBoxData(); |
|
68 |
|
69 /** |
|
70 * Destructor |
|
71 */ |
|
72 ~CEasyDialingListBoxData(); |
|
73 |
|
74 /** |
|
75 * Second phase constructor of the class. |
|
76 * @return Pointer to the instance. |
|
77 */ |
|
78 static CEasyDialingListBoxData* NewL(); |
|
79 |
|
80 /** |
|
81 * Draws selected item. |
|
82 */ |
|
83 void DrawData( |
|
84 const TListItemProperties& aItemProperties, |
|
85 CWindowGc& aGc, |
|
86 const TDesC* aText, |
|
87 const TRect& aRect, |
|
88 TBool aHighlight, |
|
89 const TExtendedColors& aColors ) const; |
|
90 |
|
91 /** |
|
92 * Draws selected item highlight. |
|
93 * @param aGc Graphics context. |
|
94 * @param aItemRect Item rectangle. |
|
95 */ |
|
96 void DrawHighlight( CWindowGc &aGc, const TRect &aItemRect ) const; |
|
97 |
|
98 /** |
|
99 * Sets the contact data manager. Must be set before using the listbox. |
|
100 * @param aContactDataManager Contact data manager. |
|
101 */ |
|
102 void SetContactDataManager( CEasyDialingContactDataManager* aContactDataManager ); |
|
103 |
|
104 /** |
|
105 * Sets a pointer to listbox class. Called from listbox constructor. |
|
106 * @param aControl Pointer to easy dialing listbox cotrol. |
|
107 */ |
|
108 void SetEDLBXControl( CEasyDialingListBox* aControl ); |
|
109 |
|
110 /** |
|
111 * Handle change in list item size |
|
112 */ |
|
113 void HandleItemSizeChange(); |
|
114 |
|
115 protected: |
|
116 |
|
117 void ConstructLD(); |
|
118 |
|
119 private: |
|
120 |
|
121 /** |
|
122 * Determines fonts for contact name and company name. |
|
123 * The font sizes are determined based on list box item height. |
|
124 * This function must be called once before any drawing routines are |
|
125 * done. |
|
126 * @param aItemHeight List box item height |
|
127 */ |
|
128 void ObtainFonts( TInt aItemHeight ); |
|
129 |
|
130 /** |
|
131 * Update the color bitmap used for fallback graphics for the Action Menu arrow according to |
|
132 * size changes in listbox control. |
|
133 * @param aSize New size. |
|
134 */ |
|
135 void UpdateColorBitmapL( const TSize& aSize ); |
|
136 |
|
137 /** |
|
138 * Draws the data for one list item. |
|
139 * @param aProperties List item property structure. |
|
140 * @param aGc Graphics context. |
|
141 * @param aText String containing list item data information. |
|
142 * @param aItemRect Item rectangle. |
|
143 * @param aHighlight ETrue if the item has highlight, EFalse otherwise. |
|
144 * @param aColors Structure containing used colors. |
|
145 */ |
|
146 void DrawDataFormatted( |
|
147 TListItemProperties aProperties, |
|
148 CWindowGc& aGc, |
|
149 const TDesC* aText, |
|
150 const TRect& aItemRect, |
|
151 TBool aHighlight, |
|
152 const TExtendedColors& aColors ) const; |
|
153 |
|
154 /** |
|
155 * Draws the Contact Thumbnail Icon if any else draws the dummy contact thumbnail. |
|
156 * @param aGc Graphics context. |
|
157 * @param aBoundingBox Rectangle containing bounds for contact thumbnail. |
|
158 * @param aDescId Descriptor containing contact id. |
|
159 */ |
|
160 TBool ContactThumbnailDrawing( |
|
161 CWindowGc& aGc, |
|
162 TRect aBoundingBox, |
|
163 TPtrC aDescId) const; |
|
164 |
|
165 /** |
|
166 * Draws the Action Menu. |
|
167 * @param aGc Graphics context. |
|
168 * @param aActionMenuArrowRect Rectangle where arrow is to be drawn. |
|
169 */ |
|
170 void DrawArrowIcon( CWindowGc& aGc, TRect aActionMenuArrowRect ) const; |
|
171 |
|
172 /** |
|
173 * Draws the Favourite Icon. Takes the name rect as a parameter. Name rect |
|
174 * must be unmirrored, because the mirroring is done as the last thing |
|
175 * before drawing. |
|
176 * @param aGc Graphics context. |
|
177 * @param aNameRectUnMirrored Name rect, where fav star is contained |
|
178 * @param aTextWidth The width of the name |
|
179 * @param aEffectiveRect The whole listbox item rect. Used for mirroring. |
|
180 */ |
|
181 void DrawFavouriteIcon( |
|
182 CWindowGc& aGc, |
|
183 TRect aNameRectUnMirrored, |
|
184 TInt aTextWidth, |
|
185 TRect aEffectiveRect) const; |
|
186 |
|
187 private: |
|
188 |
|
189 /** Font to be used showing contact name. Not owned. */ |
|
190 CFont* iContactNameFont; |
|
191 |
|
192 /** Font to be used showing company name. Not owned. */ |
|
193 CFont* iCompanyNameFont; |
|
194 |
|
195 /** Handle for loading and storing the thumbnails. Not owned.*/ |
|
196 CEasyDialingContactDataManager* iContactDataManager; |
|
197 |
|
198 /** Action Menu LeftPointing Arrow for mirrored layout. Owned. */ |
|
199 CGulIcon* iArrowPointingRight; |
|
200 |
|
201 /** Action Menu RightPointing Arrow. Owned. */ |
|
202 CGulIcon* iArrowPointingLeft; |
|
203 |
|
204 /** Action icon color bitmap. Owned. */ |
|
205 CFbsBitmap* iColorBitmap; |
|
206 |
|
207 /** Default image for contacts with no own thumbnail. Owned. */ |
|
208 CGulIcon* iDummyThumbnail; |
|
209 |
|
210 /** Pointer to listbox. Not owned. */ |
|
211 CEasyDialingListBox* iControl; |
|
212 }; |
|
213 |
|
214 |
|
215 #endif // _EASYDIALINGLISTBOXDATA_H |
|
216 |