epoc32/include/mw/akniconarray.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 akniconarray.h
     1 /*
       
     2 * Copyright (c) 2002 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *     Icon array helper class
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef     __AKNICONARRAY_H__
       
    22 #define     __AKNICONARRAY_H__
       
    23 
       
    24 
       
    25 //  INCLUDES
       
    26 #include <e32base.h>
       
    27 
       
    28 
       
    29 //  FORWARD DECLARATIONS
       
    30 class CGulIcon;
       
    31 class TResourceReader;
       
    32 
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37  * Icon array helper class. Extends CArrayPtrFlat<CGulIcon> to make it easier
       
    38  * to load icons for a listbox. This class IS-A CArrayPtrFlat<CGulIcon>, but 
       
    39  * owns the CGulIcons it contains for leave-safety.
       
    40  */
       
    41 class CAknIconArray : public CArrayPtrFlat<CGulIcon>
       
    42     {
       
    43     public:  // Constructors and destructor
       
    44         /**
       
    45          * C++ Constructor.
       
    46          */
       
    47         IMPORT_C CAknIconArray(TInt aGranurality);
       
    48 
       
    49         /**
       
    50          * Second phase constructor: loads contents of array from resources.
       
    51          *
       
    52          * @param aResId    id of a AKN_ICON_ARRAY resource.
       
    53          */
       
    54         IMPORT_C void ConstructFromResourceL(TInt aResId);
       
    55 
       
    56         /**
       
    57          * Second phase constructor: loads contents of array from resources.
       
    58          *
       
    59          * @param aReader   resource reader pointed to a 
       
    60          *                  AKN_ICON_ARRAY resource.
       
    61          */
       
    62         IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
       
    63 
       
    64         /**
       
    65          * Destructor. Destroys all icons in the array.
       
    66          */
       
    67         IMPORT_C ~CAknIconArray();
       
    68 
       
    69     public:  // interface
       
    70         /**
       
    71          * Append icons from a resource to this array.
       
    72          *
       
    73          * @param aResId    id of a AKN_ICON_ARRAY resource.
       
    74          */
       
    75         IMPORT_C void AppendFromResourceL(TInt aResId);
       
    76 
       
    77         /**
       
    78          * Append icons from a resource to this array.
       
    79          *
       
    80          * @param aReader   resource reader pointed to a 
       
    81          *                  AKN_ICON_ARRAY resource
       
    82          */
       
    83         IMPORT_C void AppendFromResourceL(TResourceReader& aReader);
       
    84 	
       
    85 	private: // implementation 
       
    86 		/**
       
    87 		 * Search for bitmap file on all connected drives
       
    88 		 *
       
    89 		 * Read bitmap file name from resource. This may or may
       
    90 		 * not have a drive specified. If the drive has been specified,
       
    91 		 * the bitmap file is first searched in that drive.
       
    92          * Otherwise, the drive search order is from y: to a: and then z:
       
    93          * as the last drive. Therefore, ROM apps should
       
    94 		 * hard code the Z: drive in order to improve performance. 
       
    95 		 *
       
    96 		 * Security warning: third parties can replace the bitmap files
       
    97 		 * by adding another file, with the same name and path, on a 
       
    98 		 * drive which has a letter higher than the drive the existing
       
    99 		 * file is installed on (e.g. file on MMC drive overrides file
       
   100 		 * on C: drive). This can be prevented by hard-coding the drive
       
   101 		 * letter. 
       
   102 		 *
       
   103 		 * Leave with KErrNotFound if the file specified is not found on
       
   104 		 * any connected drive
       
   105 		 *
       
   106 		 * @param aReader   resource reader pointed to a 
       
   107          *                  AKN_ICON_ARRAY resource
       
   108 		 *
       
   109 		 * @return			The bitmap file name
       
   110 		 */
       
   111 		 HBufC* GetBmpNameLC(TResourceReader& aReader);
       
   112 
       
   113     };
       
   114 
       
   115 
       
   116 #endif  // __AKNICONARRAY_H__
       
   117             
       
   118 
       
   119 // End of File
       
   120