phoneuis/BubbleManager/Inc/telbubbleimagescaler.h
branchRCL_3
changeset 22 94dc1107e8b2
equal deleted inserted replaced
20:3c221667e687 22:94dc1107e8b2
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Ctelbubbleimagescaler declaration
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef TELBUBBLEIMAGESCALER_H
       
    19 #define TELBUBBLEIMAGESCALER_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 
       
    24 // FORWARD DECLARATIONS
       
    25 class CFbsBitmap;
       
    26 class CBitmapScaler;
       
    27 
       
    28 /**
       
    29  *  Interface to observe scaling status
       
    30  */
       
    31 class MTelBubbleImageScalerObserver
       
    32 {
       
    33 public:
       
    34     /**
       
    35      * Callback to indicate scaling completion
       
    36      * 
       
    37      * @param aError Error occured during scaling
       
    38      * @param aBitmap Scaled bitmap
       
    39      */
       
    40     virtual void ImageScalingComplete
       
    41                 (TInt aError, CFbsBitmap* aBitmap) = 0;
       
    42     };
       
    43 
       
    44 /**
       
    45  *  Asynchronous bitmap scaler.
       
    46  *  Uses CBitmapScaler to do scaling
       
    47  */
       
    48 class CTelBubbleImageScaler : public CActive
       
    49 {
       
    50 public:
       
    51     // Cancel and destroy
       
    52     ~CTelBubbleImageScaler();
       
    53 
       
    54     /** Two phase constructor */
       
    55     static CTelBubbleImageScaler* NewL(MTelBubbleImageScalerObserver& aObserver);
       
    56 
       
    57     /** Two phase constructor */
       
    58     static CTelBubbleImageScaler* NewLC(MTelBubbleImageScalerObserver& aObserver);
       
    59     
       
    60     /**
       
    61      *  Scaling status
       
    62      */
       
    63     enum TState
       
    64         {
       
    65         EScalingIdle = 0, EScalingStarted, EScalingDone
       
    66         };
       
    67 
       
    68 public:
       
    69     /**
       
    70      * Starts bitmap scaling Asynchronously 
       
    71      * @param aSrc Bitmap that needs to be scaled
       
    72      * @param aTarget Scaled bitmap
       
    73      * @return None.
       
    74      */
       
    75     void StartScaleL(CFbsBitmap* aSrc, CFbsBitmap* aTarget);
       
    76     
       
    77     /**
       
    78      * Sets the state of Scaler 
       
    79      * @param aState State to be set
       
    80      * @return None.
       
    81      */
       
    82     void SetState(TState aState);
       
    83     
       
    84     /**
       
    85      * Returns the current state of Scaler 
       
    86      * @param None
       
    87      * @return TInt State of the scaler
       
    88      */   
       
    89     TInt GetState();
       
    90 
       
    91 private:
       
    92     /* constructor */
       
    93     CTelBubbleImageScaler(MTelBubbleImageScalerObserver& aObserver);
       
    94 
       
    95     /* Second-phase constructor */
       
    96     void ConstructL();
       
    97 
       
    98 private: // From CActive
       
    99     /*
       
   100      * Handle completion
       
   101      */
       
   102     void RunL();
       
   103 
       
   104     /*
       
   105      * Cancels active request
       
   106      */
       
   107     void DoCancel();
       
   108 
       
   109     /*
       
   110      * Override to handle leaves from RunL(). Default implementation causes
       
   111      * the active scheduler to panic.
       
   112      */
       
   113     TInt RunError(TInt aError);
       
   114 
       
   115 private:
       
   116     /* 
       
   117      * Scaler observer instance 
       
   118      */
       
   119     MTelBubbleImageScalerObserver& iObserver;
       
   120     
       
   121     /*
       
   122      * Own: Bitmap scaler
       
   123      */
       
   124     CBitmapScaler* iScaler;
       
   125     
       
   126     /* 
       
   127      * Own: The bitmap that is scaled.
       
   128      */
       
   129     CFbsBitmap* iScaledBitmap;
       
   130 
       
   131     /*
       
   132      * Scaler state
       
   133      */
       
   134     TInt iState;
       
   135     };
       
   136 
       
   137 #endif // TELBUBBLEIMAGESCALER_H
       
   138 
       
   139 // End of File
       
   140