63
|
1 |
/*
|
|
2 |
* Copyright (c) 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: CCA custom control. Code has been modified to
|
|
15 |
* suit CCA requirements. See CFormattedCellListBoxItemDrawer
|
|
16 |
* in eikfrlb.cpp
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
#ifndef CCAPPCOMMLAUNCHERCUSTOMLISTBOXITEMDRAWER_H_
|
|
21 |
#define CCAPPCOMMLAUNCHERCUSTOMLISTBOXITEMDRAWER_H_
|
|
22 |
|
|
23 |
#include <eikclb.h>
|
|
24 |
#include <eikfrlb.h>
|
|
25 |
#include <eikslb.h>
|
|
26 |
#include <AknGrid.h>
|
|
27 |
#include <AknUtils.h>
|
|
28 |
#include <eiklbi.h>
|
|
29 |
|
|
30 |
|
|
31 |
#include <eiklbv.h>
|
|
32 |
#include <eiktxlbm.h>
|
|
33 |
#include <eiktxlbx.h>
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
class TAknTextLineLayout;
|
|
38 |
class MAknsSkinInstance;
|
|
39 |
class MAknsControlContext;
|
|
40 |
|
|
41 |
class CCCAppCommLauncherCustomListBoxData;
|
|
42 |
|
|
43 |
class CCCAppCommLauncherCustomListBoxItemDrawer : public CTextListItemDrawer
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
|
|
47 |
/**
|
|
48 |
* C++ default constructor.
|
|
49 |
*
|
|
50 |
* @param aTextListBoxModel The list box model class.
|
|
51 |
* @param aFont Font to be used in listbox.
|
|
52 |
* @param aFormattedCellData Pointer to the list layout drawer class.
|
|
53 |
*/
|
|
54 |
CCCAppCommLauncherCustomListBoxItemDrawer(
|
|
55 |
MTextListBoxModel* aTextListBoxModel,
|
|
56 |
const CFont* aFont,
|
|
57 |
CCCAppCommLauncherCustomListBoxData* aFormattedCellData);
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Destructor.
|
|
61 |
*/
|
|
62 |
~CCCAppCommLauncherCustomListBoxItemDrawer();
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Gets the list layout drawer.
|
|
66 |
*
|
|
67 |
* @return Pointer to the list layout drawer object.
|
|
68 |
*/
|
|
69 |
CCCAppCommLauncherCustomListBoxData* FormattedCellData() const;
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Gets the list layout drawer.
|
|
73 |
*
|
|
74 |
* @return Pointer to the list layout drawer object.
|
|
75 |
*/
|
|
76 |
CCCAppCommLauncherCustomListBoxData* ColumnData() const;
|
|
77 |
// for compability with columnlistbox itemdrawer
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Draws an empty item to the list box.
|
|
81 |
*
|
|
82 |
* @param aItemIndex Not used.
|
|
83 |
* @param aItemRectPos Position for the list box item rectangle.
|
|
84 |
* @param aViewIsDimmed Not used.
|
|
85 |
*/
|
|
86 |
virtual void DrawEmptyItem(TInt aItemIndex, TPoint aItemRectPos,
|
|
87 |
TBool aViewIsDimmed) const;
|
|
88 |
|
|
89 |
/**
|
|
90 |
* This function sets top item index.
|
|
91 |
*
|
|
92 |
* @param aTop Item index value.
|
|
93 |
*/
|
|
94 |
void SetTopItemIndex(TInt aTop);
|
|
95 |
|
|
96 |
/**
|
|
97 |
* List item index and color and style properties.
|
|
98 |
*/
|
|
99 |
struct SListProperties
|
|
100 |
{
|
|
101 |
/** List box item index. */
|
|
102 |
TInt iItem; // must be first
|
|
103 |
|
|
104 |
/** Colour and style properties for the list item. */
|
|
105 |
TListItemProperties iProperties;
|
|
106 |
};
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Clears all properties.
|
|
110 |
*/
|
|
111 |
void ClearAllPropertiesL();
|
|
112 |
|
|
113 |
/**
|
|
114 |
* The SetProperties is convenience method for normal cases.
|
|
115 |
* NOTE that it does NOT work correctly if you can insert/delete
|
|
116 |
* items from the list -- You need to update all properties if
|
|
117 |
* any changes to the item text array happen! Often it is convenient
|
|
118 |
* to override the @c Properties() method. Further, use this only
|
|
119 |
* for small lists.
|
|
120 |
*
|
|
121 |
* It has been implemented as sorted list of (index,Property) pairs.
|
|
122 |
*
|
|
123 |
* If you're using find, aItemIndex for this method is the same as you give
|
|
124 |
* in @c MdcaPoint() points the default @c Properties() does conversion
|
|
125 |
* between indexes.
|
|
126 |
*
|
|
127 |
* @param aItemIndex List box item index.
|
|
128 |
* @param properties Colour and style properties for the list box item.
|
|
129 |
*/
|
|
130 |
void SetPropertiesL(TInt aItemIndex, TListItemProperties properties);
|
|
131 |
|
|
132 |
/**
|
|
133 |
* Function for getting properties of a certain list box item.
|
|
134 |
*
|
|
135 |
* @param aItemIndex The listbox item index.
|
|
136 |
* @return Colour and style properties of wanted
|
|
137 |
* list box item.
|
|
138 |
*/
|
|
139 |
virtual TListItemProperties Properties(TInt aItemIndex) const;
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Gets list box item cell size.
|
|
143 |
*
|
|
144 |
* @return The list box item cell size.
|
|
145 |
*/
|
|
146 |
TSize LafItemSize() { return iItemCellSize; }
|
|
147 |
|
|
148 |
public: // from CTextListItemDrawer
|
|
149 |
|
|
150 |
/**
|
|
151 |
* From @c CTextListItemDrawer.
|
|
152 |
*
|
|
153 |
* Draw an item in a list box.
|
|
154 |
*
|
|
155 |
* @param aItemIndex The index into the model's item array of the item
|
|
156 |
* to draw.
|
|
157 |
* @param aItemTextRect The item’s text rectangle.
|
|
158 |
* @param aItemIsCurrent @c ETrue if the item is current. @c EFalse
|
|
159 |
* otherwise.
|
|
160 |
* @param aViewIsEmphasized @c ETrue if the view is emphasized. @c EFalse
|
|
161 |
* otherwise.
|
|
162 |
* @param aItemIsSelected @c ETrue if the item is selected. @c EFalse
|
|
163 |
* otherwise.
|
|
164 |
*/
|
|
165 |
void DrawItemText(TInt aItemIndex,const TRect& aItemTextRect,
|
|
166 |
TBool aItemIsCurrent, TBool aViewIsEmphasized,
|
|
167 |
TBool aItemIsSelected) const;
|
|
168 |
|
|
169 |
/**
|
|
170 |
* From @c CTextListItemDrawer.
|
|
171 |
*
|
|
172 |
* Draws an item tick mark.
|
|
173 |
*
|
|
174 |
* A tick mark is used in multiple selection lists to indicate the item is
|
|
175 |
* selected.
|
|
176 |
*
|
|
177 |
* This function is invoked by the framework to draw an item mark if
|
|
178 |
* @c iDrawMark is set. The mark should be drawn into this list item
|
|
179 |
* drawer's graphics context; by default, @c DrawItemMark() draws a tick
|
|
180 |
* using the standard symbol font.
|
|
181 |
*
|
|
182 |
* This function does not need to be re-implemented for derived classes
|
|
183 |
* which do not draw item marks.
|
|
184 |
*
|
|
185 |
* @param aItemIsSelected Whether the item to draw for is selected.
|
|
186 |
* @param aViewIsDimmed Whether the item is dimmed.
|
|
187 |
* @param aMarkPos Position of the mark.
|
|
188 |
*/
|
|
189 |
void DrawItemMark(TBool aItemIsSelected, TBool aViewIsDimmed,
|
|
190 |
const TPoint& aMarkPos) const;
|
|
191 |
|
|
192 |
public: // from CListItemDrawer
|
|
193 |
|
|
194 |
/**
|
|
195 |
* From @c CListItemDrawer.
|
|
196 |
*
|
|
197 |
* Gets the minimum size of a cell based on the font and the number of
|
|
198 |
* characters in the cell.
|
|
199 |
*
|
|
200 |
* @return The minimum size for a cell in pixels.
|
|
201 |
*/
|
|
202 |
TSize MinimumCellSize() const;
|
|
203 |
|
|
204 |
/**
|
|
205 |
* From @c CListItemDrawer.
|
|
206 |
*
|
|
207 |
* Gets the width in pixels of the specified item.
|
|
208 |
*
|
|
209 |
* @param aItemIndex The index of the item for which the width is obtained.
|
|
210 |
* @return The specified item's width in pixels.
|
|
211 |
*/
|
|
212 |
TInt ItemWidthInPixels(TInt aItemIndex) const;
|
|
213 |
|
|
214 |
/**
|
|
215 |
* From @c CListItemDrawer.
|
|
216 |
*
|
|
217 |
* Sets the item cell size.
|
|
218 |
*
|
|
219 |
* The cell size is the on-screen size of the entire item, including its
|
|
220 |
* text and its item mark.
|
|
221 |
*
|
|
222 |
* @param aSizeInPixels New size for the item cell.
|
|
223 |
*/
|
|
224 |
void SetItemCellSize(const TSize& aSizeInPixels);
|
|
225 |
|
|
226 |
protected:
|
|
227 |
|
|
228 |
/**
|
|
229 |
* Draws current item rectangle.
|
|
230 |
*
|
|
231 |
* @param aRect Current item rectangle.
|
|
232 |
*/
|
|
233 |
void DrawCurrentItemRect(const TRect& aRect) const;
|
|
234 |
|
|
235 |
/**
|
|
236 |
* @c WordWrapListItem is used with @c CAknDouble* style listboxes.
|
|
237 |
* If listbox does not have 2nd line defined, @c WordWrapListItem
|
|
238 |
* wraps 1st line to 2nd line, if text does not fit to 1st line.
|
|
239 |
* If listbox does have 2nd line defined, this method truncates
|
|
240 |
* both lines.
|
|
241 |
*
|
|
242 |
* @internal
|
|
243 |
* @param aTarget Where to place wrapped item string
|
|
244 |
* @param aItemString Text to be wrapped
|
|
245 |
* @param aFirstIndex index of 1st subcell to wrap
|
|
246 |
* @param aSecondIndex index of 2nd subcell
|
|
247 |
*/
|
|
248 |
void WordWrapListItem( TPtr& aTarget,
|
|
249 |
const TDesC &aItemString,
|
|
250 |
TInt aFirstIndex,
|
|
251 |
TInt aSecondIndex,
|
|
252 |
TInt aItemIndex ) const;
|
|
253 |
/**
|
|
254 |
* @internal
|
|
255 |
*/
|
|
256 |
void DrawBackgroundAndSeparatorLines(
|
|
257 |
const TRect& aItemTextRect, TBool aDrawSeparator ) const;
|
|
258 |
|
|
259 |
|
|
260 |
|
|
261 |
private:
|
|
262 |
|
|
263 |
void CCCAppCommLauncherCustomListBoxItemDrawer_Reserved();
|
|
264 |
|
|
265 |
protected:
|
|
266 |
|
|
267 |
/**
|
|
268 |
* Top item index.
|
|
269 |
*/
|
|
270 |
TInt iTopItemIndex;
|
|
271 |
|
|
272 |
/**
|
|
273 |
* Array for list box item's properties.
|
|
274 |
* Own.
|
|
275 |
*/
|
|
276 |
CArrayFix<SListProperties>* iPropertyArray;
|
|
277 |
|
|
278 |
private:
|
|
279 |
|
|
280 |
TInt iSpare;
|
|
281 |
};
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
#endif /* CCAPPCOMMLAUNCHERCUSTOMLISTBOXITEMDRAWER_H_ */
|