|
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 rich text. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_FSTREERICHITEMVISUALIZER_H |
|
21 #define C_FSTREERICHITEMVISUALIZER_H |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
26 //#include <fsconfig.h> |
|
27 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
28 |
|
29 |
|
30 #include "fstreeitemvisualizerbase.h" |
|
31 |
|
32 class CAlfControl; |
|
33 class CAlfLayout; |
|
34 class CAlfTexture; |
|
35 class CAlfFlowLayout; |
|
36 class CAlfViewportLayout; |
|
37 class CAlfTextVisual; |
|
38 class CAlfImageVisual; |
|
39 |
|
40 |
|
41 class CFsTreeRichItemData; |
|
42 class CFsTreeList; |
|
43 class CFsTextStyleManager; |
|
44 class CFsLayoutManager; |
|
45 |
|
46 /** |
|
47 * CFsTreeRichItemVisualizer is a visualizer for data items with rich text. |
|
48 * |
|
49 * Thic class is a concrete implementation for the MFsTreeItemVisualizer |
|
50 * interface. It provides visualization for data items with rich text. |
|
51 * |
|
52 * @code |
|
53 * |
|
54 * @endcode |
|
55 * |
|
56 * @lib |
|
57 */ |
|
58 NONSHARABLE_CLASS( CFsTreeRichItemVisualizer ) |
|
59 : public CFsTreeItemVisualizerBase |
|
60 { |
|
61 |
|
62 public: |
|
63 |
|
64 /** |
|
65 * Two-phased constructor |
|
66 * |
|
67 * @param aOwnerControl Owner control. |
|
68 * @param aTextStyleManager Text style manager. |
|
69 */ |
|
70 IMPORT_C static CFsTreeRichItemVisualizer* NewL( |
|
71 CAlfControl& aOwnerControl, CFsAlfTextStyleManager& aTextStyleManager ); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 virtual ~CFsTreeRichItemVisualizer(); |
|
77 |
|
78 /** |
|
79 * Returns the type of the item's visualizer. |
|
80 */ |
|
81 virtual TFsTreeItemVisualizerType Type() const; |
|
82 |
|
83 /** |
|
84 * Create a visual based on the text object. |
|
85 * |
|
86 * @param aOwnerControl Owner control. |
|
87 * @param aParentLayout Layout for the text. |
|
88 * @param aText Contains the text. |
|
89 * @param aSize Size where to fit the text. |
|
90 */ |
|
91 CAlfFlowLayout* CreateTextLineL( CAlfControl& aOwnerControl, |
|
92 CAlfLayout* aParentLayout, const CFsTreeRichItemData* aText, |
|
93 TSize aSize ); |
|
94 |
|
95 /** |
|
96 * Create a font style. |
|
97 * |
|
98 * @param charFormat Contains character format attributes. |
|
99 */ |
|
100 TInt CreateStyleL( TCharFormat& charFormat ); |
|
101 |
|
102 // from base class MFsTreeItemVisualizer |
|
103 |
|
104 /** |
|
105 * From MFsTreeItemVisualizer. |
|
106 * A call to this function means that the item is requested to draw itself |
|
107 * within specified parent layout. Data to be visualized is passed as an |
|
108 * argument. |
|
109 * |
|
110 * Parameter descriptions will be added when the final function prototype |
|
111 * is ready. |
|
112 */ |
|
113 virtual void ShowL( CAlfLayout& aParentLayout, |
|
114 const TUint aTimeout = 0 ); |
|
115 |
|
116 /** |
|
117 * From MFsTreeItemVisualizer. |
|
118 * A call to this function means that the item is requested to update its |
|
119 * visual content. |
|
120 */ |
|
121 virtual void UpdateL( const MFsTreeItemData& aData, |
|
122 TBool aFocused, |
|
123 const TUint aLevel, |
|
124 CAlfTexture*& aMarkIcon, |
|
125 CAlfTexture*& aMenuIcon, |
|
126 const TUint aTimeout = 0, |
|
127 TBool aUpdateData = ETrue); |
|
128 |
|
129 /** |
|
130 * From MFsTreeItemVisualizer. |
|
131 * A call to this function means that the item goes out of the visible |
|
132 * items scope. The visualizer should destroy all its visuals to save |
|
133 * memory. |
|
134 */ |
|
135 virtual void Hide( const TInt aTimeout = 0 ); |
|
136 |
|
137 /** |
|
138 * From MFsTreeItemVisualizer. |
|
139 * This method marquees the text in tree item if it is too long. |
|
140 * |
|
141 * @param aMarqueeType Type of marquee. |
|
142 * @param aMarqueeSpeed Speed of marquee in pixels per second. |
|
143 * @param aMarqueeStartDelay Marquee's start delay in miliseconds. |
|
144 * @param aMarqueeCycleStartDelay Marquee cycle's start delay. |
|
145 * @param aMarqueeRepetitions Number of marquee's cycles. |
|
146 */ |
|
147 virtual void MarqueeL(const TFsTextMarqueeType aMarqueeType, |
|
148 const TUint aMarqueeSpeed, |
|
149 const TInt aMarqueeStartDelay, |
|
150 const TInt aMarqueeCycleStartDelay, |
|
151 const TInt aMarqueeRepetitions); |
|
152 |
|
153 /** |
|
154 * This method sets flag disable wrapping the text item. |
|
155 */ |
|
156 virtual void OffWrapping(); |
|
157 protected: |
|
158 |
|
159 /** |
|
160 * C++ constructor |
|
161 * |
|
162 * @param aOwnerControl Owner control. |
|
163 * @param aTextStyleManager Text style manager. |
|
164 */ |
|
165 CFsTreeRichItemVisualizer( |
|
166 CAlfControl& aOwnerControl, CFsAlfTextStyleManager& aTextStyleManager ); |
|
167 |
|
168 /** |
|
169 * Second phase constructor |
|
170 * |
|
171 */ |
|
172 void ConstructL( ); |
|
173 |
|
174 private: |
|
175 |
|
176 /** |
|
177 * Updates the layout metrics using layout manager that was set by |
|
178 * tree visualizer. |
|
179 */ |
|
180 virtual void UpdateLayout( |
|
181 const CFsTreeRichItemData* aData, |
|
182 const TInt aIndentation ); |
|
183 |
|
184 private: |
|
185 |
|
186 /** |
|
187 * Layout for the richtext. |
|
188 * Own. |
|
189 */ |
|
190 CAlfFlowLayout* iTextLayout; |
|
191 |
|
192 /** |
|
193 * Viewport layouut containing text visual. Used for text marquee. |
|
194 * Own. |
|
195 */ |
|
196 CAlfViewportLayout* iViewportLayout; |
|
197 |
|
198 /** |
|
199 * Text visual. |
|
200 * Own. |
|
201 */ |
|
202 CAlfTextVisual* iTextVisual; |
|
203 |
|
204 /** |
|
205 * Visual for an icon. |
|
206 */ |
|
207 CAlfImageVisual* iIconVisual; |
|
208 |
|
209 /** |
|
210 * Visual for a mark icon. |
|
211 */ |
|
212 CAlfImageVisual* iIconMarked; |
|
213 |
|
214 /** |
|
215 * Visual for a menu icon. |
|
216 */ |
|
217 CAlfImageVisual* iIconMenu; |
|
218 |
|
219 }; |
|
220 |
|
221 |
|
222 #endif // C_FSTREERICHITEMVISUALIZER_H |