|
1 /* |
|
2 * Copyright (c) 2007 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: A visualizer class for the MultiLine item. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_FSMULTILINEITEMVISUALIZER_H |
|
20 #define C_FSMULTILINEITEMVISUALIZER_H |
|
21 |
|
22 class CAlfControl; |
|
23 class CAlfLayout; |
|
24 class CAlfTexture; |
|
25 |
|
26 class CFsMultiLineItemData; |
|
27 |
|
28 #include "fstreeitemvisualizerbase.h" |
|
29 |
|
30 /** |
|
31 * CFsMultiLineItemVisualizer is a visualizer for an item with 1-4 lines. |
|
32 * |
|
33 * This class is a concrete implementation for the MFsTreeItemVisualizer |
|
34 * interface. It provides visualization for a Multiline item's data. |
|
35 * |
|
36 * @code |
|
37 * |
|
38 * @endcode |
|
39 * |
|
40 * @lib |
|
41 */ |
|
42 NONSHARABLE_CLASS( CFsMultiLineItemVisualizer ): |
|
43 public CFsTreeItemVisualizerBase |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Two-phased constructor |
|
49 * |
|
50 * @param aOwnerControl Owner control. |
|
51 */ |
|
52 IMPORT_C static CFsMultiLineItemVisualizer* NewL( |
|
53 CAlfControl& aOwnerControl ); |
|
54 |
|
55 /** |
|
56 * C++ destructor |
|
57 */ |
|
58 virtual ~CFsMultiLineItemVisualizer(); |
|
59 |
|
60 public: |
|
61 |
|
62 //visualizer's interface |
|
63 |
|
64 /** |
|
65 * The function sets how many lines the multiline item has when it's not extended. |
|
66 * |
|
67 * @param aNumberOfLines Number of lines in not extended state (1-4).Note that |
|
68 * the value should be <= than the number of lines in extended state. |
|
69 */ |
|
70 virtual void SetNumberOfLinesWhenNotExtended( TInt aNumberOfLines ); |
|
71 |
|
72 /** |
|
73 * The function returns how many lines the item has when it's not extended. |
|
74 * |
|
75 * @return Number of lines in not extended state (1-4). |
|
76 */ |
|
77 virtual TInt NumberOfLinesWhenNotExtended( ) const; |
|
78 |
|
79 /** |
|
80 * The function sets how many lines the multiline item has when it's extended. |
|
81 * |
|
82 * @param aNumberOfLines Number of lines in extended state (1-4).Note that |
|
83 * the value should be >= than the number of lines in not extended state. |
|
84 */ |
|
85 virtual void SetNumberOfLinesWhenExtended( TInt aNumberOfLines ); |
|
86 |
|
87 /** |
|
88 * The function returns how many lines the item has when it's extended. |
|
89 * |
|
90 * @return Number of lines in extended state (1-4). |
|
91 */ |
|
92 virtual TInt NumberOfLinesWhenExtended( ) const; |
|
93 |
|
94 /** |
|
95 * The function sets state of the item's checkbox. |
|
96 * A call of this function should be followed by a call of list's |
|
97 * visualizer's function UpdateItemL() or RefreshListViewL(). |
|
98 * |
|
99 * @param ETrue Sets checkbox to "on" state. |
|
100 * EFalse Sets checkbox to "off" state. |
|
101 */ |
|
102 virtual void SetCheckboxState( TBool aChecked ); |
|
103 |
|
104 /** |
|
105 * The function returns state of the item's checkbox. |
|
106 * |
|
107 * @return ETrue Checkbox is in "on" state. |
|
108 * EFalse Checkbox is in "off" state. |
|
109 */ |
|
110 virtual TBool CheckboxState () const; |
|
111 |
|
112 /** |
|
113 * The function sets whether place holders should be kept when icons in the |
|
114 * first column are not present. |
|
115 * |
|
116 * @param ETrue if place holders should be present. EFalse otherwise. |
|
117 */ |
|
118 virtual void SetKeepEmptyIconsPlaceHolders( TBool aKeep ); |
|
119 |
|
120 /** |
|
121 * The function returns whether place holders are kept in case icons are |
|
122 * not set. |
|
123 * |
|
124 * @returm ETrue if place holders are present. EFasle otherwise. |
|
125 */ |
|
126 virtual TBool IsKeepEmptyIconsPlaceHolders( ) const; |
|
127 |
|
128 public: |
|
129 |
|
130 // from base class MFsTreeItemVisualizer |
|
131 |
|
132 /** |
|
133 * Returns the type of the item's visualizer. |
|
134 */ |
|
135 virtual TFsTreeItemVisualizerType Type() const; |
|
136 |
|
137 /** |
|
138 * From MFsTreeItemVisualizer. |
|
139 * Returns the size of an item in a normal (not extended) state. |
|
140 * |
|
141 * @return Size in pixels of an item when it is not extended. |
|
142 */ |
|
143 virtual TSize Size() const; |
|
144 |
|
145 /** |
|
146 * From MFsTreeItemVisualizer. |
|
147 * Returns the size of an item in expanded state. |
|
148 * |
|
149 * @return Size in pixels of the item when it is in expanded state. |
|
150 */ |
|
151 virtual TSize ExtendedSize() const; |
|
152 |
|
153 /** |
|
154 * From MFsTreeItemVisualizer. |
|
155 * A call to this function means that the item is requested to draw itself |
|
156 * within specified parent layout. Data to be visualized is passed as an |
|
157 * argument. |
|
158 * |
|
159 * Parameter descriptions will be added when the final function prototype |
|
160 * is ready. |
|
161 */ |
|
162 virtual void ShowL( CAlfLayout& aParentLayout, |
|
163 const TUint aTimeout = 0 ); |
|
164 |
|
165 /** |
|
166 * A call to this function means that the item is requested to update its |
|
167 * visual content. |
|
168 */ |
|
169 virtual void UpdateL( const MFsTreeItemData& aData, |
|
170 TBool aFocused, |
|
171 const TUint aLevel, |
|
172 CAlfTexture*& aMarkIcon, |
|
173 CAlfTexture*& aMenuIcon, |
|
174 const TUint aTimeout = 0, |
|
175 TBool aUpdateData = ETrue); |
|
176 |
|
177 |
|
178 /** |
|
179 * This method sets flag disable wrapping the text item. |
|
180 */ |
|
181 virtual void OffWrapping(); |
|
182 |
|
183 /** |
|
184 * From MFsTreeItemVisualizer. |
|
185 * A call to this function means that the item goes out of the visible |
|
186 * items scope. The visualizer should destroy all its visuals to save |
|
187 * memory. |
|
188 */ |
|
189 virtual void Hide( const TInt aTimeout = 0 ); |
|
190 |
|
191 |
|
192 protected: |
|
193 |
|
194 /** |
|
195 * C++ constructor |
|
196 * |
|
197 * @param aOwnerControl Owner control. |
|
198 */ |
|
199 CFsMultiLineItemVisualizer( CAlfControl& aOwnerControl ); |
|
200 |
|
201 /** |
|
202 * Second phase constructor |
|
203 * |
|
204 */ |
|
205 void ConstructL( ); |
|
206 |
|
207 private: |
|
208 |
|
209 /** |
|
210 */ |
|
211 void UpdateLayout(const CFsMultiLineItemData* aData, const TInt aIndentation ); |
|
212 |
|
213 /** |
|
214 * Returns item's size in state with given number of lines. |
|
215 * |
|
216 * @param aNumberLines Number of item's lines (1-4) |
|
217 * @return Size of item. TSize(0,0) in case invalid number of lines was passed to the func. |
|
218 */ |
|
219 TSize SizeWithNumberOfLines( const TInt aNumberLines ) const; |
|
220 |
|
221 protected: //data |
|
222 |
|
223 /** |
|
224 * State of item's checkbox. |
|
225 * |
|
226 * ETrue - checkbox is "on" |
|
227 * EFalse - checkbox is "off" |
|
228 */ |
|
229 TBool iCheckState; |
|
230 |
|
231 /** |
|
232 * Place holders for empty icons should be kept or not. |
|
233 */ |
|
234 TBool iKeepPlaceHolders; |
|
235 |
|
236 /** |
|
237 * Number of lines (1-4) when item is not extended. |
|
238 */ |
|
239 TInt iNumLinesNotExtended; |
|
240 |
|
241 /** |
|
242 * Number of lines (1-4) when item is extended. |
|
243 */ |
|
244 TInt iNumLinesExtended; |
|
245 |
|
246 ///////////////////////////first line/////////////////////////// |
|
247 /** |
|
248 * Text visual. |
|
249 * Own. |
|
250 */ |
|
251 CAlfTextVisual* iFirstLineTextVis; |
|
252 |
|
253 /** |
|
254 * Visual for an icon. |
|
255 */ |
|
256 CAlfImageVisual* iFirstLineIconVis; |
|
257 |
|
258 /** |
|
259 * Visual for a checkbox icon. |
|
260 */ |
|
261 CAlfImageVisual* iCheckBoxIconVis; |
|
262 |
|
263 /** |
|
264 * Visual for a mark icon. |
|
265 */ |
|
266 CAlfImageVisual* iMarkIconVis; |
|
267 |
|
268 /** |
|
269 * Visual for a menu icon. |
|
270 */ |
|
271 CAlfImageVisual* iMenuIconVis; |
|
272 |
|
273 ///////////////////////////second line/////////////////////////// |
|
274 /** |
|
275 * |
|
276 */ |
|
277 CAlfTextVisual* iSecondLineTextVis; |
|
278 |
|
279 /** |
|
280 * Visual for an icon. |
|
281 */ |
|
282 CAlfImageVisual* iSecondLineIconVis; |
|
283 |
|
284 ///////////////////////////third line/////////////////////////// |
|
285 /** |
|
286 */ |
|
287 CAlfTextVisual* iThirdLineTextVis; |
|
288 |
|
289 /** |
|
290 * Visual for an icon. |
|
291 */ |
|
292 CAlfImageVisual* iThirdLineIconVis; |
|
293 |
|
294 ///////////////////////////fourth line/////////////////////////// |
|
295 /** |
|
296 */ |
|
297 CAlfTextVisual* iFourthLineTextVis; |
|
298 |
|
299 /** |
|
300 * Visual for an icon. |
|
301 */ |
|
302 CAlfImageVisual* iFourthLineIconVis; |
|
303 |
|
304 }; |
|
305 |
|
306 #endif //C_FSMULTILINEITEMVISUALIZER_H |