photosgallery/viewframework/texturemanager/inc/glxtexturemanager.h
changeset 0 4e91876724a2
child 1 9ba538e329bd
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-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:    Texture Manager component
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_GLXTEXTUREMANAGER_H
       
    22 #define C_GLXTEXTUREMANAGER_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <gdi.h>
       
    26 #include <AknsConstants.h>
       
    27 #include <glxmediaid.h>
       
    28 #include "mglxskinchangeobserver.h"
       
    29 
       
    30 class TAknsItemID;
       
    31 class CAlfTexture;
       
    32 class TMPXAttribute;
       
    33 class CGlxDRMUtility;
       
    34 class CGlxMedia;
       
    35 class CAlfImageLoaderUtil;
       
    36 class CAlfTextureManager;
       
    37 class MGlxCache;
       
    38 class TGlxMedia;
       
    39 class CGlxResolutionUtility;
       
    40 class CGlxTextureManagerImpl;
       
    41 class MGlxTextureObserver;
       
    42 
       
    43 /**
       
    44  *  CGlxTextureManager
       
    45  *
       
    46  *  Texture Manager component. 
       
    47  *
       
    48  * @author David Holland
       
    49  *
       
    50  */
       
    51 NONSHARABLE_CLASS ( CGlxTextureManager ) : public CBase, 
       
    52                                            public MGlxSkinChangeObserver
       
    53     {
       
    54 public:
       
    55     /**
       
    56     * Two-phased constructor
       
    57     * @param aAlfTextureManager The Alf Texture Manager
       
    58     * @return Constructed object
       
    59     */
       
    60     IMPORT_C static CGlxTextureManager* NewL(
       
    61                                 CAlfTextureManager& aAlfTextureManager);
       
    62 
       
    63 
       
    64     /**
       
    65     * Destructor
       
    66     */      
       
    67     ~CGlxTextureManager();
       
    68     /**
       
    69     * Determins if the texture need updating
       
    70     * @param aMediaId The Id of the media item
       
    71     * @param aIdSpaceId The Id of the Id space in which the media Id is defined
       
    72     * @param aRequiredSize The preferred size of the texture
       
    73     * @return ETrue if the texture needs updating. EFalse if not.
       
    74     */
       
    75     IMPORT_C TBool TextureNeedsUpdating(TGlxMedia aMedia, TGlxIdSpaceId aIdSpaceId,
       
    76                                                 const TSize& aRequiredSize);
       
    77 
       
    78  /**
       
    79      * Requests the best match texture. If it already exists this method does nothing.
       
    80      * However if it doed not exist it will create it and replace the old texture
       
    81      * if necessary.
       
    82      * @param aSize The size of the requested texture
       
    83      * @param aMedia The TGlxMedia item
       
    84      * @param aIdSpaceId The Id of the Id space in which the media Id is defined
       
    85      * @param aObserver Observer for the texture.
       
    86      * @return Created texture, or NULL if the texture alreay exists
       
    87      */
       
    88     
       
    89     IMPORT_C CAlfTexture& CreateNewTextureForMediaL(
       
    90             TSize aSize, 
       
    91             const TGlxMedia& aMedia, 
       
    92             const TGlxIdSpaceId& aIdSpaceId, 
       
    93             MGlxTextureObserver* aObserver );
       
    94     /**
       
    95     * Create a texture from an Avkon icon
       
    96     * @param aId The Id associated with the icon in the Skin
       
    97     * @param aBitmapId The Id associated with the bitmap in the Avkon icon bitmap file
       
    98     *  The bitmap Id is used if no icon is found for the skin Id
       
    99     * @param aRequestedSize requested size. If default used size is based on size of original graphic
       
   100     * @return Created texture
       
   101     */
       
   102     IMPORT_C CAlfTexture& CreateAvkonIconTextureL(const TAknsItemID &aID, 
       
   103                                           TInt aBitmapId,
       
   104                                           TSize aRequestedSize = TSize(0,0));
       
   105                                           
       
   106     /**
       
   107     * Create a texture from an Avkon icon
       
   108     * @param aId The Id associated with the icon in the Skin
       
   109     * @param aBitmapId The Id associated with the bitmap in the Avkon icon bitmap file
       
   110     *  The bitmap Id is used if no icon is found for the skin Id
       
   111     * @param aDefaultColor colour use if skin clour not specified or not found
       
   112     * @param aSkinColorId Id of the skin colour table
       
   113     * @param aSkinColorIndex Index of the colour in the table
       
   114     * @param aRequestedSize requested size. If default used size is based on size of original graphic
       
   115     * @return Created texture
       
   116     */
       
   117     IMPORT_C CAlfTexture& CreateColorAvkonIconTextureL(
       
   118                                                         const TAknsItemID& aID, 
       
   119                                                         TInt aBitmapId,
       
   120                                                         TRgb aDefaultColor,
       
   121                                                         const TAknsItemID& aSkinColorId = KAknsIIDNone,
       
   122                                                         TInt aSkinColorIndex = 0,
       
   123                                                         TSize aRequestedSize = TSize(0,0));
       
   124                                           
       
   125     
       
   126     /**
       
   127     * Create a texture from an Avkon icon
       
   128     * @param aId The Id associated with the icon in the Skin
       
   129     * @param aRequestedSize requested size. If default used size is based on size of original graphic
       
   130     * @return Created texture
       
   131     */
       
   132     IMPORT_C CAlfTexture& CreateAvkonIconTextureL(const TAknsItemID &aID, 
       
   133                                           TSize aRequestedSize = TSize(0,0));
       
   134     
       
   135     /**
       
   136     * Create a texture from an icon within the application
       
   137     * @param aIconResourceId The Id associated with the icon .mif file
       
   138     * @param aFilename The full path name of the .mif file
       
   139     * @param aRequestedSize requested size. If default used size is based on size of original graphic
       
   140     * @return Created texture
       
   141     */
       
   142     IMPORT_C CAlfTexture& CreateIconTextureL(TInt aIconResourceId, 
       
   143                                            TDesC& aFilename,
       
   144                                            TSize aRequestedSize = TSize(0,0));
       
   145 
       
   146     /**
       
   147     * Create a texture from an icon within the application, modifying the icon colour
       
   148     * @param aIconResourceId The Id associated with the icon .mif file
       
   149     * @param aFilename The full path name of the .mif file
       
   150     * @param aDefaultColor colour use if skin clour not specified or not found
       
   151     * @param aSkinColorId Id of the skin colour table
       
   152     * @param aSkinColorIndex Index of the colour in the table
       
   153     * @param aRequestedSize requested size. If default used size is based on size of original graphic
       
   154     * @return Created texture
       
   155     */
       
   156     IMPORT_C CAlfTexture& CreateColorIconTextureL(
       
   157                                TInt aIconResourceId, 
       
   158                                TDesC& aFilename,
       
   159                                TRgb  aDefaultColor,
       
   160                                const TAknsItemID& aSkinColorId = KAknsIIDNone,
       
   161                                TInt aSkinColorIndex = 0,
       
   162                                TSize aRequestedSize = TSize(0,0));
       
   163     
       
   164     /**
       
   165     * Create a texture from a bitmap from the attribute of a media item
       
   166     * @param aMediaId The Id of the media item
       
   167     * @param aIdSpaceId The Id of the Id space in which the media Id is defined
       
   168     * @param aRequiredSize The preferred size of the texture
       
   169     * @param aObserver Observer for the texture.
       
   170     * @param aScaleGridTnm ETrue if the grid tnm to be scaled else EFalse by default.
       
   171     * @return Created texture
       
   172     */
       
   173     IMPORT_C CAlfTexture& CreateThumbnailTextureL(
       
   174                 const TGlxMedia& aMedia, const TGlxIdSpaceId& aIdSpaceId,
       
   175                 const TSize& aRequiredSize, MGlxTextureObserver* aObserver, 
       
   176                 TBool aScaleGridTnm=EFalse);
       
   177 
       
   178     /**
       
   179     * Create a texture from a zoomed thumbnail attribute of a media item
       
   180     * @param aMedia The media item
       
   181     * @param aAttribute Which attribute
       
   182     * @param aIdSpaceId The Id of the Id space in which the media Id is defined
       
   183     * @param aTextureId The created texture's id, required when the texture is removed.
       
   184     * @return Created texture
       
   185     */
       
   186     IMPORT_C CAlfTexture& CreateZoomedTextureL(const TGlxMedia& aMedia,
       
   187                                             const TMPXAttribute& aAttribute,
       
   188                                             TGlxIdSpaceId aIdSpaceId, MGlxTextureObserver* aObserver);
       
   189 
       
   190     /**
       
   191     * Create an animated texture from a GIF file
       
   192     * @param aFilename The filename of the GIF file
       
   193     * @param aSize The size of the GIF file
       
   194     * @return Created texture: ownership transfered
       
   195     */
       
   196     IMPORT_C CAlfTexture& CreateAnimatedGifTextureL( const TDesC& aFilename, 
       
   197         const TSize& aSize );
       
   198     
       
   199     /**
       
   200      * Creates a flat color texture and returns the reference to it
       
   201      * Note that the texture ownership stays within texture manager 
       
   202      * @param aColour the color for the texture
       
   203      */
       
   204     IMPORT_C CAlfTexture& CreateFlatColourTextureL( TRgb aColour );
       
   205     
       
   206     /**
       
   207     * Removes the texture if it was created by CreateThumbnailTextureL or
       
   208     * CreateZoomedTextureL
       
   209     * @param aTexture The texture to be removed
       
   210     */
       
   211     IMPORT_C void RemoveTexture(const CAlfTexture& aTexture);
       
   212     /**
       
   213      * Removes the texture if it was created by CreateThumbnailTextureL or
       
   214      * CreateZoomedTextureL
       
   215      * @param aTexture The texture to be removed
       
   216      */
       
   217     IMPORT_C void RemoveZoomList();
       
   218     
       
   219  /**
       
   220     * Removes the texture if it was created by CreateThumbnailTextureL or
       
   221     * CreateZoomedTextureL
       
   222     * @param aMediaId The MediaId to be removed
       
   223     * @param aAllTexture Flag to remove all textures
       
   224 	* Bug fix for PKAA-7NRBYZ - added bAllTexture param
       
   225     */
       
   226     IMPORT_C void RemoveTexture(const TGlxMediaId& aMediaId, TBool aAllTexture=EFalse);
       
   227     
       
   228 public: // from MGlxSkinChangeObserver
       
   229 
       
   230     void HandleSkinChanged();    
       
   231 
       
   232 
       
   233 private:
       
   234        //implementation class
       
   235        CGlxTextureManagerImpl* iImpl;
       
   236     };
       
   237  
       
   238 
       
   239 
       
   240 #endif // C_GLXTEXTUREMANAGER_H