phonebookui/Phonebook2/spbcontentprovider/inc/spbserviceiconprovider.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2009 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: Service icon manager
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef SPBSERVICEICONPROVIDER_H
       
    19 #define SPBSERVICEICONPROVIDER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 // FORWARD DECLARATION 
       
    24 class TPbk2IconId;
       
    25 class CBSFactory;
       
    26 class CSpbIconItem;
       
    27 class CGulIcon;
       
    28 
       
    29 /**
       
    30  * Service icon information 
       
    31  */
       
    32 NONSHARABLE_CLASS( MSpbServiceIcon )
       
    33     {
       
    34     public:
       
    35         /**
       
    36          * @return Brand id for this icon 
       
    37          */
       
    38         virtual const TPtrC8 BrandId() const = 0;
       
    39         
       
    40         /**
       
    41          * @return Brand icon id for this icon 
       
    42          */
       
    43         virtual const TPtrC8 BrandIconId() const = 0;
       
    44 
       
    45         /**
       
    46          * @return Unique phonebook2 icon id for the icon 
       
    47          */
       
    48         virtual const TPbk2IconId& IconId() const = 0;
       
    49         
       
    50         /**
       
    51          * @return wheter icon is valid or not. Icon can get invalid if e.g. 
       
    52          * loading fails.
       
    53          */
       
    54         virtual TBool IsValid() const = 0;
       
    55 
       
    56     protected:
       
    57         
       
    58         /// virtual destructor
       
    59         virtual ~MSpbServiceIcon() {}
       
    60     };
       
    61 
       
    62 /**
       
    63  *  Status icon manager
       
    64  *
       
    65  *  @since S60 9.2
       
    66  */
       
    67 NONSHARABLE_CLASS( CSpbServiceIconProvider ) : public CBase
       
    68     {
       
    69 public: // constructor and destructor
       
    70 
       
    71     /**
       
    72      * Constructor
       
    73      */
       
    74     static CSpbServiceIconProvider* NewL();
       
    75     
       
    76     /**
       
    77      * Destructor
       
    78      */
       
    79     ~CSpbServiceIconProvider();
       
    80 
       
    81     
       
    82 public: // Interface
       
    83     
       
    84     /**
       
    85      * Get or create a unique icon id for branded icon. Ownership is not 
       
    86      * transferred. ServiceIcon is valid until the icon manager is deleted.
       
    87      * 
       
    88      * @param aBrandId brand id for icon  
       
    89      * @param aIconId brand element id for icon
       
    90      * @return service icon  
       
    91      */
       
    92     MSpbServiceIcon* GetBrandedIconL( 
       
    93         const TDesC8& aBrandId, 
       
    94         const TDesC8& aIconId );
       
    95 
       
    96     /**
       
    97      * Create concrete icon for aIconId. Ownership transferred to caller.
       
    98      * 
       
    99      * @param aIconId icon ID
       
   100      * @return Icon bitmap
       
   101      */
       
   102     CGulIcon* CreateIconLC( const TPbk2IconId& aIconId );
       
   103     
       
   104     
       
   105 private: // constructors
       
   106 
       
   107     /**
       
   108      * Constructor
       
   109      */
       
   110     inline CSpbServiceIconProvider();
       
   111 
       
   112     /**
       
   113      * Constructor
       
   114      */
       
   115     inline void ConstructL();
       
   116 
       
   117     
       
   118 private: // data
       
   119 
       
   120     /// Own. Branding factory instance
       
   121     CBSFactory* iBrandFactory;
       
   122     
       
   123     /// Own. Array of icon details
       
   124     RPointerArray<CSpbIconItem> iIconArray;
       
   125     
       
   126     /// Index for generating unique icons
       
   127     TInt iNextFreeIconIndex;
       
   128     };
       
   129 
       
   130 #endif // SPBSERVICEICONPROVIDER_H