1.1 --- a/epoc32/include/app/pbkiconinfo.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/app/pbkiconinfo.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,250 @@
1.4 -pbkiconinfo.h
1.5 +/*
1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* 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
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +* Phonebook icon info class definition.
1.20 +*
1.21 +*/
1.22 +
1.23 +
1.24 +#ifndef __PbkIconInfo_H__
1.25 +#define __PbkIconInfo_H__
1.26 +
1.27 +// INCLUDES
1.28 +#include <e32base.h> // CBase
1.29 +#include <PbkIconId.hrh> // TPbkIconId
1.30 +#include <AknsItemID.h> // TAknsItemID
1.31 +
1.32 +// FORWARD DECLARATIONS
1.33 +class TResourceReader;
1.34 +class CCoeEnv;
1.35 +class CGulIcon;
1.36 +class CPbkIconInfoContainer;
1.37 +class MAknsSkinInstance;
1.38 +
1.39 +// CLASS DECLARATION
1.40 +
1.41 +/**
1.42 + * Phonebook icon information encapsulating class.
1.43 + * @see CPbkIconInfoContainer
1.44 + * @deprecated
1.45 + */
1.46 +class TPbkIconInfo
1.47 + {
1.48 + public: // interface
1.49 + /**
1.50 + * Returns the unique Phonebook icon id of this icon.
1.51 + * @return The unique Phonebook icon id of this icon.
1.52 + */
1.53 + IMPORT_C TPbkIconId PbkIconInfoId() const;
1.54 +
1.55 + /**
1.56 + * Returns the bitmap file name of this icon.
1.57 + * @return The bitmap file name of this icon.
1.58 + */
1.59 + IMPORT_C const TDesC& MbmFileName() const;
1.60 +
1.61 + /**
1.62 + * Returns this icon's id in the bitmap file.
1.63 + * @return This icon's id in the bitmap file.
1.64 + */
1.65 + IMPORT_C TInt IconId() const;
1.66 +
1.67 + /**
1.68 + * Returns this icon's mask id in the bitmap file.
1.69 + * @return This icon's mask id in the bitmap file.
1.70 + */
1.71 + IMPORT_C TInt MaskId() const;
1.72 +
1.73 + /**
1.74 + * Returns this icon's skin id.
1.75 + * @return This icon's skin id.
1.76 + */
1.77 + IMPORT_C TAknsItemID SkinId() const;
1.78 +
1.79 + /**
1.80 + * Returns this icon's color table id.
1.81 + * @return This icon's color table id.
1.82 + */
1.83 + TAknsItemID ColorId() const;
1.84 +
1.85 + /**
1.86 + * Returns this icon's index in the color table.
1.87 + * @return This icon's index in the color table.
1.88 + */
1.89 + TInt ColorIndex() const;
1.90 +
1.91 + /**
1.92 + * Returns this icon's index in the color table.
1.93 + * @return This icon's index in the color table.
1.94 + */
1.95 + TInt DefaultColorIndex() const;
1.96 +
1.97 + private: // Interface for CPbkIconInfoContainer
1.98 + friend class CPbkIconInfoContainer;
1.99 + TPbkIconInfo();
1.100 + ~TPbkIconInfo();
1.101 + void ReadFromResourceLC(TResourceReader& aReader);
1.102 + void Destroy();
1.103 +
1.104 + private: // Unimplemented functions
1.105 + /// Private, unimplemented copy constructor
1.106 + TPbkIconInfo(const TPbkIconInfo&);
1.107 + /// Private, unimplemented assignment operator
1.108 + TPbkIconInfo& operator=(const TPbkIconInfo&);
1.109 +
1.110 + private: // data members
1.111 + // Own: unique phonebook icon id
1.112 + TPbkIconId iPbkIconInfoId;
1.113 + // Own: Icon bitmap
1.114 + TInt iIconId;
1.115 + // Own: mask bitmap
1.116 + TInt iMaskId;
1.117 + // Ref: Mbm file name
1.118 + HBufC* iMbmFileName;
1.119 + /// Own: SkinId
1.120 + TAknsItemID iSkinId;
1.121 + /// Own: ColorId
1.122 + TAknsItemID iColorId;
1.123 + /// Own: Color index
1.124 + TInt iColorIndex;
1.125 + /// Own: Default color index
1.126 + TInt iDefaultColorIndex;
1.127 + };
1.128 +
1.129 +
1.130 +/**
1.131 + * Collection of phonebook icon info objects.
1.132 + * @see TPbkIconInfo
1.133 + * @deprecated
1.134 + */
1.135 +class CPbkIconInfoContainer : public CBase
1.136 + {
1.137 + public: // Constructors and destructor
1.138 + /**
1.139 + * Creates a new instance of this class intialized with Phonebook
1.140 + * default icon info from PbkView.rsc. Note that PbkView.rsc has to
1.141 + * be loaded, see RPbkViewResourceFile.
1.142 + *
1.143 + * @param aCoeEnv Optional CCoeEnv instance. This function performs
1.144 + * faster if this parameter is provided.
1.145 + * @return A new instance of this class.
1.146 + */
1.147 + IMPORT_C static CPbkIconInfoContainer* NewL(CCoeEnv* aCoeEnv=NULL);
1.148 +
1.149 + /**
1.150 + * Creates a new instance of this class.
1.151 + *
1.152 + * @param aReader Resource reader initialized to point to an array
1.153 + * of PBK_ICON_INFO resources.
1.154 + * @return A new instance of this class.
1.155 + */
1.156 + IMPORT_C static CPbkIconInfoContainer* NewL(TResourceReader& aReader);
1.157 +
1.158 + /**
1.159 + * Creates a new instance of this class.
1.160 + *
1.161 + * @param aResourceId Resource id of an array of PBK_ICON_INFO
1.162 + * resources. Phonebook default icon info
1.163 + * array's resource id is R_PBK_ICON_INFO_ARRAY
1.164 + * in PbkView.rsc.
1.165 + * @param aCoeEnv Optional CCoeEnv instance. This function performs
1.166 + * faster if this parameter is provided.
1.167 + * @return A new instance of this class.
1.168 + */
1.169 + IMPORT_C static CPbkIconInfoContainer* NewL
1.170 + (TInt aResourceId, CCoeEnv* aCoeEnv=NULL);
1.171 +
1.172 + /**
1.173 + * Destructor.
1.174 + */
1.175 + ~CPbkIconInfoContainer();
1.176 +
1.177 + public: // Interface
1.178 + /**
1.179 + * Finds a particular TPbkIconInfo in the container.
1.180 + *
1.181 + * @param aIconId Id of the icon info to search.
1.182 + * @return Matching icon info or NULL if not found.
1.183 + */
1.184 + IMPORT_C const TPbkIconInfo* Find(TPbkIconId aIconId) const;
1.185 +
1.186 + /**
1.187 + * Creates and returns a CGulIcon object corresponding to the aIconId.
1.188 + * ownership of the returned object is transferred to the client. Returns
1.189 + * NULL if icon id is not in the array.
1.190 + *
1.191 + * @param aIconId Phonebook icon id.
1.192 + * @return Icon object corresponding to the icon id. NULL if not found.
1.193 + */
1.194 + IMPORT_C CGulIcon* LoadBitmapL(TPbkIconId aIconId) const;
1.195 +
1.196 + /**
1.197 + * Appends new icon info elements from aResourceId. The resource must
1.198 + * be of PBK_ICON_INFO type.
1.199 + *
1.200 + * @param aResourceId Resource id for icon infos to be added.
1.201 + */
1.202 + IMPORT_C void AppendIconsFromResourceL(TInt aResourceId);
1.203 +
1.204 + private: // Implementation
1.205 + CPbkIconInfoContainer();
1.206 + void ConstructL(TResourceReader& aReader);
1.207 + void DoAppendIconsFromResourceL(TResourceReader& aReader);
1.208 +
1.209 + private: // data members
1.210 + /// Own: array of icon infos
1.211 + RArray<TPbkIconInfo> iIconArray;
1.212 + };
1.213 +
1.214 +/**
1.215 + * Phonebook icon utilility class. This class is a helper class
1.216 + * for loading skinned bitmaps.
1.217 + */
1.218 +class PbkIconUtils
1.219 + {
1.220 + public:
1.221 + /**
1.222 + * Creates a skinned icon from the aIconInfo information.
1.223 + * @param aSkin Pointer to a skin instance.
1.224 + * @param aBitmap Bitmap to set.
1.225 + * @param aMask Mask to set.
1.226 + * @param aIconInfo Bitmap and mask information.
1.227 + */
1.228 + IMPORT_C static void CreateIconL(
1.229 + MAknsSkinInstance* aSkin,
1.230 + CFbsBitmap*& aBitmap,
1.231 + CFbsBitmap*& aMask,
1.232 + const TPbkIconInfo& aIconInfo);
1.233 +
1.234 + /**
1.235 + * Creates a skinned icon from the aIconInfo information.
1.236 + * @param aSkin Pointer to a skin instance.
1.237 + * @param aBitmap Bitmap to set.
1.238 + * @param aMask Mask to set.
1.239 + * @param aIconInfo Bitmap and mask information.
1.240 + */
1.241 + IMPORT_C static void CreateIconLC(
1.242 + MAknsSkinInstance* aSkin,
1.243 + CFbsBitmap*& aBitmap,
1.244 + CFbsBitmap*& aMask,
1.245 + const TPbkIconInfo& aIconInfo);
1.246 + private:
1.247 + PbkIconUtils();
1.248 + ~PbkIconUtils();
1.249 + };
1.250 +
1.251 +
1.252 +#endif // __PbkIconInfo_H__
1.253 +
1.254 +// End of File