williamr@2: /* williamr@2: * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * Icon array helper class williamr@2: * williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef __AKNICONARRAY_H__ williamr@2: #define __AKNICONARRAY_H__ williamr@2: williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class CGulIcon; williamr@2: class TResourceReader; williamr@2: williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * Icon array helper class. Extends CArrayPtrFlat to make it easier williamr@2: * to load icons for a listbox. This class IS-A CArrayPtrFlat, but williamr@2: * owns the CGulIcons it contains for leave-safety. williamr@2: */ williamr@2: class CAknIconArray : public CArrayPtrFlat williamr@2: { williamr@2: public: // Constructors and destructor williamr@2: /** williamr@2: * C++ Constructor. williamr@2: */ williamr@2: IMPORT_C CAknIconArray(TInt aGranurality); williamr@2: williamr@2: /** williamr@2: * Second phase constructor: loads contents of array from resources. williamr@2: * williamr@2: * @param aResId id of a AKN_ICON_ARRAY resource. williamr@2: */ williamr@2: IMPORT_C void ConstructFromResourceL(TInt aResId); williamr@2: williamr@2: /** williamr@2: * Second phase constructor: loads contents of array from resources. williamr@2: * williamr@2: * @param aReader resource reader pointed to a williamr@2: * AKN_ICON_ARRAY resource. williamr@2: */ williamr@2: IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); williamr@2: williamr@2: /** williamr@2: * Destructor. Destroys all icons in the array. williamr@2: */ williamr@2: IMPORT_C ~CAknIconArray(); williamr@2: williamr@2: public: // interface williamr@2: /** williamr@2: * Append icons from a resource to this array. williamr@2: * williamr@2: * @param aResId id of a AKN_ICON_ARRAY resource. williamr@2: */ williamr@2: IMPORT_C void AppendFromResourceL(TInt aResId); williamr@2: williamr@2: /** williamr@2: * Append icons from a resource to this array. williamr@2: * williamr@2: * @param aReader resource reader pointed to a williamr@2: * AKN_ICON_ARRAY resource williamr@2: */ williamr@2: IMPORT_C void AppendFromResourceL(TResourceReader& aReader); williamr@2: williamr@2: private: // implementation williamr@2: /** williamr@2: * Search for bitmap file on all connected drives williamr@2: * williamr@2: * Read bitmap file name from resource. This may or may williamr@2: * not have a drive specified. If the drive has been specified, williamr@2: * the bitmap file is first searched in that drive. williamr@2: * Otherwise, the drive search order is from y: to a: and then z: williamr@2: * as the last drive. Therefore, ROM apps should williamr@2: * hard code the Z: drive in order to improve performance. williamr@2: * williamr@2: * Security warning: third parties can replace the bitmap files williamr@2: * by adding another file, with the same name and path, on a williamr@2: * drive which has a letter higher than the drive the existing williamr@2: * file is installed on (e.g. file on MMC drive overrides file williamr@2: * on C: drive). This can be prevented by hard-coding the drive williamr@2: * letter. williamr@2: * williamr@2: * Leave with KErrNotFound if the file specified is not found on williamr@2: * any connected drive williamr@2: * williamr@2: * @param aReader resource reader pointed to a williamr@2: * AKN_ICON_ARRAY resource williamr@2: * williamr@2: * @return The bitmap file name williamr@2: */ williamr@2: HBufC* GetBmpNameLC(TResourceReader& aReader); williamr@2: williamr@2: }; williamr@2: williamr@2: williamr@2: #endif // __AKNICONARRAY_H__ williamr@2: williamr@2: williamr@2: // End of File williamr@2: