phoneuis/BubbleManager/Inc/BMResourceManager.h
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     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 *     Resource pool for CCoeControls.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CBUBBLERESOURCEMANAGER_H
       
    21 #define CBUBBLERESOURCEMANAGER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CEikImage;
       
    29 class CEikLabel;
       
    30 class CBubbleAnimationControl;
       
    31 class CCoeControl;
       
    32 class CBubbleManager;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 *  Resource pool for CCoeControls.
       
    38 *
       
    39 *  @lib bubblemanager
       
    40 *  @since 1.0
       
    41 */
       
    42 class CBubbleResourceManager :public CBase
       
    43     {
       
    44     public:  // Constructors and destructor
       
    45         
       
    46         /**
       
    47         * Two-phased constructor.
       
    48         * @param aParentWindow Main container
       
    49         * @return New instance
       
    50         */
       
    51         static CBubbleResourceManager* NewL( CBubbleManager& aParentWindow );
       
    52         
       
    53         /**
       
    54         * Destructor.
       
    55         */
       
    56         virtual ~CBubbleResourceManager();
       
    57 
       
    58     public: // New functions
       
    59         
       
    60         /**
       
    61         * Reserves CEikLabel object. Object must be released after use.
       
    62         * @return CEikLabel object.
       
    63         */
       
    64         CEikLabel* ReserveEikLabel();
       
    65 
       
    66         /**
       
    67         * Releases CEikLabel object. 
       
    68         * @param aLabel Object to be release. Pointer will be set to NULL.
       
    69         */
       
    70         void ReleaseEikLabel( CEikLabel*& aLabel );
       
    71 
       
    72         /**
       
    73         * Reserves CEikImage object. Object must be released after use.
       
    74         * @return CEikImage object.
       
    75         */
       
    76         CEikImage* ReserveEikImage( TBool aIsBackgroundImage = EFalse );
       
    77 
       
    78         /**
       
    79         * Releases CEikImage object. 
       
    80         * @param aImage Object to be release. Pointer will be set to NULL.
       
    81         */
       
    82         void ReleaseEikImage( CEikImage*& aImage );
       
    83 
       
    84         /**
       
    85         * Activates all the controls.
       
    86         * @since 2.0
       
    87         */
       
    88         void ActivateL();
       
    89 
       
    90     private:
       
    91 
       
    92         // Enumeration for different resources
       
    93         enum TBubbleResource
       
    94             {
       
    95             EBMEikImage = 0,
       
    96             EBMEikLabel
       
    97             };
       
    98 
       
    99         /**
       
   100         * C++ default constructor.
       
   101         */
       
   102         CBubbleResourceManager( CBubbleManager& aParentWindow );
       
   103 
       
   104         /**
       
   105         * 2nd phase constructor
       
   106         */
       
   107         void ConstructL();
       
   108 
       
   109         /**
       
   110         * Reserves one resource object.
       
   111         */
       
   112         void ReserveResource( 
       
   113             CCoeControl*& aResource , 
       
   114             TBubbleResource aType );
       
   115 
       
   116         /**
       
   117         * Releases current resource.
       
   118         */
       
   119         void ReleaseResource( 
       
   120             CCoeControl*& aResource , 
       
   121             TBubbleResource aType );
       
   122 
       
   123     private:    // Data
       
   124 
       
   125         typedef CArrayPtrFlat<CCoeControl> CSingleResource;
       
   126 
       
   127         // array of max elements
       
   128         RArray<TUint> iMaxAmounts;       
       
   129         // array of resource arrays
       
   130         CArrayPtrFlat<CSingleResource>* iResources; 
       
   131         // array of info about usage
       
   132         RArray<TUint> iAvailabilities; 
       
   133 
       
   134         // Parent window for controls
       
   135         CBubbleManager& iParentWindow;     
       
   136 
       
   137     };
       
   138 
       
   139 #endif      // CBUBBLERESOURCEMANAGER_H 
       
   140             
       
   141 // End of File