|
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 for data items with plain text. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_FSTREEPLAINTWOLINEITEMVISUALIZER_H |
|
20 #define C_FSTREEPLAINTWOLINEITEMVISUALIZER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
24 //#include <fsconfig.h> |
|
25 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
26 |
|
27 #include "fstreeplainonelineitemvisualizer.h" |
|
28 |
|
29 class CFsTreePlainTwoLineItemData; |
|
30 class TFsMarqueeClet; |
|
31 |
|
32 |
|
33 /** |
|
34 * CFsTreePlainTwoLineItemVisualizer is a visualizer for data items with plain |
|
35 * text. |
|
36 * |
|
37 * Thic class is a concrete implementation for the MFsTreeItemVisualizer |
|
38 * interface. It provides visualization for data items with plain text. |
|
39 * |
|
40 * @code |
|
41 * |
|
42 * @endcode |
|
43 * |
|
44 * @lib |
|
45 */ |
|
46 NONSHARABLE_CLASS( CFsTreePlainTwoLineItemVisualizer ): |
|
47 public CFsTreePlainOneLineItemVisualizer |
|
48 { |
|
49 public: |
|
50 |
|
51 /** |
|
52 * Two-phased constructor |
|
53 * |
|
54 * @param aOwnerControl Owner control. |
|
55 */ |
|
56 IMPORT_C static CFsTreePlainTwoLineItemVisualizer* NewL( |
|
57 CAlfControl& aOwnerControl ); |
|
58 |
|
59 /** |
|
60 * C++ destructor |
|
61 */ |
|
62 virtual ~CFsTreePlainTwoLineItemVisualizer(); |
|
63 |
|
64 public: |
|
65 |
|
66 /** |
|
67 * Returns the type of the item's visualizer. |
|
68 */ |
|
69 virtual TFsTreeItemVisualizerType Type() const; |
|
70 |
|
71 /** |
|
72 * Sets horizontal alignment of the displayed plain text. |
|
73 * |
|
74 * For AH layout EAlfAlignHLeft is internally converted to EAlfAlignHRight |
|
75 * and EAlfAlignHRight is converted to EAlfAlignHLeft. |
|
76 * |
|
77 * EAlfAlignHLocale (default setting) - alignment set according to text directionality |
|
78 * |
|
79 * @param aAlign Horizontal text alignment type. |
|
80 */ |
|
81 IMPORT_C virtual void SetSecondaryTextAlign( |
|
82 const TAlfAlignHorizontal aAlign ); |
|
83 |
|
84 /** |
|
85 * Turn on/off displaying preview pane (3rd line). |
|
86 * |
|
87 * @param aPreviewOn ETrue, preview pane is displayed. EFalse, preview |
|
88 * pane is hidden. |
|
89 */ |
|
90 virtual void SetPreviewPaneOn( TBool aPreviewOn ); |
|
91 |
|
92 /** |
|
93 * Retrurns infromation whether preview pane is turned on. |
|
94 * |
|
95 * @return ETrue if preview pane (3rd line) is turned on. |
|
96 */ |
|
97 virtual TBool IsPreviewPaneOn () const; |
|
98 |
|
99 /** |
|
100 * Sets the size of the item visualization area when it has preview pane |
|
101 * turned on. |
|
102 * |
|
103 * @param aSize Size in pixels of the item when it has preview pane |
|
104 * turned on. |
|
105 */ |
|
106 virtual void SetPreviewPaneEnabledSize ( const TSize aSize ); |
|
107 |
|
108 /** |
|
109 * Returns the size of an item when it has preview pane turned on. |
|
110 * |
|
111 * @return Size in pixels of the item when has preview pane turned on. |
|
112 */ |
|
113 virtual TSize PreviewPaneEnabledSize() const; |
|
114 |
|
115 /** |
|
116 * Function sets wether flag icon should be visible or hidden. |
|
117 * By default the icon is shown (if it is set). |
|
118 * |
|
119 * @param aFlagVisible ETrue if flag icon should be visible. |
|
120 */ |
|
121 virtual void SetFlagIconVisible( TBool aFlagVisible ); |
|
122 |
|
123 /** |
|
124 * Function returns information if flag icon is visible or hidden. |
|
125 * |
|
126 * @return ETrue if flag icon is visible. |
|
127 */ |
|
128 virtual TBool IsFlagIconVisible( ) const; |
|
129 |
|
130 /** |
|
131 * The function sets whether time visual should be visible when item is |
|
132 * not focused (in one line layout). |
|
133 * |
|
134 * @param ETrue if time visual should be visible. |
|
135 */ |
|
136 virtual void SetIsTimeVisibleInFirstLineWhenNotFocused( TBool aIsVisible ); |
|
137 |
|
138 /** |
|
139 * The function returns whether time visual is visible when item is not |
|
140 * focused (in one line layout). |
|
141 * |
|
142 * @return ETrue if time visual is visible. |
|
143 */ |
|
144 virtual TBool IsTimeVisibleInFirstLineWhenNotFocused( ) const; |
|
145 |
|
146 |
|
147 // from base class MFsTreeItemVisualizer |
|
148 |
|
149 /** |
|
150 * From MFsTreeItemVisualizer. |
|
151 * Returns the size of an item in a normal (not extended) state. |
|
152 * |
|
153 * @return Size in pixels of an item when it is not extended. |
|
154 */ |
|
155 virtual TSize Size() const; |
|
156 |
|
157 /** |
|
158 * From MFsTreeItemVisualizer. |
|
159 * Returns the size of an item in expanded state. |
|
160 * |
|
161 * @return Size in pixels of the item when it is in expanded state. |
|
162 */ |
|
163 virtual TSize ExtendedSize() const; |
|
164 |
|
165 /** |
|
166 * From MFsTreeItemVisualizer. |
|
167 * A call to this function means that the item is requested to draw itself |
|
168 * within specified parent layout. Data to be visualized is passed as an |
|
169 * argument. |
|
170 * |
|
171 * Parameter descriptions will be added when the final function prototype |
|
172 * is ready. |
|
173 */ |
|
174 virtual void ShowL( CAlfLayout& aParentLayout, |
|
175 const TUint aTimeout = 0 ); |
|
176 |
|
177 /** |
|
178 * A call to this function means that the item is requested to update its |
|
179 * visual content. |
|
180 */ |
|
181 virtual void UpdateL( const MFsTreeItemData& aData, |
|
182 TBool aFocused, |
|
183 const TUint aLevel, |
|
184 CAlfTexture*& aMarkIcon, |
|
185 CAlfTexture*& aMenuIcon, |
|
186 const TUint aTimeout = 0, |
|
187 TBool aUpdateData = ETrue); |
|
188 |
|
189 /** |
|
190 * From MFsTreeItemVisualizer. |
|
191 * A call to this function means that the item goes out of the visible |
|
192 * items scope. The visualizer should destroy all its visuals to save |
|
193 * memory. |
|
194 */ |
|
195 virtual void Hide( const TInt aTimeout = 0 ); |
|
196 |
|
197 /** |
|
198 * From MFsTreeItemVisualizer. |
|
199 * This method marquees the text in tree item if it is too long. |
|
200 * |
|
201 * @param aMarqueeType Type of marquee. |
|
202 * @param aMarqueeSpeed Speed of marquee in pixels per second. |
|
203 * @param aMarqueeStartDelay Marquee's start delay in miliseconds. |
|
204 * @param aMarqueeCycleStartDelay Marquee cycle's start delay. |
|
205 * @param aMarqueeRepetitions Number of marquee's cycles. |
|
206 */ |
|
207 virtual void MarqueeL(const TFsTextMarqueeType aMarqueeType, |
|
208 const TUint aMarqueeSpeed, |
|
209 const TInt aMarqueeStartDelay, |
|
210 const TInt aMarqueeCycleStartDelay, |
|
211 const TInt aMarqueeRepetitions); |
|
212 |
|
213 /** |
|
214 * |
|
215 */ |
|
216 virtual TBool OfferEventL(const TAlfEvent& aEvent); |
|
217 |
|
218 |
|
219 virtual void SetKeyWordsToHighlight(const RPointerArray<TDesC>& aKeyWords); |
|
220 protected: |
|
221 |
|
222 /** |
|
223 * C++ constructor |
|
224 * |
|
225 * @param aOwnerControl Owner control. |
|
226 */ |
|
227 CFsTreePlainTwoLineItemVisualizer( CAlfControl& aOwnerControl ); |
|
228 |
|
229 /** |
|
230 * Second phase constructor |
|
231 * |
|
232 */ |
|
233 void ConstructL( ); |
|
234 |
|
235 private: |
|
236 void HighlightKeyWords(TDesC& aText); |
|
237 void UpdateLayout( |
|
238 const CFsTreePlainTwoLineItemData* aData, |
|
239 const TInt aIndentation ); |
|
240 |
|
241 private: // member data |
|
242 |
|
243 /** |
|
244 * Text visual. |
|
245 * Own. |
|
246 */ |
|
247 CAlfTextVisual* iSecondaryTextVisual; |
|
248 |
|
249 /** |
|
250 * Secondary viewport layout. For text marquee. |
|
251 * Own. |
|
252 */ |
|
253 CAlfViewportLayout* iSecViewport; |
|
254 |
|
255 /* |
|
256 * Horizontal text alignment in visual. |
|
257 */ |
|
258 TAlfAlignHorizontal iSecondaryTextAlign; |
|
259 |
|
260 /** |
|
261 * Preview pane is on/off. |
|
262 */ |
|
263 TBool iPreviewPaneOn; |
|
264 |
|
265 /** |
|
266 * Flag icon shown/hidden. |
|
267 */ |
|
268 TBool iShowFlagIcon; |
|
269 |
|
270 /** |
|
271 * Size of item when preview pane is on. |
|
272 */ |
|
273 TSize iPreviewPaneEnabledSize; |
|
274 |
|
275 /** |
|
276 * Visual for a flag icon. |
|
277 */ |
|
278 CAlfImageVisual* iIconFlagVisual; |
|
279 |
|
280 /** |
|
281 * Date and time text visual. |
|
282 * Own. |
|
283 */ |
|
284 CAlfTextVisual* iDateTimeTextVisual; |
|
285 |
|
286 /** |
|
287 * Preview pane text visual. |
|
288 * Own. |
|
289 */ |
|
290 CAlfTextVisual* iPreviewPaneTextVisual; |
|
291 |
|
292 /** |
|
293 * Clet for secondary text marquee. |
|
294 */ |
|
295 TFsMarqueeClet* iSecondaryTextMarquee; |
|
296 |
|
297 /** |
|
298 * Time visual shown/hidden in not focused one line layout. |
|
299 */ |
|
300 TBool iIsTimeVisibleWhenNotFocused; |
|
301 |
|
302 RPointerArray<TDesC> iKeyWords; |
|
303 }; |
|
304 |
|
305 #endif // C_FSTREEPLAINTWOLINEITEMVISUALIZER_H |