epoc32/include/app/pbkiconinfo.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 "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: 
    15 *           Phonebook icon info class definition.
    16 *
    17 */
    18 
    19 
    20 #ifndef __PbkIconInfo_H__
    21 #define __PbkIconInfo_H__
    22 
    23 //  INCLUDES
    24 #include <e32base.h>        // CBase
    25 #include <PbkIconId.hrh>    // TPbkIconId
    26 #include <AknsItemID.h>     // TAknsItemID
    27 
    28 // FORWARD DECLARATIONS
    29 class TResourceReader;
    30 class CCoeEnv;
    31 class CGulIcon;
    32 class CPbkIconInfoContainer;
    33 class MAknsSkinInstance;
    34 
    35 // CLASS DECLARATION
    36 
    37 /**
    38  * Phonebook icon information encapsulating class.
    39  * @see CPbkIconInfoContainer
    40  * @deprecated
    41  */
    42 class TPbkIconInfo
    43     {
    44     public: // interface
    45         /**
    46          * Returns the unique Phonebook icon id of this icon.
    47          * @return The unique Phonebook icon id of this icon.
    48          */
    49         IMPORT_C TPbkIconId PbkIconInfoId() const;
    50 
    51         /**
    52          * Returns the bitmap file name of this icon.
    53          * @return The bitmap file name of this icon.
    54          */
    55         IMPORT_C const TDesC& MbmFileName() const;
    56 
    57         /**
    58          * Returns this icon's id in the bitmap file.
    59          * @return This icon's id in the bitmap file.
    60          */
    61         IMPORT_C TInt IconId() const;
    62 
    63         /**
    64          * Returns this icon's mask id in the bitmap file.
    65          * @return This icon's mask id in the bitmap file.
    66          */
    67         IMPORT_C TInt MaskId() const;
    68 
    69         /**
    70          * Returns this icon's skin id.
    71          * @return This icon's skin id.
    72          */
    73         IMPORT_C TAknsItemID SkinId() const;
    74 
    75         /**
    76          * Returns this icon's color table id.
    77          * @return This icon's color table id.
    78          */
    79         TAknsItemID ColorId() const;
    80 
    81         /**
    82          * Returns this icon's index in the color table.
    83          * @return This icon's index in the color table.
    84          */
    85         TInt ColorIndex() const;
    86 
    87         /**
    88          * Returns this icon's index in the color table.
    89          * @return This icon's index in the color table.
    90          */
    91         TInt DefaultColorIndex() const;
    92 
    93     private:  // Interface for CPbkIconInfoContainer
    94         friend class CPbkIconInfoContainer;
    95         TPbkIconInfo();
    96         ~TPbkIconInfo();
    97         void ReadFromResourceLC(TResourceReader& aReader);
    98         void Destroy();
    99 
   100     private:  // Unimplemented functions
   101         /// Private, unimplemented copy constructor
   102         TPbkIconInfo(const TPbkIconInfo&);
   103         /// Private, unimplemented assignment operator
   104         TPbkIconInfo& operator=(const TPbkIconInfo&);
   105 
   106     private: // data members
   107         // Own: unique phonebook icon id
   108         TPbkIconId iPbkIconInfoId;
   109         // Own: Icon bitmap
   110         TInt iIconId;
   111         // Own: mask bitmap
   112         TInt iMaskId;
   113         // Ref: Mbm file name
   114         HBufC* iMbmFileName;
   115         /// Own: SkinId
   116         TAknsItemID iSkinId;        
   117         /// Own: ColorId
   118         TAknsItemID iColorId;
   119         /// Own: Color index
   120         TInt iColorIndex;
   121         /// Own: Default color index
   122         TInt iDefaultColorIndex;
   123     };
   124 
   125 
   126 /**
   127  * Collection of phonebook icon info objects.
   128  * @see TPbkIconInfo
   129  * @deprecated
   130  */
   131 class CPbkIconInfoContainer : public CBase
   132     {
   133     public: // Constructors and destructor
   134         /**
   135          * Creates a new instance of this class intialized with Phonebook 
   136          * default icon info from PbkView.rsc. Note that PbkView.rsc has to
   137          * be loaded, see RPbkViewResourceFile.
   138          *
   139          * @param aCoeEnv   Optional CCoeEnv instance. This function performs
   140          *                  faster if this parameter is provided.
   141          * @return A new instance of this class.
   142          */
   143         IMPORT_C static CPbkIconInfoContainer* NewL(CCoeEnv* aCoeEnv=NULL);
   144         
   145         /**
   146          * Creates a new instance of this class.
   147          *
   148          * @param aReader   Resource reader initialized to point to an array
   149          *                  of PBK_ICON_INFO resources.
   150          * @return A new instance of this class.
   151          */
   152         IMPORT_C static CPbkIconInfoContainer* NewL(TResourceReader& aReader);
   153 
   154         /**
   155          * Creates a new instance of this class.
   156          *
   157          * @param aResourceId Resource id of an array of PBK_ICON_INFO 
   158          *                  resources. Phonebook default icon info 
   159          *                  array's resource id is R_PBK_ICON_INFO_ARRAY
   160          *                  in PbkView.rsc.
   161          * @param aCoeEnv   Optional CCoeEnv instance. This function performs
   162          *                  faster if this parameter is provided.
   163          * @return A new instance of this class.
   164          */
   165         IMPORT_C static CPbkIconInfoContainer* NewL
   166             (TInt aResourceId, CCoeEnv* aCoeEnv=NULL);
   167         
   168         /**
   169          * Destructor.
   170          */
   171         ~CPbkIconInfoContainer();
   172 
   173     public:  // Interface
   174         /**
   175          * Finds a particular TPbkIconInfo in the container.
   176          *
   177          * @param aIconId   Id of the icon info to search.
   178          * @return Matching icon info or NULL if not found.
   179          */
   180         IMPORT_C const TPbkIconInfo* Find(TPbkIconId aIconId) const;
   181 
   182         /**
   183          * Creates and returns a CGulIcon object corresponding to the aIconId. 
   184          * ownership of the returned object is transferred to the client. Returns
   185          * NULL if icon id is not in the array.
   186          *
   187          * @param aIconId   Phonebook icon id.
   188          * @return Icon object corresponding to the icon id. NULL if not found.
   189          */
   190         IMPORT_C CGulIcon* LoadBitmapL(TPbkIconId aIconId) const;
   191 
   192         /**
   193          * Appends new icon info elements from aResourceId. The resource must
   194          * be of PBK_ICON_INFO type.
   195          *
   196          * @param aResourceId Resource id for icon infos to be added. 
   197          */
   198         IMPORT_C void AppendIconsFromResourceL(TInt aResourceId);
   199 
   200     private: // Implementation
   201         CPbkIconInfoContainer();
   202         void ConstructL(TResourceReader& aReader);
   203         void DoAppendIconsFromResourceL(TResourceReader& aReader);
   204 
   205     private: // data members
   206         /// Own: array of icon infos
   207         RArray<TPbkIconInfo> iIconArray;
   208     };
   209 
   210 /**
   211  * Phonebook icon utilility class. This class is a helper class
   212  * for loading skinned bitmaps.
   213  */
   214 class PbkIconUtils
   215     {
   216     public:
   217         /**
   218          * Creates a skinned icon from the aIconInfo information.
   219          * @param aSkin Pointer to a skin instance.
   220          * @param aBitmap   Bitmap to set.
   221          * @param aMask Mask to set.
   222          * @param aIconInfo Bitmap and mask information.
   223          */
   224         IMPORT_C static void CreateIconL(
   225                 MAknsSkinInstance* aSkin, 
   226                 CFbsBitmap*& aBitmap, 
   227                 CFbsBitmap*& aMask, 
   228                 const TPbkIconInfo& aIconInfo);
   229 
   230         /**
   231          * Creates a skinned icon from the aIconInfo information.
   232          * @param aSkin Pointer to a skin instance.
   233          * @param aBitmap   Bitmap to set.
   234          * @param aMask Mask to set.
   235          * @param aIconInfo Bitmap and mask information.
   236          */
   237         IMPORT_C static void CreateIconLC(
   238                 MAknsSkinInstance* aSkin, 
   239                 CFbsBitmap*& aBitmap, 
   240                 CFbsBitmap*& aMask, 
   241                 const TPbkIconInfo& aIconInfo);
   242     private:
   243         PbkIconUtils();
   244         ~PbkIconUtils();
   245     };
   246 
   247 
   248 #endif // __PbkIconInfo_H__
   249 
   250 // End of File