engine/inc/ImageHandler.h
changeset 63 a8538f50e2ba
parent 60 bbf5c5204844
equal deleted inserted replaced
62:c06c2a75bb57 63:a8538f50e2ba
    20 #define IMAGEHANDLER_H
    20 #define IMAGEHANDLER_H
    21 
    21 
    22 #include <f32file.h>
    22 #include <f32file.h>
    23 #include <ImageConversion.h>
    23 #include <ImageConversion.h>
    24 #include <BitmapTransforms.h>
    24 #include <BitmapTransforms.h>
       
    25 class CPodcastModel;
    25 
    26 
    26 /**
    27 /**
    27  * Listener interface that can be used to listen for image loading operation
    28  * Listener interface that can be used to listen for image loading operation
    28  * completion events from CImageHandler.
    29  * completion events from CImageHandler.
    29  *
    30  *
    40 public:
    41 public:
    41    /**
    42    /**
    42     * Called by CImageHandler when an image has been loaded.
    43     * Called by CImageHandler when an image has been loaded.
    43     * @param aError Error code given by the CImageHandler or 0 (zero) if the
    44     * @param aError Error code given by the CImageHandler or 0 (zero) if the
    44     *   image was loaded successfully.
    45     *   image was loaded successfully.
       
    46     * @param image handle
       
    47     * @param reference to podcast model
    45     */
    48     */
    46     virtual void ImageOperationCompleteL(TInt aError, TUint aHandle) = 0;
    49     virtual void ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& aPodcastModel) = 0;
    47     };
    50     };
    48 
    51 
    49 // ============================================================================
    52 // ============================================================================
    50 class TImageStruct
    53 class TImageStruct
    51 	{
    54 	{
    63 class CImageHandler : public CActive
    66 class CImageHandler : public CActive
    64     {
    67     {
    65     public: // Constructors and destructor
    68     public: // Constructors and destructor
    66        /**
    69        /**
    67         * Factory method that constructs a CImageHandler by using the NewLC method
    70         * Factory method that constructs a CImageHandler by using the NewLC method
    68         * and then cleans the cleanup stack.
    71         * and then cleans the cleanup stack.               
    69         * @param aBitmap Bitmap where the image data is loaded to.
       
    70         * @param aScaledBitmap Bitmap where the scaled image data is loaded to.
       
    71         * @param aFs File server reference that is used to load the image data.
    72         * @param aFs File server reference that is used to load the image data.
    72         * @param aCallback Listener interface implementation that is notified
    73         * @param Reference to podcast model
    73         *  when an image has been loaded.
    74         *  when an image has been loaded.
    74         * @return pointer to created CImageHandler-object
    75         * @return pointer to created CImageHandler-object
    75         */
    76         */
    76         IMPORT_C static CImageHandler* NewL(RFs& aFs);
    77         IMPORT_C static CImageHandler* NewL(RFs& aFs,CPodcastModel& aPodcastModel);
    77 
    78 
    78        /**
    79        /**
    79         * Factory method that constructs a CImageHandler and leaves it to the
    80         * Factory method that constructs a CImageHandler and leaves it to the
    80         * cleanup stack.
    81         * cleanup stack.
    81         * @param aBitmap Bitmap where the image data is loaded to.
       
    82         * @param aScaledBitmap Bitmap where the scaled image data is loaded to.
       
    83         * @param aFs File server reference that is used to load the image data.
    82         * @param aFs File server reference that is used to load the image data.
    84         * @param aCallback Listener interface implementation that is notified
    83         * @param Reference to podcast model
    85         *  when an image has been loaded.
       
    86         * @return pointer to created CImageHandler-object
    84         * @return pointer to created CImageHandler-object
    87         */
    85         */
    88         IMPORT_C static CImageHandler* NewLC(RFs& aFs);
    86         IMPORT_C static CImageHandler* NewLC(RFs& aFs,CPodcastModel& aPodcastModel);
    89        /**
    87        /**
    90         * Desctructor. Destroys the CImageDecoder used by the image handler.
    88         * Desctructor. Destroys the CImageDecoder used by the image handler.
    91         */
    89         */
    92         IMPORT_C virtual ~CImageHandler();
    90         IMPORT_C virtual ~CImageHandler();
    93         IMPORT_C CFbsBitmap* ScaledBitmap();
    91         IMPORT_C CFbsBitmap* ScaledBitmap();
   140         void DoCancel();
   138         void DoCancel();
   141 
   139 
   142     protected:
   140     protected:
   143         /**
   141         /**
   144          * C++ default constructor. Just stores the given parameters to
   142          * C++ default constructor. Just stores the given parameters to
   145          * corresponding attributes.      
   143          * corresponding attributes.              
   146          * @param aScaledBitmap Bitmap where the scaled image data is loaded to.
       
   147          * @param aFs File server reference that is used to load the image data.
   144          * @param aFs File server reference that is used to load the image data.
   148          * @param aCallback Listener interface implementation that is notified
   145          * @param Reference to podcast model
   149          *  when an image has been loaded.
   146          *  when an image has been loaded.
   150          */
   147          */
   151         CImageHandler(RFs& aFs);
   148         CImageHandler(RFs& aFs, CPodcastModel& aPodcastModel);
   152         /**
   149         /**
   153          * 2nd phase constructor. Adds this object to the active scheduler.
   150          * 2nd phase constructor. Adds this object to the active scheduler.
   154          */
   151          */
   155         void ConstructL();
   152         void ConstructL();
   156 
   153 
   180         TSize                   iSize;
   177         TSize                   iSize;
   181         RArray<TImageStruct> iCallbackQue;  
   178         RArray<TImageStruct> iCallbackQue;  
   182         
   179         
   183         /* Handle passed back to caller */
   180         /* Handle passed back to caller */
   184         TUint iHandle;
   181         TUint iHandle;
       
   182         
       
   183         /** Reference to the podcast model used for callbacks to be able to notify*/
       
   184         CPodcastModel& iPodcastModel;
   185     };
   185     };
   186 
   186 
   187 #endif
   187 #endif
   188 
   188