|
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 empty tree root's data. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "emailtrace.h" |
|
22 #include "fstreeplainonelineitemdata.h" |
|
23 #include "fstreeplainrootvisualizer.h" |
|
24 #include "fstextstylemanager.h" |
|
25 // <cmail> SF |
|
26 #include <alf/alfcontrol.h> |
|
27 #include <alf/alfanchorlayout.h> |
|
28 #include <alf/alftextvisual.h> |
|
29 #include <alf/alftexture.h> |
|
30 // </cmail> |
|
31 |
|
32 // ======== MEMBER FUNCTIONS ======== |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // Two-phased constructor. |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 EXPORT_C CFsTreePlainRootVisualizer* CFsTreePlainRootVisualizer::NewL( |
|
39 CAlfControl& aOwnerControl ) |
|
40 { |
|
41 FUNC_LOG; |
|
42 CFsTreePlainRootVisualizer* self = |
|
43 new( ELeave ) CFsTreePlainRootVisualizer( aOwnerControl ); |
|
44 CleanupStack::PushL( self ); |
|
45 self->ConstructL( ); |
|
46 CleanupStack::Pop( self ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // C++ destructor. |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CFsTreePlainRootVisualizer::~CFsTreePlainRootVisualizer() |
|
55 { |
|
56 FUNC_LOG; |
|
57 } |
|
58 |
|
59 // from base class MFsTreeNodeVisualizer |
|
60 |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // Returns visualizer's type. |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 TFsTreeItemVisualizerType CFsTreePlainRootVisualizer::Type() const |
|
67 { |
|
68 FUNC_LOG; |
|
69 return EFsTreePlainRootVisualizer; |
|
70 } |
|
71 |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // From class MFsTreeItemVisualizer. |
|
75 // Sets the size of the item visualization when item is not in expanded |
|
76 // state. The value is taken from layout manager. |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 void CFsTreePlainRootVisualizer::UpdateLayout( ) |
|
80 { |
|
81 FUNC_LOG; |
|
82 |
|
83 } |
|
84 |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // From class MFsTreeItemVisualizer. |
|
88 // A call to this function means that the visualization of empty root |
|
89 // becomes visible and should draw itself within specified parent layout. |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void CFsTreePlainRootVisualizer::ShowL( CAlfLayout& aParentLayout, |
|
93 const TUint /*aTimeout*/ ) |
|
94 { |
|
95 FUNC_LOG; |
|
96 |
|
97 if (!iLayout) |
|
98 { |
|
99 iParentLayout = &aParentLayout; |
|
100 iLayout = CAlfAnchorLayout::AddNewL(iOwnerControl, &aParentLayout); |
|
101 iLayout->SetSize(aParentLayout.Size().ValueNow().AsSize()); |
|
102 |
|
103 if (!iTextVisual) |
|
104 { |
|
105 iTextVisual = CAlfTextVisual::AddNewL( |
|
106 iOwnerControl, iLayout ); |
|
107 iTextVisual->SetFlag( EAlfVisualFlagIgnorePointer ); |
|
108 } |
|
109 } |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // A call to this function means that the item is requested to update its |
|
114 // visual content. |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void CFsTreePlainRootVisualizer::UpdateL( const MFsTreeItemData& aData, |
|
118 TBool /*aFocused*/, |
|
119 const TUint /*aLevel*/, |
|
120 CAlfTexture*& /*aMarkIcon*/, |
|
121 CAlfTexture*& /*aMenuIcon*/, |
|
122 const TUint /*aTimeout*/, |
|
123 TBool aUpdateData) |
|
124 { |
|
125 FUNC_LOG; |
|
126 if (aData.Type() == KFsTreePlainOneLineItemDataType) |
|
127 { |
|
128 const CFsTreePlainOneLineItemData* data = |
|
129 static_cast<const CFsTreePlainOneLineItemData*>(&aData); |
|
130 |
|
131 if ( iTextVisual && aUpdateData ) |
|
132 { |
|
133 iTextVisual->SetTextL(data->Data( )); |
|
134 iTextVisual->SetTextStyle(iTextStyleId); |
|
135 |
|
136 TAlfAlignHorizontal currTextAlign( EAlfAlignHCenter ); |
|
137 currTextAlign = CurrentTextAlignmentL( iTextAlign, &data->Data(), iTextVisual ); |
|
138 iTextVisual->SetAlign( currTextAlign, EAlfAlignVCenter ); |
|
139 |
|
140 iTextVisual->EnableShadow(iFlags & KFsTreeListItemTextShadow); |
|
141 if (!iIsCustomTextNormalColor) |
|
142 {//custom color not set, use color from skin - load it in case theme has changed |
|
143 iNormalTextColor = NormalStateTextSkinColor( ); |
|
144 } |
|
145 iTextVisual->SetColor( iNormalTextColor ); |
|
146 iTextVisual->SetWrapping(CAlfTextVisual::ELineWrapBreak); |
|
147 |
|
148 TInt styleId = ModifiedStyleIdL( ); |
|
149 iTextVisual->SetTextStyle( styleId ); |
|
150 } |
|
151 } |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------------------------- |
|
155 // From class MFsTreeItemVisualizer. |
|
156 // A call to this function means that the the empty root visualization |
|
157 // should become hidden. |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 void CFsTreePlainRootVisualizer::Hide( const TInt aTimeout ) |
|
161 { |
|
162 FUNC_LOG; |
|
163 if ( iLayout ) |
|
164 { |
|
165 iParentLayout->Remove(iLayout, aTimeout); |
|
166 iLayout->RemoveAndDestroyAllD(); |
|
167 iLayout = NULL; |
|
168 iParentLayout = NULL; |
|
169 iTextVisual = NULL; |
|
170 } |
|
171 } |
|
172 |
|
173 |
|
174 // --------------------------------------------------------------------------- |
|
175 // From MFsTreeItemVisualizer. |
|
176 // This method marquees the text in tree item if it is too long. |
|
177 // --------------------------------------------------------------------------- |
|
178 // |
|
179 void CFsTreePlainRootVisualizer::MarqueeL(const TFsTextMarqueeType /*aMarqueeType*/, |
|
180 const TUint /*aMarqueeSpeed*/, |
|
181 const TInt /*aMarqueeStartDelay*/, |
|
182 const TInt /*aMarqueeCycleStartDelay*/, |
|
183 const TInt /*aMarqueeRepetitions*/) |
|
184 { |
|
185 FUNC_LOG; |
|
186 |
|
187 } |
|
188 |
|
189 |
|
190 // --------------------------------------------------------------------------- |
|
191 // C++ constructor. |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 CFsTreePlainRootVisualizer::CFsTreePlainRootVisualizer( |
|
195 CAlfControl& aOwnerControl ) |
|
196 : CFsTreeNodeVisualizerBase( aOwnerControl ), |
|
197 iTextVisual(NULL) |
|
198 { |
|
199 FUNC_LOG; |
|
200 iTextAlign = EAlfAlignHCenter; |
|
201 } |
|
202 |
|
203 // --------------------------------------------------------------------------- |
|
204 // Second phase constructor. |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 void CFsTreePlainRootVisualizer::ConstructL( ) |
|
208 { |
|
209 FUNC_LOG; |
|
210 CFsTreeNodeVisualizerBase::ConstructL(); |
|
211 } |
|
212 |