|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * Version : 2 << Don't touch! Updated by Synergy at check-out. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef MMSUBCELLSSETUPCODE_H |
|
20 #define MMSUBCELLSSETUPCODE_H |
|
21 |
|
22 #include <e32def.h> |
|
23 |
|
24 const TInt KNumberOfBitsToStoreSubcellType = 3; |
|
25 const TInt KNumberOfBitsToStoreTemplateId = 8; |
|
26 const TInt KNumberOfBitsToStoreIsCurrentInfo = 1; |
|
27 |
|
28 /** |
|
29 * The purpose of this class is to provide a very fast way |
|
30 * of determining whether two particular ways of setting up |
|
31 * subcells are compatible (compatible == the same). |
|
32 * |
|
33 * It is important that the methods of this class are used |
|
34 * in a fixed order: |
|
35 * 1. (Optional) Clear() - only needed if this object was |
|
36 * used before. |
|
37 * 2. AddSubcellInfo() - for every subcell being set up |
|
38 * and in the same order. |
|
39 * 3. AddTemplateInfo |
|
40 * 4. AddIsCurrentInfo |
|
41 * It is currently possible to store information about up to 21 |
|
42 * subcells (type of iCode is TUint64 and single subcell info |
|
43 * takes 3 bits). It can be easily proven that CMmListBoxItemDrawer |
|
44 * will never try to store more than |
|
45 * (2 * MmTemplateContants::KSubCellsCount) subcell infos |
|
46 * (2 * 6 = 12; 12 <= 21, so everything is fine). |
|
47 * Default assignment operator and copy constructor are ok |
|
48 * for this class. |
|
49 */ |
|
50 NONSHARABLE_CLASS( TMmSubcellsSetupCode ) |
|
51 { |
|
52 public: |
|
53 /** |
|
54 * Values of this enum must be low enough to be stored in |
|
55 * just KNumberOfBitsToStoreSubcellType bits (currently the |
|
56 * maximum value allowed is 7). |
|
57 */ |
|
58 enum TSubcellType |
|
59 { |
|
60 ENoSubcell = 0, |
|
61 EGraphicsSubcell = 1, |
|
62 ETextSubcell = 2, |
|
63 EBackdropSubcell = 3, |
|
64 ESkippedSubcell = 4 |
|
65 }; |
|
66 public: |
|
67 /** |
|
68 * Standard C++ constructor. |
|
69 */ |
|
70 inline TMmSubcellsSetupCode(); |
|
71 /** |
|
72 * Adds the information about what type of subcell was just |
|
73 * set up. |
|
74 * @param aSubcellType Subcell type (any value defined in the |
|
75 * TSubcellType enum). |
|
76 */ |
|
77 inline void AddSubcellInfo( TSubcellType aSubcellType ); |
|
78 /** |
|
79 * Adds information about the template used. |
|
80 * |
|
81 * @param aTemplateIdentifier Template idetifier obtained from |
|
82 * CMmItemsDataCache::GetTemplateIdentifierL(). |
|
83 */ |
|
84 inline void AddTemplateInfo( TInt aTemplateIdentifier ); |
|
85 /** |
|
86 * Adds information whether subcells setup was made for a |
|
87 * highlighted item. |
|
88 */ |
|
89 inline void AddIsCurrentInfo( TBool aIsCurrent ); |
|
90 /** |
|
91 * Clears all the information stored in this object so that |
|
92 * it can be-reused. |
|
93 */ |
|
94 inline void Clear(); |
|
95 /** |
|
96 * Comparison operator ==. |
|
97 * @param aOther object to compare with this object. |
|
98 * @return ETrue if objects equal. |
|
99 */ |
|
100 inline TBool operator==( const TMmSubcellsSetupCode aOther ) const; |
|
101 /** |
|
102 * Comparison operator !=. |
|
103 * @param aOther object to compare with this object. |
|
104 * @return ETrue if objects differ. |
|
105 */ |
|
106 inline TBool operator!=( const TMmSubcellsSetupCode aOther ) const; |
|
107 |
|
108 protected: // data |
|
109 /** |
|
110 * The subcells setup code. |
|
111 */ |
|
112 TUint64 iCode; |
|
113 }; |
|
114 |
|
115 #include "mmsubcellssetupcode.inl" |
|
116 |
|
117 #endif // MMSUBCELLSSETUPCODE_H |