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