emailuis/emailui/inc/FreestyleEmailUiTextureManager.h
branchRCL_3
changeset 64 3533d4323edc
child 73 c8382f7b54ef
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2007 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:  FreestyleEmailUi generic texturemanager definition
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __FREESTYLEEMAILUI_TEXTUREMANAGER_H__
       
    21 #define __FREESTYLEEMAILUI_TEXTUREMANAGER_H__
       
    22 
       
    23 
       
    24 // SYSTEM INCLUDES
       
    25 #include"FSDelayedLoader.h"
       
    26 //<cmail> SF
       
    27 #include <alf/alfimagebrush.h>
       
    28 #include <alf/alfcontrol.h> 
       
    29 #include <alf/alftexture.h>
       
    30 #include <alf/alfbitmapprovider.h>
       
    31 //</cmail>
       
    32 #include <AknsBasicBackgroundControlContext.h>
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CAlfEnv;
       
    36 class CFreestyleEmailUiAppUi;
       
    37 class CAlfFrameBrush;
       
    38 
       
    39 
       
    40 enum TFSEmailUiTextures
       
    41 	{
       
    42 	// FIRST TEXTURE ID
       
    43 	ETextureFirst = 6000, // non-texture
       
    44 	
       
    45 	// OTHER
       
    46 	ETextureOtherFirst = 6001, // non-texture
       
    47 	EListTextureSelector = ETextureOtherFirst,
       
    48 	EListTextureNodeExpanded,
       
    49 	EListTextureNodeCollapsed,
       
    50 	EListTextureControlButton,
       
    51 	EListTextureMailboxDefaultIcon,
       
    52 	EListTextureNewEmailDefaultIcon,
       
    53 	EListTextureCreateNewMessageIcon,
       
    54 	EListControlBarMailboxDefaultIcon,
       
    55 	EBackgroundTextureViewerHeading,
       
    56 	EBackgroundTextureBar,
       
    57 	EBackgroundTextureThumb,
       
    58 	EBackgroundTextureMailList,
       
    59 	EListControlMarkIcon,
       
    60 	EListControlMenuIcon,
       
    61 	EMailListBarBgIcon,
       
    62 	ESearchLookingGlassIcon,
       
    63 	EControlBarListBackgroundTexture,
       
    64 	EControlBarButtonBackgroundTexture,
       
    65 	EControlBarAscendingArrowTexture,
       
    66 	EControlBarDescendingArrowTexture,
       
    67 	
       
    68 	// MESSAGE TEXTURES
       
    69 	ETextureMessageFirst, // non-texture
       
    70 	EMessageReadIcon = ETextureMessageFirst,
       
    71 	EMessageLowPrioReadIcon,
       
    72 	EMessageLowPrioReadIconAttachment,
       
    73 	EMessageReadIconAttachment,
       
    74 	EMessageReadRepliedIcon,
       
    75 	EMessageReadRepliedIconAttachment,
       
    76 	EMessageReadRepliedHighPrioIcon,
       
    77 	EMessageReadRepliedHighPrioIconAttachment,
       
    78 	EMessageReadRepliedLowPrioIcon,		
       
    79 	EMessageReadRepliedLowPrioIconAttachment,		
       
    80 	EMessageReadForwardedIcon,
       
    81 	EMessageReadForwardedIconAttachment,
       
    82 	EMessageReadForwardedHighPrioIcon,
       
    83 	EMessageReadForwardedHighPrioIconAttachment,
       
    84 	EMessageReadForwardedLowPrioIcon,
       
    85 	EMessageReadForwardedLowPrioIconAttachment,
       
    86 	EMessageUnreadIcon,
       
    87 	EMessageUnreadIconAttachment,
       
    88 	EMessageLowPrioUnreadIcon,
       
    89 	EMessageLowPrioUnreadIconAttachment,
       
    90 	EMessageHighPrioReadIcon,
       
    91 	EMessageHighPrioReadIconAttachment,
       
    92 	EMessageHighPrioUnreadIcon,
       
    93 	EMessageHighPrioUnreadIconAttachment,
       
    94 	EAttachmentIcon,	
       
    95 	EMessageUnreadForwardedIcon,
       
    96 	EMessageUnreadForwardedIconAttachment,
       
    97 	EMessageUnreadForwardedHighPrioIcon,
       
    98 	EMessageUnreadForwardedHighPrioIconAttachment,
       
    99 	EMessageUnreadForwardedLowPrioIcon,
       
   100 	EMessageUnreadForwardedLowPrioIconAttachment,	
       
   101 	EMessageUnreadRepliedIcon,
       
   102 	EMessageUnreadRepliedIconAttachment,
       
   103 	EMessageUnreadRepliedHighPrioIcon,
       
   104 	EMessageUnreadRepliedHighPrioIconAttachment,
       
   105 	EMessageUnreadRepliedLowPrioIcon,
       
   106 	EMessageUnreadRepliedLowPrioIconAttachment,
       
   107 
       
   108 	// CALENDAR EVENT TEXTURES
       
   109 	ETextureCalendarFirst, // non-texture
       
   110 	EMessageCalInvitation = ETextureCalendarFirst,
       
   111 	EMessageCalInvitationRead,
       
   112 	EMessageCalInvitationAttachments,
       
   113 	EMessageCalInvitationReadAttachments,	
       
   114 	EMessageCalInvitationHighPrio,
       
   115 	EMessageCalInvitationReadHighPrio,
       
   116 	EMessageCalInvitationAttachmentsHighPrio,
       
   117 	EMessageCalInvitationReadAttachmentsHighPrio,
       
   118 	EMessageCalInvitationLowPrio,
       
   119 	EMessageCalInvitationReadLowPrio,
       
   120 	EMessageCalInvitationAttachmentsLowPrio,
       
   121 	EMessageCalInvitationReadAttachmentsLowPrio,
       
   122 	EMessageCalInvitationCancelled,
       
   123 
       
   124 	// GRID TEXTURES
       
   125 	ETextureGridFirst, // non-texture
       
   126 	EGridInboxTexture = ETextureGridFirst,
       
   127     EGridDirectoryTexture,
       
   128     EGridSettingsTexture,
       
   129     EGridAddNewBoxTexture,
       
   130     EGridHelpTexture,
       
   131     EGridAboutTexture,
       
   132     EGridBackground, 
       
   133     
       
   134     // FLAG ICONS
       
   135     ETextureFlagFirst, // non-texture
       
   136 	EFollowUpFlag = ETextureFlagFirst,
       
   137 	EFollowUpFlagComplete,
       
   138 	EFollowUpFlagList,
       
   139 	EFollowUpFlagCompleteList,
       
   140 	
       
   141     // FOLDER LIST ICONS
       
   142     ETextureFolderFirst, // non-texture
       
   143     EFolderListMoreFoldersTexture = ETextureFolderFirst,
       
   144     EFolderListInboxTexture,
       
   145     EFolderListInboxSubfoldersTexture,
       
   146     EFolderListOutboxTexture,
       
   147     EFolderListDraftsTexture,
       
   148     EFolderListSentTexture,
       
   149     EFolderListDeletedItemsTexture,
       
   150     EFolderListServerFoldersTexture,
       
   151     EFolderListEmailAccountTexture,
       
   152     EFolderListMoreFoldersTexturePopup,
       
   153     EFolderListInboxTexturePopup,
       
   154     EFolderListInboxSubfoldersTexturePopup,
       
   155     EFolderListOutboxTexturePopup,
       
   156     EFolderListDraftsTexturePopup,
       
   157     EFolderListSentTexturePopup,
       
   158     EFolderListDeletedItemsTexturePopup,
       
   159     EFolderListServerFoldersTexturePopup,
       
   160     EFolderListEmailAccountTexturePopup,
       
   161     // SORT LIST ICONS
       
   162     ESortListAttachmentAscTexturePopup,
       
   163     ESortListAttachmentDescTexturePopup,
       
   164     ESortListDateAscTexturePopup,
       
   165     ESortListDateDescTexturePopup,
       
   166     ESortListFollowAscTexturePopup,
       
   167     ESortListFollowDescTexturePopup,
       
   168     ESortListPriorityAscTexturePopup,
       
   169     ESortListPriorityDescTexturePopup,
       
   170     ESortListSenderAscTexturePopup,
       
   171     ESortListSenderDescTexturePopup,
       
   172     ESortListSubjectAscTexturePopup,
       
   173     ESortListSubjectDescTexturePopup,
       
   174     ESortListUnreadAscTexturePopup,
       
   175     ESortListUnreadDescTexturePopup,    
       
   176     ESortListAttachmentAscTexture,
       
   177     ESortListAttachmentDescTexture,
       
   178     ESortListDateAscTexture,
       
   179     ESortListDateDescTexture,
       
   180     ESortListFollowAscTexture,
       
   181     ESortListFollowDescTexture,
       
   182     ESortListPriorityAscTexture,
       
   183     ESortListPriorityDescTexture,
       
   184     ESortListSenderAscTexture,
       
   185     ESortListSenderDescTexture,
       
   186     ESortListSubjectAscTexture,
       
   187     ESortListSubjectDescTexture,
       
   188     ESortListUnreadAscTexture,
       
   189     ESortListUnreadDescTexture,
       
   190 
       
   191 	// STATUS INDICATOR ICONS
       
   192 	ETextureStatusFirst, // non-texture
       
   193 	EStatusTextureSynchronising = ETextureStatusFirst,
       
   194 	EStatusTextureConnected,
       
   195 	EStatusTextureConnecting,
       
   196 	EStatusTextureDisconnectedGeneral,
       
   197 	EStatusTextureDisconnectedError,
       
   198 	EStatusTextureDisconnectedLowBattery,
       
   199 	EStatusTextureMailSent,
       
   200 
       
   201 	// VIEWER TEXTURES
       
   202 	ETextureViewerFirst, // non-texture
       
   203 	EViewerTextureHeaderBackGround = ETextureViewerFirst,
       
   204 	EViewerHighlightTexture,
       
   205 
       
   206 	// COMPOSER TEXTURES
       
   207 	ETextureComposerFirst, // no-texture
       
   208 	EComposerTexturePriorityLow = ETextureComposerFirst,
       
   209 	EComposerTexturePriorityHigh,
       
   210 	
       
   211 	// ATTACHMENT ICONS
       
   212 	ETextureAttachmentsFirst, // non-texture
       
   213 	EAttachmentsDocFile = ETextureAttachmentsFirst,
       
   214 	EAttachmentsHtmlFile,
       
   215 	EAttachmentsImageFile,
       
   216 	EAttachmentsPdfFile,
       
   217 	EAttachmentsPptFile,
       
   218 	EAttachmentsRtfFile,
       
   219 	EAttachmentsUnknownFile,
       
   220 	EAttachmentsXls,
       
   221 	EAttachmentsNotDownloaded,
       
   222 	EAttachmentsCancelDownload,
       
   223 	EAttachmentsDownload,
       
   224 	EAttachmentsSaveAll,
       
   225 	EAttachmentsCancelAll,
       
   226 	EAttachmentsViewAll,
       
   227 	
       
   228     EMarkingModeBackgroundIcon,
       
   229     
       
   230 	// TEXTURE COUNT
       
   231 	ETextureCount,
       
   232 	
       
   233 	// Branded mailbox icons. Max 101 icons 3 sizes of each
       
   234 	// (Launcher grid, Inbox view and Folders dropdown view)
       
   235 	EBrandedIconStart = 8000,
       
   236 	EBrandedIconEnd = 8303,
       
   237 	
       
   238 	// GRID ECOM PLUGIN ICONS, Dynamically updated, 
       
   239 	// do not add icons after this
       
   240 	EGridPluginIconFirst 
       
   241 	};
       
   242 
       
   243 class CFreestyleEmailUiTextureManager: 
       
   244 	public CAlfControl, 
       
   245 	public MAlfBitmapProvider,
       
   246 	public MFsDelayedLoadingInterface
       
   247     {
       
   248 // to prevent creating multiple instances NewL has been hidden
       
   249 // and AppUi has been declared as friend class
       
   250 friend class CFreestyleEmailUiAppUi;
       
   251 
       
   252 public:
       
   253 	// Get correct backgroung image for current resolution
       
   254 	CAlfTexture& BackgroundForThisResolutionL();
       
   255 	// Get flush background image for the current resolution
       
   256 	CAlfTexture& WatermarkBackgroundForThisResolutionL();	
       
   257 	// Get any texture by ID
       
   258 	CAlfTexture& TextureByIndex( TFSEmailUiTextures aIndex );
       
   259 	// Clear any texture by ID
       
   260 	void ClearTextureByIndex( TFSEmailUiTextures aIndex );
       
   261 	// Get new skinned selector brush object for gen ui list.
       
   262 	// Ownership is NOT transferred to caller.
       
   263 	CAlfFrameBrush* ListSelectorBrushL();
       
   264 	// Get new skinned grid selector brush object
       
   265 	// Ownership is NOT transferred to caller.
       
   266     CAlfFrameBrush* GridSelectorBrushL();
       
   267 	// Get new skinned selector brush object for gen ui control bar.
       
   268 	// Ownership IS transferred to caller.
       
   269 	CAlfFrameBrush* NewCtrlBarSelectorBrushLC();
       
   270 	// <cmail>
       
   271     // Get new skinned selector brush object for gen ui popup list.
       
   272     // Ownership IS transferred to caller.	
       
   273 	CAlfFrameBrush* NewListSelectorBrushL();
       
   274 	// </cmail>
       
   275 	// Get new scrollbar top background object. 
       
   276 	// Ownership IS transferred to caller.
       
   277 	CAlfFrameBrush* NewScrollBarTopBgBrushLC();
       
   278 	// Get new scrollbar bottom background object. 
       
   279     // Ownership IS transferred to caller.
       
   280 	CAlfFrameBrush* NewScrollBarBottomBgBrushLC();
       
   281 	// Get new scrollbar center background object. 
       
   282     // Ownership IS transferred to caller.
       
   283 	CAlfFrameBrush* NewScrollBarCenterBgBrushLC();
       
   284 	// Get new scrollbar thumb object. 
       
   285     // Ownership IS transferred to caller.
       
   286 	CAlfFrameBrush* NewScrollBarThumbBrushLC();
       
   287 	// Get new mail list separator brush	
       
   288 	// Ownership IS transferred to caller.
       
   289 	CAlfFrameBrush* NewMailListSeparatorBgBrushLC();
       
   290 	// Get marking mode background brush	
       
   291 	// Ownership IS transferred to caller.
       
   292 	CAlfImageBrush* NewMailListMarkingModeBgBrushLC();
       
   293 	// Get new mail list separator brush	
       
   294     // Ownership IS transferred to caller.
       
   295 	CAlfImageBrush* NewControlBarListBgBrushLC();
       
   296 	// Get new controlbar button bg brush
       
   297     // Ownership IS transferred to caller.
       
   298 	CAlfImageBrush* NewControlBarButtonBgBrushLC();
       
   299 
       
   300 	// <cmail>
       
   301 	// Ownerhip not transfered.
       
   302 	CAlfFrameBrush* TitleDividerBgBrushL();
       
   303 	// </cmail>
       
   304 
       
   305 	// Create branded mailbox icon into TextureManager
       
   306 	void CreateBrandedMailboxTexture( CGulIcon* aIcon, const TUid aPluginId, const TUint aMailboxId, const TSize& aSize );
       
   307 	// Get branded mailbox icon
       
   308 	CAlfTexture& TextureByMailboxIdL( const TUid aPluginId, const TUint aMailboxId, const TSize& aSize );
       
   309     
       
   310 public: // from MAlfBitmapProvider
       
   311 
       
   312     void ProvideBitmapL(TInt aId, CFbsBitmap*& aBitmap, CFbsBitmap*& aMaskBitmap);
       
   313     
       
   314 public: // from MFsDelayedLoadingInterface
       
   315 
       
   316     /**
       
   317     * DelayLoadCallback
       
   318     * Delayed loading callback
       
   319     * @return ETrue to keep calling, EFalse to stop callbacks
       
   320     */
       
   321 	TInt DelayLoadCallback();
       
   322 	
       
   323 private: 
       
   324     // This class should not be used directly, use iAppUi->TextureManger() instance
       
   325     static CFreestyleEmailUiTextureManager* NewL( CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi );
       
   326     virtual ~CFreestyleEmailUiTextureManager();
       
   327     
       
   328     CFreestyleEmailUiTextureManager( CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi );
       
   329     void ConstructL(CAlfEnv& aEnv);
       
   330     void CreateTexturesL(); 
       
   331     
       
   332     void InitTextureArray();
       
   333     void LoadTextureL( TFSEmailUiTextures aTextureId ); // CHECKLATER - is this ok? see migration 3.12.1
       
   334 	// <cmail> S60 Skin support
       
   335 	void GetBackgroundBitmapL (CFbsBitmap*& bitmap) const; 
       
   336 	void DrawContextL (CFbsBitmap*& bitmap, TAknsItemID id, TSize rsize) const;
       
   337 	// </cmail>
       
   338 
       
   339 private:
       
   340 	// ALF environment - CHECKLATER - added this myself, but should be alright
       
   341     CAlfEnv* iEnv;
       
   342 
       
   343 	CFreestyleEmailUiAppUi* iAppUi;
       
   344 	CAlfFrameBrush* iFrameBrush;
       
   345 	//<cmail>
       
   346 	CAlfFrameBrush* iNewFrameBrush;
       
   347 	CAlfFrameBrush* iTitleDividerBgBrush;
       
   348 	//</cmail>
       
   349 	
       
   350     /**
       
   351     * array for holding texture objects
       
   352     */
       
   353     RPointerArray<CAlfTexture> iTextures;
       
   354 
       
   355     /**
       
   356     * array for holding branded mailbox icons
       
   357     */
       
   358     RPointerArray<CAlfTexture> iBrandedMailboxIcons;
       
   359     RArray<TUid> iPluginId;
       
   360     RArray<TUint> iMailboxId;
       
   361     RArray<TSize> iSize;
       
   362     /*
       
   363      * Temporary variables for holding the mailbox icon and id
       
   364      * before create.
       
   365      */
       
   366     CFbsBitmap*   iTmpBitmap;
       
   367     CFbsBitmap*   iTmpMaskBitmap;
       
   368     TUid          iTmpPluginId;
       
   369     TUint         iTmpMailboxId;
       
   370     TSize         iTmpSize;
       
   371 
       
   372     /**
       
   373     * index indicating delay loading progress within
       
   374     * textures array
       
   375     */
       
   376     TInt iDelayLoadIndex;
       
   377     
       
   378 	};
       
   379 
       
   380 #endif // __FREESTYLEEMAILUI_LISTCONTROL_H__
       
   381