phoneuis/BubbleManager/Inc/BMCallObjectManager.h
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Controls call object loading.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CBUBBLECALLOBJECTMANAGER_H
       
    21 #define CBUBBLECALLOBJECTMANAGER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <gdi.h>
       
    25 #include <gulicon.h>
       
    26 #include <avkon.hrh>
       
    27 
       
    28 #include "BMBubbleManager.h"
       
    29 #include "BMMediaReaderObserver.h"
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // DATA TYPES
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CIdle;
       
    37 class MBubbleMediaReader;
       
    38 class CImageManager;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 *  Controls call object loading.
       
    44 *
       
    45 *  @lib BubbleManager.lib
       
    46 *  @since Series 60 3.0
       
    47 */
       
    48 class CBubbleCallObjectManager : public CBase,
       
    49                                  public MBubbleMediaReaderObserver
       
    50     {
       
    51     public:
       
    52         class TImageLoadingParams
       
    53             {
       
    54             public:
       
    55                 // Source fills the main pane.
       
    56                 TSize iPreferredSize;
       
    57                 // Source image is smaller than main pane.
       
    58                 TSize iTinyImageSize;
       
    59                 // Size used in incall bubble clips.
       
    60                 TSize iThumbnailSize;
       
    61                 // Display mode
       
    62                 TDisplayMode iDisplayMode;
       
    63             };
       
    64 
       
    65     public:  // Constructors and destructor
       
    66         
       
    67         /**
       
    68         * Two-phased constructor. 
       
    69         * @param aBubbleManager Bubble manager reference.
       
    70         * @return New instance
       
    71         */
       
    72         static CBubbleCallObjectManager* NewL( 
       
    73             CBubbleManager& aBubbleManager );
       
    74         
       
    75         /**
       
    76         * Destructor.
       
    77         */
       
    78         virtual ~CBubbleCallObjectManager();
       
    79 
       
    80     public: // New functions
       
    81 
       
    82         // Call object loading
       
    83 
       
    84         /**
       
    85         * Start loading image from given file. 
       
    86         * @param aBubbleId Bubble id which image belongs.
       
    87         * @param aFileName Image file name.
       
    88         * @param aParams Image loading parameters.
       
    89         */            
       
    90         void LoadImageFromFile(
       
    91             const CBubbleManager::TBubbleId& aBubbleId,
       
    92             const TDesC& aFileName,
       
    93             const TImageLoadingParams& aParams );
       
    94             
       
    95         /**
       
    96         * Start loading image from given text. 
       
    97         * @param aBubbleId Bubble id which image belongs.
       
    98         * @param aText Text for image generation.
       
    99         * @param aParams Image loading parameters.
       
   100         */            
       
   101         void LoadImageFromText(
       
   102             const CBubbleManager::TBubbleId& aBubbleId,
       
   103             const TDesC& aText,
       
   104             const TImageLoadingParams& aParams );            
       
   105             
       
   106         /**
       
   107         * Cancel call object loading.
       
   108         * @param aBubbleId Bubble id.
       
   109         */
       
   110         void CancelCallObjectLoading( 
       
   111                     const CBubbleManager::TBubbleId& aBubbleId );
       
   112                     
       
   113         /**
       
   114         * Sets image loading to suspended state. Loading can
       
   115         * be continued by calling Resume().
       
   116         */
       
   117         void Suspend();
       
   118         
       
   119         /**
       
   120         * Resumes image loading that has been set to suspended
       
   121         * state by calling Suspend(). 
       
   122         */
       
   123         TInt Resume();
       
   124         
       
   125         /**
       
   126         * Load call theme image. 
       
   127         * @param aImageManager Image manager.
       
   128         * @param aSize Image size.
       
   129         */            
       
   130         void LoadCallThemeImage(
       
   131             CBubbleImageManager& aImageManager,    
       
   132             const TSize& aSize );
       
   133         
       
   134         /**
       
   135         * Release call theme image. 
       
   136         */
       
   137         void ReleaseCallThemeImage();
       
   138         
       
   139         /**
       
   140         * Resizes call theme image.  
       
   141         * @param aSize New image size.
       
   142         */
       
   143         void ResizeCallThemeImage( const TSize& aSize );
       
   144                 
       
   145         /**
       
   146         * Returns call theme icon.
       
   147         * @return Call theme image icon. 
       
   148         */
       
   149         CGulIcon* CallThemeImageIcon();
       
   150         
       
   151     private: // Constructors
       
   152         
       
   153         /**
       
   154         * C++ default constructor.
       
   155         */
       
   156         CBubbleCallObjectManager( CBubbleManager& aBubbleManager );
       
   157         
       
   158         /**
       
   159         * By default Symbian 2nd phase constructor is private.
       
   160         */
       
   161         void ConstructL( );
       
   162         
       
   163     private: // From MBubbleMediaReaderObserver        
       
   164         void FrameBufferDataChanged();
       
   165         void ReaderError( TInt aError );                            
       
   166         
       
   167     private:
       
   168         void Reset();
       
   169         void ReadFromFileL( const TDesC& aFileName,
       
   170                             const TSize& aPreferredImageSize,
       
   171                             const TSize& aTinyImageSize ); 
       
   172         static TInt IdleProcessorCallback( TAny* aThis );
       
   173         void DoLoadImageInIdleL();
       
   174         void DoDeleteReaderInIdle();        
       
   175         void DoHandleFrameBufferDataL();
       
   176         void DoResumeL();
       
   177         TBool LoadThumbnailVersion();
       
   178         void AllocateCallThemeImageIconL( CBubbleImageManager& aImageManager );
       
   179         void DoInitializeIcons();
       
   180     
       
   181     private: // Private type definition               
       
   182         enum TLoadingState
       
   183             {
       
   184             EBMLoaderReady,
       
   185             EBMLoadingImage,
       
   186             EBMLoadingThumbnail,
       
   187             EBMLoadingText,
       
   188             EBMAnimating,
       
   189             EBMDeleting,
       
   190             EBMSuspended,
       
   191             EBMInitializingIcon
       
   192             };
       
   193 
       
   194     private: // Data
       
   195         // Bubble manager reference
       
   196         CBubbleManager& iBubbleManager;
       
   197         
       
   198         // Loading state
       
   199         TLoadingState iLoadingState;
       
   200         TInt iBubbleId;
       
   201         TImageLoadingParams iImageLoadParams;
       
   202         MBubbleMediaReader* iMediaReader; // Owned
       
   203         CIdle* iIdleProcessor; // Owned
       
   204         HBufC* iCallText; // Owned
       
   205         HBufC* iCallImage; // Owned
       
   206         CGulIcon* iCallThemeImageIcon; // Owned
       
   207         TSize     iCallThemeImageSize;
       
   208     };
       
   209 
       
   210 #endif // CBUBBLECALLOBJECTMANAGER_H   
       
   211             
       
   212 // End of File