|
1 /* |
|
2 * Copyright (c) 2008-2009 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: List utilities |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <glxtracer.h> //For logging |
|
21 #include <featmgr.h> |
|
22 #include <bldvariant.hrh> // For feature constants |
|
23 |
|
24 #include "glxlistutils.h" |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // NormalizedIndex |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 TInt GlxListUtils::NormalizedIndex( TInt aIndex, TInt aListLength ) |
|
31 { |
|
32 TRACER("GlxListUtils::NormalizedIndex"); |
|
33 |
|
34 if ( 0 == aListLength ) |
|
35 { |
|
36 return KErrNotFound; |
|
37 } |
|
38 |
|
39 TInt index = aIndex % aListLength; |
|
40 if( index < 0 ) |
|
41 { |
|
42 // sign for modulo is the same as left side |
|
43 // so need to add aListLength |
|
44 index += aListLength; |
|
45 } |
|
46 |
|
47 return index; |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // VisibleItemsGranularityL |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 TInt GlxListUtils::VisibleItemsGranularityL() |
|
55 { |
|
56 TRACER("GlxListUtils::DefaultVisibleItemsGranularityL"); |
|
57 |
|
58 //TBD: In MCL 9.1/Corolla env currently the feature flags |
|
59 //KFeatureIdLayout640_480 and KFeatureIdLayout480_640 are not defined |
|
60 //so making the default granularity as 21 instead of 15. |
|
61 //Need to replace with KGlxDefaultVisibleItemsGranularity after |
|
62 //getting the feature flag. |
|
63 TInt ret = KGlxVGAVisibleItemsGranularity; |
|
64 FeatureManager::InitializeLibL(); |
|
65 |
|
66 if (FeatureManager::FeatureSupported( KFeatureIdLayout640_360_Touch ) || |
|
67 FeatureManager::FeatureSupported( KFeatureIdLayout360_640_Touch )) |
|
68 { |
|
69 ret = KGlxQHDVisibleItemsGranularity; |
|
70 } |
|
71 else if(FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch) || |
|
72 FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch) || |
|
73 FeatureManager::FeatureSupported(KFeatureIdLayout640_480) || |
|
74 FeatureManager::FeatureSupported(KFeatureIdLayout480_640)) |
|
75 { |
|
76 ret = KGlxVGAVisibleItemsGranularity; |
|
77 } |
|
78 FeatureManager::UnInitializeLib(); |
|
79 return ret; |
|
80 } |