83
|
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: highlight control class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "mmlctutils.h"
|
|
20 |
#include "mmtemplatelibrary.h"
|
|
21 |
#include "mmwidgetsconstants.h"
|
|
22 |
#include <aknlayoutscalable_uiaccel.cdl.h>
|
|
23 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
24 |
#include <AknUtils.h>
|
|
25 |
#include <AknFontId.h>
|
|
26 |
#include <AknLayoutFont.h>
|
|
27 |
#include <AknDef.hrh>
|
|
28 |
|
|
29 |
|
|
30 |
// ---------------------------------------------------------------------------
|
|
31 |
//
|
|
32 |
// ---------------------------------------------------------------------------
|
|
33 |
//
|
|
34 |
TAknWindowComponentLayout MmLCTUtils::ItemLayout( const TDesC8& aLayout, TInt aVariety )
|
|
35 |
{
|
|
36 |
if ( !aLayout.Compare(KListSingleLargeGraphicPane8))
|
|
37 |
{
|
|
38 |
return AknLayoutScalable_Avkon::list_single_large_graphic_pane(0, 0, 0);
|
|
39 |
}
|
|
40 |
else if ( !aLayout.Compare(KUiaccelAalistDoubleGraphicPane8))
|
|
41 |
{
|
|
42 |
return AknLayoutScalable_UiAccel::aalist_double_graphic_pane(aVariety);
|
|
43 |
}
|
|
44 |
else if ( !aLayout.Compare(KUiaccelAalistDoublePane8))
|
|
45 |
{
|
|
46 |
return AknLayoutScalable_UiAccel::aalist_double_pane(aVariety);
|
|
47 |
}
|
|
48 |
else if ( !aLayout.Compare(KUiaccelAalistSinglePane8))
|
|
49 |
{
|
|
50 |
return AknLayoutScalable_UiAccel::aalist_single_pane(aVariety);
|
|
51 |
}
|
|
52 |
else if ( !aLayout.Compare(KUiaccelAalistGeneAdPane8))
|
|
53 |
{
|
|
54 |
return AknLayoutScalable_UiAccel::aalist_gene_ad_pane(aVariety);
|
|
55 |
}
|
|
56 |
else if ( !aLayout.Compare(KUiaccelAagridCellImagePane8))
|
|
57 |
{
|
|
58 |
return AknLayoutScalable_UiAccel::aagrid_cell_image_pane(aVariety, 0, 0);
|
|
59 |
}
|
|
60 |
else if ( !aLayout.Compare(KCellHcAppsPane8))
|
|
61 |
{
|
|
62 |
return AknLayoutScalable_Avkon::cell_hc_apps_pane( aVariety, 0, 0);
|
|
63 |
}
|
|
64 |
else if ( !aLayout.Compare(KCellAppPane8))
|
|
65 |
{
|
|
66 |
return AknLayoutScalable_Avkon::cell_app_pane( aVariety, 0, 0 );
|
|
67 |
}
|
|
68 |
else if ( !aLayout.Compare(KListSingleHcAppsPane8))
|
|
69 |
{
|
|
70 |
return AknLayoutScalable_Avkon::list_single_hc_apps_pane( 0, aVariety );
|
|
71 |
}
|
|
72 |
else
|
|
73 |
{
|
|
74 |
User::Panic(KMLID, -1);
|
|
75 |
}
|
|
76 |
return TAknWindowComponentLayout();
|
|
77 |
}
|
|
78 |
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
// ---------------------------------------------------------------------------
|
|
82 |
//
|
|
83 |
TAknTextComponentLayout MmLCTUtils::TextLayout( const TDesC8& aLayout, TInt aVariety )
|
|
84 |
{
|
|
85 |
if ( aLayout.Compare(KUiaccelAalistSinglePaneT18) == 0 )
|
|
86 |
{
|
|
87 |
return AknLayoutScalable_UiAccel::aalist_single_pane_t1(aVariety);
|
|
88 |
}
|
|
89 |
else if ( aLayout.Compare(KUiaccelAalistDoubleGraphicPaneT18) == 0 )
|
|
90 |
{
|
|
91 |
return AknLayoutScalable_UiAccel::aalist_double_graphic_pane_t1(aVariety);
|
|
92 |
}
|
|
93 |
else if ( aLayout.Compare(KUiaccelAalistDoubleGraphicPaneT28) == 0 )
|
|
94 |
{
|
|
95 |
return AknLayoutScalable_UiAccel::aalist_double_graphic_pane_t2(aVariety);
|
|
96 |
}
|
|
97 |
else if ( aLayout.Compare(KUiaccelAalistDoublePaneT18) == 0 )
|
|
98 |
{
|
|
99 |
return AknLayoutScalable_UiAccel::aalist_double_pane_t1(aVariety);
|
|
100 |
}
|
|
101 |
else if ( aLayout.Compare(KUiaccelAalistDoublePaneT28) == 0 )
|
|
102 |
{
|
|
103 |
return AknLayoutScalable_UiAccel::aalist_double_pane_t2(aVariety);
|
|
104 |
}
|
|
105 |
else if ( aLayout.Compare(KlistSingleLargeGraphicPaneT18) == 0 )
|
|
106 |
{
|
|
107 |
return AknLayoutScalable_Avkon::list_single_large_graphic_pane_t1(aVariety);
|
|
108 |
}
|
|
109 |
else if ( aLayout.Compare(KUiaccelAagridCellImagePaneT18) == 0 )
|
|
110 |
{
|
|
111 |
return AknLayoutScalable_UiAccel::aagrid_cell_image_pane_t1(aVariety);
|
|
112 |
}
|
|
113 |
else if ( !aLayout.Compare(KCellHcAppsPaneT18))
|
|
114 |
{
|
|
115 |
return AknLayoutScalable_Avkon::cell_hc_apps_pane_t1( aVariety, 0, 0);
|
|
116 |
}
|
|
117 |
else if ( !aLayout.Compare(KListSingleHcAppsPaneT18))
|
|
118 |
{
|
|
119 |
return AknLayoutScalable_Avkon::list_single_hc_apps_pane_t1( aVariety );
|
|
120 |
}
|
|
121 |
else if ( !aLayout.Compare(KCellAppsPaneT18))
|
|
122 |
{
|
|
123 |
return AknLayoutScalable_Avkon::cell_app_pane_t1( aVariety, 0, 0 );
|
|
124 |
}
|
|
125 |
else
|
|
126 |
{
|
|
127 |
User::Panic(KMLID, -1);
|
|
128 |
}
|
|
129 |
return TAknTextComponentLayout();
|
|
130 |
}
|
|
131 |
|
|
132 |
// ---------------------------------------------------------------------------
|
|
133 |
//
|
|
134 |
// ---------------------------------------------------------------------------
|
|
135 |
//
|
|
136 |
TAknWindowComponentLayout MmLCTUtils::GraphicLayout( const TDesC8& aLayout, TInt aVariety )
|
|
137 |
{
|
|
138 |
if ( aLayout.Compare(KUiaccelAalistSinglePaneG18) == 0 )
|
|
139 |
{
|
|
140 |
return AknLayoutScalable_UiAccel::aalist_single_pane_g1(aVariety);
|
|
141 |
}
|
|
142 |
else if ( aLayout.Compare(KUiaccelAalistSinglePaneG28) == 0 )
|
|
143 |
{
|
|
144 |
return AknLayoutScalable_UiAccel::aalist_single_pane_g2(aVariety);
|
|
145 |
}
|
|
146 |
else if ( aLayout.Compare(KUiaccelAalistDoubleGraphicPaneG1) == 0 )
|
|
147 |
{
|
|
148 |
return AknLayoutScalable_UiAccel::aalist_double_graphic_pane_g1(aVariety);
|
|
149 |
}
|
|
150 |
else if ( aLayout.Compare(KUiaccelAalistDoubleGraphicPaneG28) == 0 )
|
|
151 |
{
|
|
152 |
return AknLayoutScalable_UiAccel::aalist_double_graphic_pane_g2(aVariety);
|
|
153 |
}
|
|
154 |
else if ( aLayout.Compare(KUiaccelAalistDoubleGraphicPaneG38) == 0 )
|
|
155 |
{
|
|
156 |
return AknLayoutScalable_UiAccel::aalist_double_graphic_pane_g3(aVariety);
|
|
157 |
}
|
|
158 |
else if ( aLayout.Compare(KUiaccelAalistDoublePaneG18) == 0 )
|
|
159 |
{
|
|
160 |
return AknLayoutScalable_UiAccel::aalist_double_pane_g1(aVariety);
|
|
161 |
}
|
|
162 |
else if ( aLayout.Compare(KUiaccelAalistDoublePaneG28) == 0 )
|
|
163 |
{
|
|
164 |
return AknLayoutScalable_UiAccel::aalist_double_pane_g2(aVariety);
|
|
165 |
}
|
|
166 |
else if ( aLayout.Compare(KlistSingleLargeGraphicPane8) == 0 )
|
|
167 |
{
|
|
168 |
return AknLayoutScalable_Avkon::list_single_large_graphic_pane(aVariety, 0,0);
|
|
169 |
}
|
|
170 |
else if ( aLayout.Compare(KlistSingleLargeGraphicPaneG18) == 0 )
|
|
171 |
{
|
|
172 |
return AknLayoutScalable_Avkon::list_single_large_graphic_pane_g1(aVariety);
|
|
173 |
}
|
|
174 |
else if ( aLayout.Compare(KlistSingleLargeGraphicPaneG2Cp28) == 0 )
|
|
175 |
{
|
|
176 |
return AknLayoutScalable_Avkon::list_single_large_graphic_pane_g2_cp2(aVariety);
|
|
177 |
}
|
|
178 |
else if ( aLayout.Compare(KlistSingleLargeGraphicPaneG4Cp28) == 0 )
|
|
179 |
{
|
|
180 |
return AknLayoutScalable_Avkon::list_single_large_graphic_pane_g4_cp2(aVariety);
|
|
181 |
}
|
|
182 |
else if ( aLayout.Compare(KUiaccelAagridCellImagePaneG18) == 0 )
|
|
183 |
{
|
|
184 |
return AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g1(aVariety);
|
|
185 |
}
|
|
186 |
else if ( aLayout.Compare(KUiaccelAagridCellImagePaneG28) == 0 )
|
|
187 |
{
|
|
188 |
return AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g2(aVariety);
|
|
189 |
}
|
|
190 |
else if ( aLayout.Compare(KUiaccelAagridCellImagePaneG38) == 0 )
|
|
191 |
{
|
|
192 |
return AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g3(aVariety);
|
|
193 |
}
|
|
194 |
else if ( aLayout.Compare(KUiaccelAagridCellImagePaneG48) == 0 )
|
|
195 |
{
|
|
196 |
return AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g4(aVariety);
|
|
197 |
}
|
|
198 |
else if ( !aLayout.Compare(KUiaccelAagridCellImagePane8))
|
|
199 |
{
|
|
200 |
return AknLayoutScalable_UiAccel::aagrid_cell_image_pane(aVariety, 0, 0);
|
|
201 |
}
|
|
202 |
else if ( !aLayout.Compare(KUiaccelAalistDoubleGraphicPane8))
|
|
203 |
{
|
|
204 |
return AknLayoutScalable_UiAccel::aalist_double_graphic_pane(aVariety);
|
|
205 |
}
|
|
206 |
else if ( !aLayout.Compare(KUiaccelAalistDoubleGraphicPaneG68))
|
|
207 |
{
|
|
208 |
return AknLayoutScalable_UiAccel::aalist_double_graphic_pane_g6(aVariety);
|
|
209 |
}
|
|
210 |
else if ( !aLayout.Compare(KUiaccelAalistDoubleGraphicPaneG78))
|
|
211 |
{
|
|
212 |
return AknLayoutScalable_UiAccel::aalist_double_graphic_pane_g7(aVariety);
|
|
213 |
}
|
|
214 |
else if ( !aLayout.Compare(KUiaccelAalistGeneAdPaneG18))
|
|
215 |
{
|
|
216 |
return AknLayoutScalable_UiAccel::aalist_gene_ad_pane_g1(aVariety);
|
|
217 |
}
|
|
218 |
else if ( !aLayout.Compare(KUiaccelAalistGeneAdPaneG18))
|
|
219 |
{
|
|
220 |
return AknLayoutScalable_UiAccel::aalist_gene_ad_pane_g1(aVariety);
|
|
221 |
}
|
|
222 |
else if ( !aLayout.Compare( KCellHcAppsPaneG18))
|
|
223 |
{
|
|
224 |
return AknLayoutScalable_Avkon::cell_hc_apps_pane_g1( aVariety, 0, 0);
|
|
225 |
}
|
|
226 |
else if ( !aLayout.Compare( KCellHcAppsPaneG28))
|
|
227 |
{
|
|
228 |
return AknLayoutScalable_Avkon::cell_hc_apps_pane_g2( aVariety, 0, 0);
|
|
229 |
}
|
|
230 |
else if ( !aLayout.Compare( KCellHcAppsPaneG38))
|
|
231 |
{
|
|
232 |
return AknLayoutScalable_Avkon::cell_hc_apps_pane_g3( aVariety, 0, 0);
|
|
233 |
}
|
|
234 |
else if ( !aLayout.Compare( KListSingleHcAppsPaneG18))
|
|
235 |
{
|
|
236 |
return AknLayoutScalable_Avkon::list_single_hc_apps_pane_g1( aVariety );
|
|
237 |
}
|
|
238 |
else if ( !aLayout.Compare( KListSingleHcAppsPaneG28))
|
|
239 |
{
|
|
240 |
return AknLayoutScalable_Avkon::list_single_hc_apps_pane_g2( aVariety );
|
|
241 |
}
|
|
242 |
else if ( !aLayout.Compare( KCellAppsPaneG18))
|
|
243 |
{
|
|
244 |
return AknLayoutScalable_Avkon::cell_app_pane_g1( aVariety, 0, 0 );
|
|
245 |
}
|
|
246 |
else if ( !aLayout.Compare( KCellAppsPaneG28))
|
|
247 |
{
|
|
248 |
return AknLayoutScalable_Avkon::cell_app_pane_g2( aVariety, 0, 0 );
|
|
249 |
}
|
|
250 |
else
|
|
251 |
{
|
|
252 |
User::Panic(KMLID, -1);
|
|
253 |
}
|
|
254 |
return TAknWindowComponentLayout();
|
|
255 |
}
|
|
256 |
|
|
257 |
// ---------------------------------------------------------------------------
|
|
258 |
//
|
|
259 |
// ---------------------------------------------------------------------------
|
|
260 |
//
|
|
261 |
TAknLayoutScalableParameterLimits MmLCTUtils::LCTParameterLimits( const TDesC8& aLayout, TInt aVariety )
|
|
262 |
{
|
|
263 |
if ( aLayout.Compare(KCellHcAppsPane8) == 0 )
|
|
264 |
{
|
|
265 |
return AknLayoutScalable_Avkon::cell_hc_apps_pane_ParamLimits( aVariety );
|
|
266 |
}
|
|
267 |
else if ( aLayout.Compare(KCellAppPane8) == 0 )
|
|
268 |
{
|
|
269 |
return AknLayoutScalable_Avkon::cell_app_pane_ParamLimits( aVariety );
|
|
270 |
}
|
|
271 |
else
|
|
272 |
{
|
|
273 |
User::Panic(KMLID, -1);
|
|
274 |
}
|
|
275 |
return TAknLayoutScalableParameterLimits();
|
|
276 |
}
|
|
277 |
// ---------------------------------------------------------------------------
|
|
278 |
//
|
|
279 |
// ---------------------------------------------------------------------------
|
|
280 |
//
|
|
281 |
void MmLCTUtils::SetupTextSubCellTemplate( TSize aItemSize,
|
|
282 |
TTemplateChild& aSubCellTemplate )
|
|
283 |
{
|
|
284 |
TAknTextComponentLayout textLayout = TextLayout( aSubCellTemplate.iLct, aSubCellTemplate.iVariety);
|
|
285 |
TAknTextLineLayout textlineLayout = textLayout.LayoutLine();
|
|
286 |
TAknLayoutText t;
|
|
287 |
t.LayoutText( aItemSize, textlineLayout );
|
|
288 |
aSubCellTemplate.iTextAlign = AknLayoutUtils::TextAlignFromId( textlineLayout.iJ );
|
|
289 |
aSubCellTemplate.iRectAccordingToParent = t.TextRect();
|
|
290 |
aSubCellTemplate.iFontId = (TAknLogicalFontId)textlineLayout.FontId();
|
|
291 |
aSubCellTemplate.iIsImage = EFalse;
|
|
292 |
}
|
|
293 |
|
|
294 |
// ---------------------------------------------------------------------------
|
|
295 |
//
|
|
296 |
// ---------------------------------------------------------------------------
|
|
297 |
//
|
|
298 |
void MmLCTUtils::SetupGraphicSubCellTemplate( TSize aItemSize,
|
|
299 |
TTemplateChild& aSubCellTemplate )
|
|
300 |
{
|
|
301 |
TAknWindowComponentLayout graphicLayout = GraphicLayout (
|
|
302 |
aSubCellTemplate.iLct, aSubCellTemplate.iVariety);
|
|
303 |
TAknLayoutRect r;
|
|
304 |
r.LayoutRect( aItemSize, graphicLayout.LayoutLine() );
|
|
305 |
aSubCellTemplate.iTextAlign = CGraphicsContext::ECenter ;
|
|
306 |
aSubCellTemplate.iRectAccordingToParent = r.Rect();
|
|
307 |
aSubCellTemplate.iIsImage = ETrue;
|
|
308 |
aSubCellTemplate.iFontId = EAknLogicalFontSecondaryFont;
|
|
309 |
}
|
|
310 |
|
|
311 |
// ---------------------------------------------------------------------------
|
|
312 |
//
|
|
313 |
// ---------------------------------------------------------------------------
|
|
314 |
//
|
|
315 |
TSize MmLCTUtils::GetLCTSize (const TDesC8& aLCTTemplate, TInt aVariety,
|
|
316 |
const TRect aParentRect, TAknWindowLineLayout& aWindowLayout)
|
|
317 |
{
|
|
318 |
aWindowLayout = MmLCTUtils::ItemLayout( aLCTTemplate, aVariety);
|
|
319 |
TAknLayoutRect layRect;
|
|
320 |
layRect.LayoutRect(aParentRect, aWindowLayout);
|
|
321 |
return layRect.Rect().Size();
|
|
322 |
}
|
|
323 |
|
|
324 |
// ---------------------------------------------------------------------------
|
|
325 |
//
|
|
326 |
// ---------------------------------------------------------------------------
|
|
327 |
//
|
|
328 |
TSize MmLCTUtils::GetLayoutSize( const TDesC8& aLCTTemplate, TInt aVariety )
|
|
329 |
{
|
|
330 |
TInt cols(0);
|
|
331 |
TInt rows(0);
|
|
332 |
cols = MmLCTUtils::LCTParameterLimits( aLCTTemplate, aVariety ).LastColumn() + 1;
|
|
333 |
rows = MmLCTUtils::LCTParameterLimits( aLCTTemplate, aVariety ).LastRow() + 1;
|
|
334 |
return TSize( cols, rows);
|
|
335 |
}
|
|
336 |
|
|
337 |
// End of file
|