25
|
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: Freestyle tree list component
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef M_FSTREEITEMVISUALIZER_H
|
|
20 |
#define M_FSTREEITEMVISUALIZER_H
|
|
21 |
|
|
22 |
//////PROJECT INCLUDES
|
|
23 |
#include "fstreelistconstants.h"
|
|
24 |
#include <alf/alfgc.h>
|
|
25 |
class TRgb;
|
|
26 |
//////TOOLKIT CLASSES
|
|
27 |
class CAlfTexture;
|
|
28 |
//class TAlfAlignHorizontal;
|
|
29 |
class CAlfLayout;
|
|
30 |
class CAlfTexture;
|
|
31 |
class CAlfBrush;
|
|
32 |
|
|
33 |
//////PROJECT CLASSES
|
|
34 |
class MFsTreeItemData;
|
|
35 |
class CFsTreeList;
|
|
36 |
class CFsLayoutManager;
|
|
37 |
class CFsAlfTextStyleManager;
|
|
38 |
|
|
39 |
|
|
40 |
enum TFsTreeItemVisualizerType
|
|
41 |
{
|
|
42 |
EFsTreeItemVisualizerBase,
|
|
43 |
EFsTreeNodeVisualizerBase,
|
|
44 |
EFsTreePlainOneLineItemVisualizer,
|
|
45 |
EFsTreePlainTwoLineItemVisualizer,
|
|
46 |
EFsTreePlainOneLineNodeVisualizer,
|
|
47 |
EFsTreePlainRootVisualizer,
|
|
48 |
EFsTreeRichItemVisualizer,
|
|
49 |
EFsMultiLineItemVisualizer,
|
|
50 |
EFsSeparatorVisualizer,
|
|
51 |
EFsVisualizerCount //number of visualizers
|
|
52 |
};
|
|
53 |
|
|
54 |
|
|
55 |
const TUint32 KFsTreeListItemMarked = 0x0001;
|
|
56 |
const TUint32 KFsTreeListItemFocused = 0x0002;
|
|
57 |
const TUint32 KFsTreeListItemDimmed = 0x0004;
|
|
58 |
const TUint32 KFsTreeListItemExtended = 0x0008;
|
|
59 |
const TUint32 KFsTreeListItemExtendable = 0x0010;
|
|
60 |
const TUint32 KFsTreeListItemHidden = 0x0020;
|
|
61 |
const TUint32 KFsTreeListNodeExpanded = 0x0040;
|
|
62 |
const TUint32 KFsTreeListItemDisplayIcons = 0x0080;
|
|
63 |
const TUint32 KFsTreeListItemFocusable = 0x0100;
|
|
64 |
const TUint32 KFsTreeListItemTextShadow = 0x0200;
|
|
65 |
const TUint32 KFsTreeListItemAlwaysExtended = 0x0400;
|
|
66 |
const TUint32 KFsTreeListItemManagedLayout = 0x0800;
|
|
67 |
const TUint32 KFsTreeListItemHasMenu = 0x1000;
|
|
68 |
const TUint32 KFsTreeListItemTextBold = 0x2000;
|
|
69 |
|
|
70 |
|
|
71 |
const TInt KFsDefaultIndentation = 20;
|
|
72 |
|
|
73 |
|
|
74 |
/**
|
|
75 |
* MFsTreeItemVisualizer is an interface for the item visualizer.
|
|
76 |
*
|
|
77 |
* This is an interface for item visualization in the tree. This interface is
|
|
78 |
* used to change the visual appearance of the items in the list. This
|
|
79 |
* interface is also used to request from the item visualizer that it should
|
|
80 |
* draw data passed as an argument within given parent layout.
|
|
81 |
* @code
|
|
82 |
*
|
|
83 |
* @endcode
|
|
84 |
*
|
|
85 |
* @lib
|
|
86 |
*/
|
|
87 |
NONSHARABLE_CLASS( MFsTreeItemVisualizer )
|
|
88 |
{
|
|
89 |
public:
|
|
90 |
|
|
91 |
/**
|
|
92 |
* C++ destructor
|
|
93 |
*/
|
|
94 |
virtual ~MFsTreeItemVisualizer() {};
|
|
95 |
|
|
96 |
public:
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Type of the item's visualizer.
|
|
100 |
*/
|
|
101 |
virtual TFsTreeItemVisualizerType Type() const = 0;
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Sets multiple flags for an item at one time.
|
|
105 |
*
|
|
106 |
* @param aFlags Flags for item visualizer.
|
|
107 |
*/
|
|
108 |
virtual void SetFlags( TUint32 aFlags ) = 0;
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Returns flags of the item visualizer.
|
|
112 |
*
|
|
113 |
* @return Item visualizer's flags value.
|
|
114 |
*/
|
|
115 |
virtual TUint32 Flags() = 0;
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Sets visualized item's state to marked/unmarked.
|
|
119 |
*
|
|
120 |
* @param aFlag ETrue to visualize item as marked.
|
|
121 |
*/
|
|
122 |
virtual void SetMarked( TBool aFlag ) = 0;
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Returns mark/unmark state of the item's visualization.
|
|
126 |
*
|
|
127 |
* @return ETrue if item is visualized as marked.
|
|
128 |
*/
|
|
129 |
virtual TBool IsMarked() const = 0;
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Sets visualized item's state to dimmed/not dimmed.
|
|
133 |
*
|
|
134 |
* @param aFlag ETrue to visualize item as dimmed.
|
|
135 |
*/
|
|
136 |
virtual void SetDimmed( TBool aFlag ) = 0;
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Returns dimmed/not dimmed state of the item's visualization.
|
|
140 |
*
|
|
141 |
* @return ETrue if item is visualized as dimmed.
|
|
142 |
*/
|
|
143 |
virtual TBool IsDimmed() const = 0;
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Sets the size of the item visualization when item is not in expanded
|
|
147 |
* state.
|
|
148 |
*
|
|
149 |
* @param aSize Size in pixels of the an when it is not expanded.
|
|
150 |
*/
|
|
151 |
virtual void SetSize( TSize aSize ) = 0;
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Returns the size of an item in a normal (not expanded) state.
|
|
155 |
*
|
|
156 |
* @return Size in pixels of an item when it is not expanded.
|
|
157 |
*/
|
|
158 |
virtual TSize Size() const = 0;
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Sets the item's visualization state to expanded. This state is used to
|
|
162 |
* preview more data of an item.
|
|
163 |
*
|
|
164 |
* @param aFlag ETrue to visualize item as expanded.
|
|
165 |
*/
|
|
166 |
virtual void SetExtended( TBool aFlag ) = 0;
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Returns expanded/not expanded state of the item visualization.
|
|
170 |
*
|
|
171 |
* @return ETrue if item is visualized as expanded.
|
|
172 |
*/
|
|
173 |
virtual TBool IsExtended() const = 0;
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Sets if an item can be in expanded state or not.
|
|
177 |
*
|
|
178 |
* @param aFlag ETrue if item can be in expanded state.
|
|
179 |
*/
|
|
180 |
virtual void SetExtendable( TBool aFlag ) = 0;
|
|
181 |
|
|
182 |
/**
|
|
183 |
* Returns an information if item can be in expanded state.
|
|
184 |
*
|
|
185 |
* @return ETrue if item can be in expanded state.
|
|
186 |
*/
|
|
187 |
virtual TBool IsExtendable( ) = 0;
|
|
188 |
|
|
189 |
/**
|
|
190 |
* Returns an information if item can be focused.
|
|
191 |
*
|
|
192 |
* @return ETrue if item can be focused.
|
|
193 |
*/
|
|
194 |
virtual TBool IsFocusable( ) const = 0;
|
|
195 |
|
|
196 |
/**
|
|
197 |
* Used to set/unset item's ability to receive focus.
|
|
198 |
*
|
|
199 |
* @param aFlag ETrue if item can be focused.
|
|
200 |
*/
|
|
201 |
virtual void SetFocusable( const TBool aFlag ) = 0;
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Sets the size of the item visualization area when item is in expanded
|
|
205 |
* state.
|
|
206 |
*
|
|
207 |
* @param aSize Size in pixels of the item when it is expanded.
|
|
208 |
*/
|
|
209 |
virtual void SetExtendedSize( TSize aSize ) = 0;
|
|
210 |
|
|
211 |
/**
|
|
212 |
* Returns the size of an item in expanded state.
|
|
213 |
*
|
|
214 |
* @return Size in pixels of the item when it is in expanded state.
|
|
215 |
*/
|
|
216 |
virtual TSize ExtendedSize() const = 0;
|
|
217 |
|
|
218 |
/**
|
|
219 |
* Sets visualized item's state to hidden/visible.
|
|
220 |
*
|
|
221 |
* @param ETrue if item should be visualized as hidden.
|
|
222 |
*/
|
|
223 |
virtual void SetHidden( TBool aFlag ) = 0;
|
|
224 |
|
|
225 |
/**
|
|
226 |
* Returns an information if the item is hidden or not.
|
|
227 |
*
|
|
228 |
* @return ETrue if item is hiddden, EFalse if item is visible.
|
|
229 |
*/
|
|
230 |
virtual TBool IsHidden() = 0;
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Enables or disables text shadow.
|
|
234 |
*
|
|
235 |
* @param aShadowOn Pass ETrue if shadow should be enabled
|
|
236 |
* EFalse otherwise.
|
|
237 |
*/
|
|
238 |
virtual void EnableTextShadow( const TBool aShadowOn = ETrue ) = 0;
|
|
239 |
|
|
240 |
/**
|
|
241 |
* Sets text indentation.
|
|
242 |
*
|
|
243 |
* @param aIndentation Indentation in pixels.
|
|
244 |
*/
|
|
245 |
virtual void SetIndentation( const TInt aIndentation ) = 0;
|
|
246 |
|
|
247 |
/**
|
|
248 |
* Sets item background color.
|
|
249 |
*
|
|
250 |
* @param aColor New background color.
|
|
251 |
*/
|
|
252 |
virtual void SetBackgroundColor( const TRgb aColor ) = 0;
|
|
253 |
|
|
254 |
/**
|
|
255 |
* Returns background color if it's set.
|
|
256 |
*
|
|
257 |
* @param aColor Out parameter. Contains background color.
|
|
258 |
*
|
|
259 |
* @return ETrue if background color is set, EFalse otherwise.
|
|
260 |
*/
|
|
261 |
virtual TBool GetBackgroundColor( TRgb& aColor ) = 0;
|
|
262 |
|
|
263 |
/**
|
|
264 |
* Sets item background texture.
|
|
265 |
*
|
|
266 |
* @param aTexture New background texture.
|
|
267 |
*/
|
|
268 |
virtual void SetBackgroundTexture( const CAlfTexture& aTexture ) = 0;
|
|
269 |
|
|
270 |
// <cmail>
|
|
271 |
/**
|
|
272 |
* Sets item background brush. Ownership not transfered.
|
|
273 |
*
|
|
274 |
* @param aBrush New background brush.
|
|
275 |
*/
|
|
276 |
virtual void SetBackgroundBrush( CAlfBrush* aBrush ) = 0;
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Returns item background brush.
|
|
280 |
*
|
|
281 |
* @param aBrush Out parameter. Contains pointer to a background brush.
|
|
282 |
* Ownerhship is transferred to the caller.
|
|
283 |
*
|
|
284 |
* @return ETrue if background brush is set, EFalse otherwise.
|
|
285 |
*/
|
|
286 |
virtual TBool GetBackgroundBrush( CAlfBrush*& aBrush ) = 0;
|
|
287 |
// </cmail>
|
|
288 |
|
|
289 |
/**
|
|
290 |
* Returns background texture if it's set.
|
|
291 |
*
|
|
292 |
* @param aTexture Out parameter. Contains pointer to a texture.
|
|
293 |
*
|
|
294 |
* @return ETrue if background texture is set, EFalse otherwise.
|
|
295 |
*/
|
|
296 |
virtual TBool GetBackgroundTexture( const CAlfTexture*& aTexture ) = 0;
|
|
297 |
|
|
298 |
/**
|
|
299 |
* Clears item background.
|
|
300 |
*/
|
|
301 |
virtual void ClearBackground( ) = 0;
|
|
302 |
|
|
303 |
/**
|
|
304 |
* Sets main text style for an item.
|
|
305 |
*
|
|
306 |
* @param aTextStyleId Text style to be set.
|
|
307 |
*/
|
|
308 |
virtual void SetTextStyleId( const TInt aTextStyleId ) = 0;
|
|
309 |
|
|
310 |
/**
|
|
311 |
* Returns the style of item's main text.
|
|
312 |
*/
|
|
313 |
virtual TInt TextStyleId() const = 0;
|
|
314 |
|
|
315 |
/**
|
|
316 |
* Sets text style alignment.
|
|
317 |
* For AH layout EHuiAlignHLeft is internally converted to EHuiAlignHRight
|
|
318 |
* and EHuiAlignHRight is converted to EHuiAlignHLeft.
|
|
319 |
*
|
|
320 |
* EAlfAlignHLocale (default setting) - alignment set according to text directionality
|
|
321 |
*
|
|
322 |
* @param aAlignment Text alignment to be set.
|
|
323 |
*/
|
|
324 |
virtual void SetTextAlign(const TAlfAlignHorizontal aAlignment) = 0;
|
|
325 |
|
|
326 |
/**
|
|
327 |
* The function sets item's text color for the focused state.
|
|
328 |
*
|
|
329 |
* @param aColor New color to be set.
|
|
330 |
*/
|
|
331 |
virtual void SetFocusedStateTextColor( const TRgb& aColor ) = 0;
|
|
332 |
|
|
333 |
/**
|
|
334 |
* The function returns item's text color for the focused state.
|
|
335 |
*/
|
|
336 |
virtual TRgb FocusedStateTextColor() const = 0;
|
|
337 |
|
|
338 |
/**
|
|
339 |
* The function sets item's text color for the normal (unfocused) state.
|
|
340 |
*
|
|
341 |
* @param aColor New color to be set.
|
|
342 |
*/
|
|
343 |
virtual void SetNormalStateTextColor( const TRgb& aColor ) = 0;
|
|
344 |
|
|
345 |
/**
|
|
346 |
* The function returns item's text color for the normal (unfocused) state
|
|
347 |
*/
|
|
348 |
virtual TRgb NormalStateTextColor() const = 0;
|
|
349 |
|
|
350 |
/**
|
|
351 |
* Method to set text font height in twips.
|
|
352 |
*
|
|
353 |
* @param aHeightInTwips Text font height to be set.
|
|
354 |
*/
|
|
355 |
virtual void SetFontHeight(const TInt aHeightInTwips) = 0;
|
|
356 |
|
|
357 |
/**
|
|
358 |
* Gets height of a text font in twips.
|
|
359 |
*
|
|
360 |
* @return Height of the font in twips.
|
|
361 |
*/
|
|
362 |
virtual TInt FontHeight() const = 0;
|
|
363 |
|
|
364 |
/**
|
|
365 |
* Method to set text font height in pixels.
|
|
366 |
*
|
|
367 |
* @param aHeightInPixels Text font height to be set.
|
|
368 |
*/
|
|
369 |
virtual void SetFontHeightInPixels(const TInt aHeightInPixels) = 0;
|
|
370 |
|
|
371 |
/**
|
|
372 |
* Gets height of a text font in pixels.
|
|
373 |
*
|
|
374 |
* @return Height of the font in pixels.
|
|
375 |
*/
|
|
376 |
virtual TInt FontHeightInPixels() const = 0;
|
|
377 |
|
|
378 |
/**
|
|
379 |
* A call to this function means that the item is requested to draw itself
|
|
380 |
* within specified parent layout. Data to be visualized is passed as an
|
|
381 |
* argument.
|
|
382 |
*
|
|
383 |
* Parameter descriptions will be added when the final function prototype
|
|
384 |
* is ready.
|
|
385 |
*/
|
|
386 |
virtual void ShowL( CAlfLayout& aParentLayout,
|
|
387 |
const TUint aTimeout = 0 ) = 0;
|
|
388 |
|
|
389 |
/**
|
|
390 |
* A call to this function means that the item is requested to update its
|
|
391 |
* visual content.
|
|
392 |
*/
|
|
393 |
virtual void UpdateL( const MFsTreeItemData& aData,
|
|
394 |
TBool aFocused,
|
|
395 |
const TUint aLevel,
|
|
396 |
CAlfTexture*& aMarkIcon,
|
|
397 |
CAlfTexture*& aMenuIcon,
|
|
398 |
const TUint aTimeout = 0,
|
|
399 |
TBool aUpdateData = ETrue) = 0;
|
|
400 |
|
|
401 |
/**
|
|
402 |
* This method sets flag disable wrapping the text item.
|
|
403 |
*/
|
|
404 |
virtual void OffWrapping() = 0;
|
|
405 |
|
|
406 |
/**
|
|
407 |
* A call to this function means that the item goes out of the visible
|
|
408 |
* items scope.The visualizer should destroy all its visuals to save
|
|
409 |
* memory.
|
|
410 |
*/
|
|
411 |
virtual void Hide( const TInt aTimeout = 0 ) = 0;
|
|
412 |
|
|
413 |
/**
|
|
414 |
*
|
|
415 |
*/
|
|
416 |
virtual CAlfLayout& Layout() const = 0;
|
|
417 |
|
|
418 |
/**
|
|
419 |
* This method marquees the text in tree item if it is too long.
|
|
420 |
*
|
|
421 |
* @param aMarqueeType Type of marquee.
|
|
422 |
* @param aMarqueeSpeed Speed of marquee in pixels per second.
|
|
423 |
* @param aMarqueeStartDelay Marquee's start delay in miliseconds.
|
|
424 |
* @param aMarqueeCycleStartDelay Marquee cycle's start delay.
|
|
425 |
* @param aMarqueeRepetitions Number of marquee's cycles.
|
|
426 |
*/
|
|
427 |
virtual void MarqueeL( const TFsTextMarqueeType aMarqueeType,
|
|
428 |
const TUint aMarqueeSpeed,
|
|
429 |
const TInt aMarqueeStartDelay,
|
|
430 |
const TInt aMarqueeCycleStartDelay,
|
|
431 |
const TInt aMarqueeRepetitions
|
|
432 |
) = 0;
|
|
433 |
|
|
434 |
/**
|
|
435 |
* Sets menu for item
|
|
436 |
* @param aMenu CTreeList object containing menu items
|
|
437 |
*/
|
|
438 |
virtual void SetMenu( CFsTreeList* aMenu ) = 0;
|
|
439 |
|
|
440 |
/**
|
|
441 |
* Returns CFsTreeList object contaning menu items
|
|
442 |
* @return Menu for item.
|
|
443 |
*/
|
|
444 |
virtual CFsTreeList* Menu() const = 0;
|
|
445 |
|
|
446 |
/**
|
|
447 |
* This functions sets wether an item should always be in extended state.
|
|
448 |
*
|
|
449 |
* @param ETrue if item should always be in extended state.
|
|
450 |
*/
|
|
451 |
virtual void SetAlwaysExtended( TBool aAlwaysExtended ) = 0;
|
|
452 |
|
|
453 |
/**
|
|
454 |
* This function returns wether an item is always in extended state.
|
|
455 |
*
|
|
456 |
* @return ETrue if item is always in extended state.
|
|
457 |
*/
|
|
458 |
virtual TBool IsAlwaysExtended( ) const = 0;
|
|
459 |
|
|
460 |
/**
|
|
461 |
* Sets the text style manager for the item visualizer.
|
|
462 |
*
|
|
463 |
* @param aManager Reference to the text style manager.
|
|
464 |
*/
|
|
465 |
virtual void SetTextStyleManager( CFsAlfTextStyleManager& aManager ) = 0;
|
|
466 |
|
|
467 |
/**
|
|
468 |
* Sets the text stroke weight for the item visualizer.
|
|
469 |
*
|
|
470 |
* @param aIsBold ETrue if the text shoul be bold.
|
|
471 |
*/
|
|
472 |
virtual void SetTextBold( const TBool aIsBold ) = 0;
|
|
473 |
|
|
474 |
/**
|
|
475 |
* Gets the text stroke weight for the item visualizer.
|
|
476 |
*
|
|
477 |
* @return ETrue if the text is be bold.
|
|
478 |
*/
|
|
479 |
virtual TBool IsTextBold( ) const = 0;
|
|
480 |
|
|
481 |
};
|
|
482 |
|
|
483 |
|
|
484 |
#endif // M_FSTREEITEMVISUALIZER_H
|