menufw/menufwui/mmwidgets/inc/mmsubcellssetupcode.h
changeset 0 f72a12da539e
child 4 4d54b72983ae
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     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 was assumed that there would never be more than 6
       
    42  * MmTemplateContants::KSubCellsCount subcells. If that
       
    43  * should ever change, consider changing the type of iCode
       
    44  * member to TUint64.
       
    45  * Default assignment operator and copy constructor are ok
       
    46  * for this class.
       
    47  */
       
    48 NONSHARABLE_CLASS( TMmSubcellsSetupCode )
       
    49     {
       
    50 public:
       
    51     /**
       
    52      * Values of this enum must be low enough to be stored in
       
    53      * just KNumberOfBitsToStoreSubcellType bits (currently the
       
    54      * maximum value allowed is 7).
       
    55      */
       
    56     enum TSubcellType
       
    57         {
       
    58         ENoSubcell = 0,
       
    59         EGraphicsSubcell = 1,
       
    60         ETextSubcell = 2,
       
    61         EBackdropSubcell = 3
       
    62         };
       
    63 public:
       
    64     /**
       
    65      * Standard C++ constructor.
       
    66      */
       
    67     inline TMmSubcellsSetupCode();
       
    68     /**
       
    69      * Adds the information about what type of subcell was just
       
    70      * set up.
       
    71      * @param aSubcellType Subcell type (any value defined in the
       
    72      *        TSubcellType enum).
       
    73      */
       
    74     inline void AddSubcellInfo( TSubcellType aSubcellType );
       
    75     /**
       
    76      * Adds information about the template used.
       
    77      * 
       
    78      * @param aTemplateIdentifier Template idetifier obtained from
       
    79      *        CMmItemsDataCache::GetTemplateIdentifierL().
       
    80      */
       
    81     inline void AddTemplateInfo( TInt aTemplateIdentifier );
       
    82     /**
       
    83      * Adds information whether subcells setup was made for a
       
    84      * highlighted item.
       
    85      */
       
    86     inline void AddIsCurrentInfo( TBool aIsCurrent );
       
    87     /**
       
    88      * Clears all the information stored in this object so that
       
    89      * it can be-reused.
       
    90      */
       
    91     inline void Clear();
       
    92     /**
       
    93      * Comparison operator ==.
       
    94      * @param aOther object to compare with this object.
       
    95      * @return ETrue if objects equal.
       
    96      */
       
    97     inline TBool operator==( const TMmSubcellsSetupCode aOther ) const;
       
    98     /**
       
    99      * Comparison operator !=.
       
   100      * @param aOther object to compare with this object.
       
   101      * @return ETrue if objects differ.
       
   102      */
       
   103     inline TBool operator!=( const TMmSubcellsSetupCode aOther ) const;
       
   104 
       
   105 protected: // data
       
   106     /**
       
   107      * The subcells setup code.
       
   108      */
       
   109     TUint32 iCode;
       
   110     };
       
   111 
       
   112 #include "mmsubcellssetupcode.inl"
       
   113 
       
   114 #endif // MMSUBCELLSSETUPCODE_H