author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:31:22 +0300 | |
branch | RCL_3 |
changeset 81 | c26cc2a7c548 |
parent 62 | 5266b1f337bd |
permissions | -rw-r--r-- |
62 | 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 |
* Destructor |
|
66 |
*/ |
|
67 |
~CEasyDialingListBoxData(); |
|
68 |
||
69 |
/** |
|
70 |
* Two phased constructor of the class. |
|
71 |
* @return Pointer to the instance. |
|
72 |
*/ |
|
73 |
static CEasyDialingListBoxData* NewL( CCoeEnv& aCoeEnv ); |
|
74 |
||
75 |
/** |
|
76 |
* Draws selected item. |
|
77 |
*/ |
|
78 |
void DrawData( |
|
79 |
const TListItemProperties& aItemProperties, |
|
80 |
CWindowGc& aGc, |
|
81 |
const TDesC* aText, |
|
82 |
const TRect& aRect, |
|
83 |
TBool aHighlight, |
|
84 |
const TExtendedColors& aColors ) const; |
|
85 |
||
86 |
/** |
|
87 |
* Draws selected item highlight. |
|
88 |
* @param aGc Graphics context. |
|
89 |
* @param aItemRect Item rectangle. |
|
90 |
*/ |
|
91 |
void DrawHighlight( CWindowGc &aGc, const TRect &aItemRect ) const; |
|
92 |
||
93 |
/** |
|
94 |
* Sets the contact data manager. Must be set before using the listbox. |
|
95 |
* @param aContactDataManager Contact data manager. |
|
96 |
*/ |
|
97 |
void SetContactDataManager( CEasyDialingContactDataManager* aContactDataManager ); |
|
98 |
||
99 |
/** |
|
100 |
* Sets a pointer to listbox class. Called from listbox constructor. |
|
101 |
* @param aControl Pointer to easy dialing listbox cotrol. |
|
102 |
*/ |
|
103 |
void SetEDLBXControl( CEasyDialingListBox* aControl ); |
|
104 |
||
105 |
/** |
|
106 |
* Handle change in list item size |
|
107 |
*/ |
|
108 |
void HandleItemSizeChange(); |
|
109 |
||
110 |
protected: |
|
111 |
||
112 |
/** |
|
113 |
* C++ Constructor |
|
114 |
*/ |
|
115 |
CEasyDialingListBoxData( CCoeEnv& aCoeEnv ); |
|
116 |
||
117 |
/** |
|
118 |
* Second phase constructor |
|
119 |
*/ |
|
120 |
void ConstructLD(); |
|
121 |
||
122 |
private: |
|
123 |
||
124 |
/** |
|
125 |
* Determines fonts for contact name and company name. |
|
126 |
* The font sizes are determined based on list box item height. |
|
127 |
* This function must be called once before any drawing routines are |
|
128 |
* done. |
|
129 |
* @param aItemHeight List box item height |
|
130 |
*/ |
|
131 |
void ObtainFonts( TInt aItemHeight ); |
|
132 |
||
133 |
/** |
|
134 |
* Update the color bitmap used for fallback graphics for the Action Menu arrow according to |
|
135 |
* size changes in listbox control. |
|
136 |
* @param aSize New size. |
|
137 |
*/ |
|
138 |
void UpdateColorBitmapL( const TSize& aSize ); |
|
139 |
||
140 |
/** |
|
141 |
* Draws the data for one list item. |
|
142 |
* @param aProperties List item property structure. |
|
143 |
* @param aGc Graphics context. |
|
144 |
* @param aText String containing list item data information. |
|
145 |
* @param aItemRect Item rectangle. |
|
146 |
* @param aHighlight ETrue if the item has highlight, EFalse otherwise. |
|
147 |
* @param aColors Structure containing used colors. |
|
148 |
*/ |
|
149 |
void DrawDataFormatted( |
|
150 |
TListItemProperties aProperties, |
|
151 |
CWindowGc& aGc, |
|
152 |
const TDesC* aText, |
|
153 |
const TRect& aItemRect, |
|
154 |
TBool aHighlight, |
|
155 |
const TExtendedColors& aColors ) const; |
|
156 |
||
157 |
/** |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
158 |
* Draws the Contact Thumbnail Icon if any else draws the dummy contact thumbnail. |
62 | 159 |
* @param aGc Graphics context. |
160 |
* @param aBoundingBox Rectangle containing bounds for contact thumbnail. |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
161 |
* @param aDescId Descriptor containing contact id. |
62 | 162 |
*/ |
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
163 |
TBool DrawContactThumbnail( |
62 | 164 |
CWindowGc& aGc, |
165 |
TRect aBoundingBox, |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
166 |
TPtrC aDescId) const; |
62 | 167 |
|
168 |
/** |
|
169 |
* Draws the Action Menu. |
|
170 |
* @param aGc Graphics context. |
|
171 |
* @param aActionMenuArrowRect Rectangle where arrow is to be drawn. |
|
172 |
*/ |
|
173 |
void DrawArrowIcon( CWindowGc& aGc, TRect aActionMenuArrowRect ) const; |
|
174 |
||
175 |
/** |
|
176 |
* Draws the Favourite Icon. Takes the name rect as a parameter. Name rect |
|
177 |
* must be unmirrored, because the mirroring is done as the last thing |
|
178 |
* before drawing. |
|
179 |
* @param aGc Graphics context. |
|
180 |
* @param aNameRectUnMirrored Name rect, after which the icon is drawn |
|
181 |
* @param aEffectiveRect The whole listbox item rect. Used for mirroring. |
|
182 |
*/ |
|
183 |
void DrawFavouriteIcon( |
|
184 |
CWindowGc& aGc, |
|
185 |
TRect aNameRectUnMirrored, |
|
186 |
TRect aEffectiveRect) const; |
|
187 |
||
188 |
private: |
|
189 |
||
190 |
/** Control environment */ |
|
191 |
CCoeEnv& iCoeEnv; |
|
192 |
||
193 |
/** Font to be used showing contact name. Not owned. */ |
|
194 |
CFont* iContactNameFont; |
|
195 |
||
196 |
/** Font to be used showing company name. Not owned. */ |
|
197 |
CFont* iCompanyNameFont; |
|
198 |
||
199 |
/** Handle for loading and storing the thumbnails. Not owned.*/ |
|
200 |
CEasyDialingContactDataManager* iContactDataManager; |
|
201 |
||
202 |
/** Action Menu LeftPointing Arrow for mirrored layout. Owned. */ |
|
203 |
CGulIcon* iArrowPointingRight; |
|
204 |
||
205 |
/** Action Menu RightPointing Arrow. Owned. */ |
|
206 |
CGulIcon* iArrowPointingLeft; |
|
207 |
||
208 |
/** Action icon color bitmap. Owned. */ |
|
209 |
CFbsBitmap* iColorBitmap; |
|
210 |
||
211 |
/** Default image for contacts with no own thumbnail. Owned. */ |
|
212 |
CGulIcon* iDummyThumbnail; |
|
213 |
||
214 |
/** Favourite icon. Owned. */ |
|
215 |
CGulIcon* iFavouriteIcon; |
|
216 |
||
217 |
/** Pointer to listbox. Not owned. */ |
|
218 |
CEasyDialingListBox* iControl; |
|
219 |
}; |
|
220 |
||
221 |
||
222 |
#endif // _EASYDIALINGLISTBOXDATA_H |
|
223 |