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