landmarksui/uicontrols/inc/CLmkSelectorIconMgr.h
branchRCL_3
changeset 18 870918037e16
parent 0 522cd55cc3d7
equal deleted inserted replaced
17:1fc85118c3ae 18:870918037e16
       
     1 /*
       
     2 * Copyright (c) 2004 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:    LandmarksUi Content File -    CLmkSelectorIconMgr class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef CLMKSELECTORICONMGR_H
       
    26 #define CLMKSELECTORICONMGR_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include "MLmkSelectorIconMgr.h"
       
    30 #include <e32base.h>
       
    31 #include <AknsItemID.h>
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CGulIcon;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 * CLmkSelectorIconMgr class
       
    40 */
       
    41 class CLmkSelectorIconMgr : public CBase, public MLmkSelectorIconMgr
       
    42     {
       
    43     public:  // Constructors and destructor
       
    44 
       
    45         /**
       
    46         * EPOC constructor
       
    47         * @param aArray reference to icon array
       
    48         * @return newly instantiated object
       
    49         */
       
    50         static CLmkSelectorIconMgr* NewL( CAknIconArray& aArray );
       
    51 
       
    52         /**
       
    53         * Destructor.
       
    54         */
       
    55         ~CLmkSelectorIconMgr();
       
    56 
       
    57     public: // From MLmkSelectorIconMgr
       
    58         TInt GetIconL( const TDesC& aMbmFileName, TInt aIconIdInFile );
       
    59         TInt GetDefaultIconL( TIconType aIcon );
       
    60         void SetDefaultIconL( TIconType aIcon,
       
    61                               const TDesC& aMbmFileName,
       
    62                               TInt aIconIdInFile );
       
    63         void ResetMgrL();
       
    64 
       
    65     public: // New functions
       
    66         /**
       
    67         * Some Avkon dialogs use icon at index 0 and 1 for selection
       
    68         * marking. Icon manager reserves these indexes to be manually set.
       
    69         * @param aMbmFileName icon file path
       
    70         * @param aSkinID skin id corresponding to the icon
       
    71         * @param aIconId icon id in file
       
    72         * @param aMaskId icon mask id in file
       
    73         */
       
    74         void SetIconAtIndexZeroL( const TDesC& aMbmFileName,
       
    75                                   TAknsItemID aSkinID,
       
    76                                   TInt aIconId,
       
    77                                   TInt aMaskId );
       
    78         /**
       
    79         * Some Avkon dialogs use icon at index 0 and 1 for selection
       
    80         * marking. Icon manager reserves these indexes to be manually set.
       
    81         * @param aMbmFileName icon file path
       
    82         * @param aSkinID skin id corresponding to the icon
       
    83         * @param aIconId icon id in file
       
    84         * @param aMaskId icon mask id in file
       
    85         */
       
    86         void SetIconAtIndexOneL( const TDesC& aMbmFileName,
       
    87                                  TAknsItemID aSkinID,
       
    88                                  TInt aIconId,
       
    89                                  TInt aMaskId );
       
    90 
       
    91     private: // new functions
       
    92         /**
       
    93         * Loads icon from file.
       
    94         * @param aMbmFileName icon file path
       
    95         * @param aIconId icon id in file
       
    96         * @return icon, ownership is transferred to the caller
       
    97         */
       
    98         CGulIcon* LoadIconL( const TDesC& aMbmFileName, TInt aIconId );
       
    99 
       
   100         /**
       
   101         * Loads icon from file.
       
   102         * @param aMbmFileName icon file path
       
   103         * @param aSkinID skin id corresponding to the icon
       
   104         * @param aIconId icon id in file
       
   105         * @param aMaskId icon mask id in file
       
   106         * @return icon, ownership is transferred to the caller
       
   107         */
       
   108         CGulIcon* LoadIconL( const TDesC& aMbmFileName,
       
   109                              TAknsItemID aSkinID,
       
   110                              TInt aIconId,
       
   111                              TInt aMaskId );
       
   112 
       
   113         /**
       
   114         * Loads icon from file and appends it to the icon array.
       
   115         * @param aMbmFileName icon file path
       
   116         * @param aIconIdInFile icon id in file
       
   117         * @return array index of loaded icon
       
   118         */
       
   119         TInt LoadAndAppendIconL( const TDesC& aMbmFileName,
       
   120                                  TInt aIconIdInFile );
       
   121 
       
   122         /**
       
   123         * Defines icon in icon manager. This does not load icon to icon array.
       
   124         * This can be used to define icons to mgr without loading them to
       
   125         * memory..
       
   126         * NOTE: icon mask id must be next from icon id in icon mbg file.
       
   127         * Leaves with Symbian error code if error.
       
   128         * @param aMbmFileName icon file name
       
   129         * @param aIconIdInFile id number of icon in file
       
   130         * @return aIconIndex, icon manager id.
       
   131         */
       
   132         TInt CreateIconMgrItemL( const TDesC& aMbmFileName,
       
   133                                  TInt aIconIdInFile );
       
   134 
       
   135         /**
       
   136         * Appends an icon file to an internal array if it hasn't already
       
   137         * been added. Returns index of the icon file in the array.
       
   138         * @param aMbmFileName icon file path
       
   139         * @return icon file index
       
   140         */
       
   141         TInt AppendedIconFileIndexL( const TDesC& aMbmFileName );
       
   142 
       
   143     private:  // Constructors and destructor
       
   144         /**
       
   145         * C++ default constructor.
       
   146         * @param aArray
       
   147         * @return newly instantiated object
       
   148         */
       
   149         CLmkSelectorIconMgr( CAknIconArray& aArray );
       
   150 
       
   151         /**
       
   152         * By default Symbian 2nd phase constructor is private.
       
   153         */
       
   154         void ConstructL();
       
   155 
       
   156     private: // Type definitions
       
   157         class TIconData
       
   158             {
       
   159             public:
       
   160                 TInt        iFileIndex;             // icon file
       
   161                 TInt        iIconIndexWithinFile;   // index within file
       
   162                 TIconType   iIconType;              // icon type
       
   163                 TInt        iIconArrayId;           // index in icon array
       
   164             public:
       
   165                 TIconData();
       
   166             };
       
   167 
       
   168     private:    // Data
       
   169         ///Own:
       
   170         CDesCArrayFlat* iIconFiles;
       
   171 
       
   172         ///Ref:
       
   173         CAknIconArray* iArray;
       
   174 
       
   175         RArray<TIconData> iCache;
       
   176     };
       
   177 
       
   178 #endif      // CLMKSELECTORICONMGR_H
       
   179 
       
   180 // End of File