uiresources_pub/skins_api/inc/AknsItemID.h
changeset 0 05e9090e2422
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Defines the item id class used to identify the skin items.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef AKNSITEMID_H
       
    20 #define AKNSITEMID_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 
       
    26 // DATA TYPES
       
    27 
       
    28 /**
       
    29 * Type enumeration for skin items.
       
    30 *
       
    31 * @since 2.0
       
    32 */
       
    33 enum TAknsItemType
       
    34     {
       
    35     /**
       
    36     * Unknown type, used by CAknsItemDef.
       
    37     */
       
    38     EAknsITUnknown      =0,
       
    39 
       
    40     /**
       
    41     * Bitmap type, used by CAknsBitmapItemData and CAknsBitmapItemDef.
       
    42     */
       
    43     EAknsITBitmap       =1,
       
    44 
       
    45     /**
       
    46     * Masked bitmap type, used by CAknsMaskedBitmapItemData and
       
    47     * CAknsMaskedBitmapItemDef.
       
    48     */
       
    49     EAknsITMaskedBitmap =2,
       
    50 
       
    51     /**
       
    52     * Color table type, used by CAknsColorTableItemData and
       
    53     * CAknsColorTableItemDef.
       
    54     */
       
    55     EAknsITColorTable   =3,
       
    56 
       
    57     /**
       
    58     * Image table type, used by CAknsImageTableItemData and
       
    59     * CAknsImageTableItemDef.
       
    60     */
       
    61     EAknsITImageTable   =4,
       
    62 
       
    63     /**
       
    64     * Image type, used by CAknsImageItemData and CAknsImageItemDef.
       
    65     */
       
    66     EAknsITImage        =5,
       
    67 
       
    68     /**
       
    69     * Bitmap animation type, used by CAknsBmpAnimItemData and CAknsBmpAnimItemDef.
       
    70     */
       
    71     EAknsITBmpAnim      =6,
       
    72 
       
    73     /**
       
    74     * String property type, used by CAknsStringItemData.
       
    75     *
       
    76     * @since 2.6
       
    77     */
       
    78     EAknsITString       =7,
       
    79 
       
    80     /**
       
    81     * Scalable item effect queue type, used by CAknsEffectQueueItemData.
       
    82     *
       
    83     * @since 2.8
       
    84     */
       
    85     EAknsITEffectQueue  =8,
       
    86 
       
    87     /**
       
    88     * Animation type, used by CAknsAnimationItemData
       
    89     */
       
    90     EAknsITAnimation    =9
       
    91     };
       
    92 
       
    93 /**
       
    94 * Image attribute enumeration for image skin items.
       
    95 *
       
    96 * @since 2.0
       
    97 */
       
    98 enum TAknsImageAttribute
       
    99     {
       
   100     /**
       
   101     * No attribute defined.
       
   102     * @since 2.0
       
   103     */
       
   104     EAknsImageAttributeNone     =0x00,
       
   105 
       
   106     /**
       
   107     * Image should be placed acording to the given coordinates.
       
   108     * Currently unsupported.
       
   109     * @since 2.0
       
   110     */
       
   111     EAknsImageAttributeCoords   =0x01,
       
   112 
       
   113     /**
       
   114     * Image size should stretched to the given size.
       
   115     * Currently used only with application icons as a search shortcut.
       
   116     * @since 2.0
       
   117     */
       
   118     EAknsImageAttributeSize     =0x02,
       
   119 
       
   120     /**
       
   121     * Image should be stretched to cover the entire layout area.
       
   122     * Aspect ratio is not preserved.
       
   123     * @since 2.0
       
   124     */
       
   125     EAknsImageAttributeStretch  =0x04,
       
   126 
       
   127     /**
       
   128     * Image should be tiled (in both directions) to fill the area.
       
   129     * @since 2.0
       
   130     */
       
   131     EAknsImageAttributeTile     =0x08,
       
   132 
       
   133     /**
       
   134     * Image should be aligned according to the given parameter.
       
   135     * @since 2.0
       
   136     */
       
   137     EAknsImageAttributeAlign    =0x10,
       
   138 
       
   139     /**
       
   140     * Image should be scaled to fill the area maintaining the aspect
       
   141     * ratio.
       
   142     * Currently unsupported.
       
   143     * @since 2.0
       
   144     */
       
   145     EAknsImageAttributeScale    =0x20,
       
   146 
       
   147     /**
       
   148     * Image should be tiled in X-axis direction to fill the area.
       
   149     * @since 2.8
       
   150     */
       
   151     EAknsImageAttributeTileX    =0x40,
       
   152 
       
   153     /**
       
   154     * Image should be tiled in Y-axis direction to fill the area.
       
   155     * @since 2.8
       
   156     */
       
   157     EAknsImageAttributeTileY    =0x80,
       
   158 
       
   159     /**
       
   160     * The item is already scalability-aware and backward compatibility
       
   161     * should not be applied to it.
       
   162     * @internal
       
   163     * @since 2.8
       
   164     */
       
   165     EAknsImageAttributeNBC     =0x100
       
   166     };
       
   167 
       
   168 /**
       
   169 * Image alignment enumeration for image skin items.
       
   170 *
       
   171 * @since 2.0
       
   172 */
       
   173 enum TAknsImageAlignment
       
   174     {
       
   175     EAknsImageAlignNone     =0x00,
       
   176     EAknsImageAlignVTop     =0x01,
       
   177     EAknsImageAlignVBottom  =0x02,
       
   178     EAknsImageAlignVCenter  =0x04,
       
   179     EAknsImageAlignHLeft    =0x08,
       
   180     EAknsImageAlignHRight   =0x10,
       
   181     EAknsImageAlignHCenter  =0x20,
       
   182     EAknsImageAlignTL       =EAknsImageAlignVTop|EAknsImageAlignHLeft,
       
   183     EAknsImageAlignTR       =EAknsImageAlignVTop|EAknsImageAlignHRight,
       
   184     EAknsImageAlignTC       =EAknsImageAlignVTop|EAknsImageAlignHCenter,
       
   185     EAknsImageAlignBL       =EAknsImageAlignVBottom|EAknsImageAlignHLeft,
       
   186     EAknsImageAlignBR       =EAknsImageAlignVBottom|EAknsImageAlignHRight,
       
   187     EAknsImageAlignBC       =EAknsImageAlignVBottom|EAknsImageAlignHCenter,
       
   188     EAknsImageAlignCL       =EAknsImageAlignVCenter|EAknsImageAlignHLeft,
       
   189     EAknsImageAlignCR       =EAknsImageAlignVCenter|EAknsImageAlignHRight,
       
   190     EAknsImageAlignCC       =EAknsImageAlignVCenter|EAknsImageAlignHCenter,
       
   191     EAknsImageAlignVMask    =EAknsImageAlignVTop|EAknsImageAlignVBottom|
       
   192                              EAknsImageAlignVCenter,
       
   193     EAknsImageAlignHMask    =EAknsImageAlignHLeft|EAknsImageAlignHRight|
       
   194                              EAknsImageAlignHCenter
       
   195     };
       
   196 
       
   197 
       
   198 // FORWARD DECLARATIONS
       
   199 
       
   200 class CFbsBitmap;
       
   201 
       
   202 // CLASS DECLARATION
       
   203 
       
   204 /**
       
   205 * Item identifier used to identify items supplied through skin interfaces.
       
   206 * Item ID consists of two integers: major and minor parts of the ID.
       
   207 *
       
   208 * Note that only LinearOrder() member function requires linking against
       
   209 * the library, all the other methods are inlined.
       
   210 *
       
   211 * @lib AknSkinSrv.lib
       
   212 *
       
   213 * @since 2.0
       
   214 */
       
   215 class TAknsItemID
       
   216     {
       
   217     public: // New functions
       
   218 
       
   219         /**
       
   220         * Sets specified major and minor parts.
       
   221         *
       
   222         * @param aMajor Major part of the item ID.
       
   223         *
       
   224         * @param aMinor Minor part of the item ID.
       
   225         */
       
   226         inline void Set( const TInt aMajor, const TInt aMinor );
       
   227 
       
   228         /**
       
   229         * Sets specified major and minor parts
       
   230         * where major part is given as a UID.
       
   231         *
       
   232         * @param aMajor Major part of the item ID as a UID.
       
   233         *
       
   234         * @param aMinor Minor part of the item ID.
       
   235         */
       
   236         inline void Set( const TUid aMajor, const TInt aMinor );
       
   237 
       
   238         /**
       
   239         * Sets major and minor parts according to the given item ID.
       
   240         *
       
   241         * @param aID Item ID to be used to get the values.
       
   242         */
       
   243         inline void Set( const TAknsItemID& aID );
       
   244 
       
   245         /**
       
   246         * Determines the order of two TAknsItemID objects.
       
   247         * Implements an algorithm that determines the order of two item ID
       
   248         * objects.
       
   249         *
       
   250         * @param aFirst Constant reference to the first object to be compared.
       
   251         *
       
   252         * @param aSecond Constant reference to the second object to be
       
   253         *   compared.
       
   254         *
       
   255         * @return 0 if the two objects are equal, negative value if the first
       
   256         *   object is less than the second and positive value if the first
       
   257         *   object is greater than the second.
       
   258         *
       
   259         * @par Implementation details:
       
   260         * To improve binary search, current implementation first compares minor
       
   261         *   part and after that the major part of the item ID. Since most lists
       
   262         *   have several objects with equal major parts this makes the algorithm
       
   263         *   more efficient.
       
   264         */
       
   265         IMPORT_C static TInt LinearOrder(
       
   266             const TAknsItemID& aFirst, const TAknsItemID& aSecond );
       
   267 
       
   268     public: // Data
       
   269 
       
   270         TInt iMajor;    //!< Major part of the item ID as an integer.
       
   271         TInt iMinor;    //!< Minor part of the item ID as an integer.
       
   272 
       
   273     };
       
   274 
       
   275 // DATA TYPES (continued)
       
   276 
       
   277 /**
       
   278 * Simple array of item ID objects.
       
   279 */
       
   280 typedef RArray<TAknsItemID> RAknsItemIDArray;
       
   281 
       
   282 // FUNCTION PROTOTYPES
       
   283 
       
   284 /**
       
   285 * C++ equal operator.
       
   286 * Checks whether two item ID objects (i.e. their major and minor parts)
       
   287 * have identical content.
       
   288 *
       
   289 * @param aFirst First object to be compared.
       
   290 *
       
   291 * @param aSecond Second object to be compared.
       
   292 *
       
   293 * @return true if objects have identical content, false otherwise.
       
   294 */
       
   295 inline TBool operator==( const TAknsItemID& aFirst, const TAknsItemID& aSecond );
       
   296 
       
   297 /**
       
   298 * C++ not equal operator.
       
   299 * Checks whether two item ID objects (i.e. their major and minor parts)
       
   300 * have identical content.
       
   301 *
       
   302 * @param aFirst First object to be compared.
       
   303 *
       
   304 * @param aSecond Second object to be compared.
       
   305 *
       
   306 * @return false if objects have identical content, true otherwise.
       
   307 */
       
   308 inline TBool operator!=( const TAknsItemID& aFirst, const TAknsItemID& aSecond );
       
   309 
       
   310 // INLINED MEMBERS
       
   311 
       
   312 #include "AknsItemID.inl"
       
   313 
       
   314 #endif // AKNSITEMID_H
       
   315 
       
   316 // End of File