emailuis/emailui/src/FreestyleEmailUiTextureManager.cpp
branchRCL_3
changeset 80 726fba06891a
parent 73 c8382f7b54ef
equal deleted inserted replaced
73:c8382f7b54ef 80:726fba06891a
     1 /*
     1 /*
     2 * Copyright (c) 2007 - 2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    20 // SYSTEM INCLUDES
    20 // SYSTEM INCLUDES
       
    21 // <cmail> SF
    21 #include "emailtrace.h"
    22 #include "emailtrace.h"
    22 #include <alf/alfstatic.h>
    23 #include <alf/alfstatic.h>
       
    24 // </cmail>
    23 #include <freestyleemailui.mbg>
    25 #include <freestyleemailui.mbg>
    24 #include <AknUtils.h>
    26 #include <AknUtils.h>
       
    27 // <cmail>
    25 #include <alf/alfframebrush.h>
    28 #include <alf/alfframebrush.h>
       
    29 // </cmail>
    26 #include <AknsConstants.h>
    30 #include <AknsConstants.h>
       
    31 // <cmail>
    27 #include <alf/alfimageloaderutil.h>
    32 #include <alf/alfimageloaderutil.h>
       
    33 // </cmail>
    28 #include <avkon.mbg>
    34 #include <avkon.mbg>
    29 #include <gulicon.h>
    35 #include <gulicon.h>
       
    36 // <cmail> S60 Skin support
    30 #include <AknsDrawUtils.h>
    37 #include <AknsDrawUtils.h>
       
    38 // </cmail>
    31 
    39 
    32 // INTERNAL INCLUDES
    40 // INTERNAL INCLUDES
    33 #include "FreestyleEmailUi.hrh"
    41 #include "FreestyleEmailUi.hrh"
    34 #include "FreestyleEmailUiTextureManager.h"
    42 #include "FreestyleEmailUiTextureManager.h"
    35 #include "FreestyleEmailUiAppui.h"
    43 #include "FreestyleEmailUiAppui.h"
    82 	delete iTmpMaskBitmap;
    90 	delete iTmpMaskBitmap;
    83 
    91 
    84 	delete iFrameBrush;
    92 	delete iFrameBrush;
    85 	iFrameBrush = NULL;
    93 	iFrameBrush = NULL;
    86 
    94 
       
    95 	//<cmail>
    87 	delete iNewFrameBrush;
    96 	delete iNewFrameBrush;
    88 	iNewFrameBrush = NULL;
    97 	iNewFrameBrush = NULL;
    89 
    98 
    90 	delete iTitleDividerBgBrush;
    99 	delete iTitleDividerBgBrush;
       
   100 	//</cmail>
    91 	}
   101 	}
    92 
   102 
    93 
   103 
    94 // -----------------------------------------------------------------------------
   104 // -----------------------------------------------------------------------------
    95 // CFreestyleEmailUiTextureManager::ConstructL
   105 // CFreestyleEmailUiTextureManager::ConstructL
   227 	frameBrush->SetFrameRectsL( innerRect, outerRect );
   237 	frameBrush->SetFrameRectsL( innerRect, outerRect );
   228 
   238 
   229 	return frameBrush;
   239 	return frameBrush;
   230 	}
   240 	}
   231 
   241 
       
   242 // <cmail>
   232 // -----------------------------------------------------------------------------
   243 // -----------------------------------------------------------------------------
   233 // CFreestyleEmailUiTextureManager::NewListSelectorBrushL
   244 // CFreestyleEmailUiTextureManager::NewListSelectorBrushL
   234 // NOTE: Gen UI list gets the ownership of the selector brush and deletes it
   245 // NOTE: Gen UI list gets the ownership of the selector brush and deletes it
   235 // when the selector is reset, so we need to construct new brush every time.
   246 // when the selector is reset, so we need to construct new brush every time.
   236 // Note: now its is changed to have ownership in texturemanager
   247 // Note: now its is changed to have ownership in texturemanager
   256 
   267 
   257     iNewFrameBrush->SetFrameRectsL( innerRect, outerRect);
   268     iNewFrameBrush->SetFrameRectsL( innerRect, outerRect);
   258 
   269 
   259     return iNewFrameBrush;
   270     return iNewFrameBrush;
   260     }
   271     }
       
   272 // </cmail>
   261 
   273 
   262 
   274 
   263 // -----------------------------------------------------------------------------
   275 // -----------------------------------------------------------------------------
   264 // CFreestyleEmailUiTextureManager::GridSelectorBrushL
   276 // CFreestyleEmailUiTextureManager::GridSelectorBrushL
   265 // -----------------------------------------------------------------------------
   277 // -----------------------------------------------------------------------------
   343 	TRect testOuterRect(10,10,57,57);
   355 	TRect testOuterRect(10,10,57,57);
   344 	TRect testInnerRect(12,12,56,56);
   356 	TRect testInnerRect(12,12,56,56);
   345 	frameBrush->SetFrameRectsL(testInnerRect, testOuterRect);
   357 	frameBrush->SetFrameRectsL(testInnerRect, testOuterRect);
   346 	return frameBrush;
   358 	return frameBrush;
   347 	}
   359 	}
       
   360 
       
   361 // -----------------------------------------------------------------------------
       
   362 // CFreestyleEmailUiTextureManager::NewMailListMarkingModeBgBrushLC
       
   363 // -----------------------------------------------------------------------------
       
   364 //
       
   365 CAlfImageBrush* CFreestyleEmailUiTextureManager::NewMailListMarkingModeBgBrushLC()
       
   366     {
       
   367     FUNC_LOG;
       
   368     CAlfTexture& circle = TextureByIndex( EMarkingModeBackgroundIcon );
       
   369     CAlfImageBrush* bgBrush = CAlfImageBrush::NewLC( *iEnv, TAlfImage(circle) );
       
   370     bgBrush->SetLayer( EAlfBrushLayerBackground );
       
   371     bgBrush->SetScaleMode( CAlfImageVisual::EScaleNormal );
       
   372     return bgBrush;
       
   373     }
   348 
   374 
   349 // -----------------------------------------------------------------------------
   375 // -----------------------------------------------------------------------------
   350 // CFreestyleEmailUiTextureManager::NewControlBarListBgBrushLC
   376 // CFreestyleEmailUiTextureManager::NewControlBarListBgBrushLC
   351 // -----------------------------------------------------------------------------
   377 // -----------------------------------------------------------------------------
   352 //
   378 //
   504  		{
   530  		{
   505  		// Do not set size
   531  		// Do not set size
   506  		}
   532  		}
   507  	else if ( aId >= ETextureGridFirst ) // GRID ICONS
   533  	else if ( aId >= ETextureGridFirst ) // GRID ICONS
   508 		{
   534 		{
       
   535 // <cmail> Platform layout change
       
   536 	   	//TInt gridIconSize = iAppUi->LayoutHandler()->GridIconSize();
       
   537 		//iconSize.SetSize(  gridIconSize, gridIconSize );
   509 		iconSize = iAppUi->LayoutHandler()->GridIconSize();
   538 		iconSize = iAppUi->LayoutHandler()->GridIconSize();
       
   539 // </cmail>
   510 		}
   540 		}
   511 	else  if ( aId >= ETextureMessageFirst /*&& aId < ETextureCalendarFirst*/ ) // MESSAGE ICONS
   541 	else  if ( aId >= ETextureMessageFirst /*&& aId < ETextureCalendarFirst*/ ) // MESSAGE ICONS
   512 		{
   542 		{
   513 		iconSize.SetSize( iAppUi->LayoutHandler()->MailIconSizeInThisResolution().iWidth,
   543 		iconSize.SetSize( iAppUi->LayoutHandler()->MailIconSizeInThisResolution().iWidth,
   514 						  iAppUi->LayoutHandler()->MailIconSizeInThisResolution().iHeight );
   544 						  iAppUi->LayoutHandler()->MailIconSizeInThisResolution().iHeight );
   519 
   549 
   520   	CFbsBitmap* bitmap(0);
   550   	CFbsBitmap* bitmap(0);
   521   	CFbsBitmap* mask(0);
   551   	CFbsBitmap* mask(0);
   522 	TScaleMode scalemode = EAspectRatioPreserved;
   552 	TScaleMode scalemode = EAspectRatioPreserved;
   523 
   553 
       
   554 // <cmaill> icons changed
   524 	switch ( aId )
   555 	switch ( aId )
   525 		{
   556 		{
   526 		// LIST TEXTURE READING STARTS HERE
   557 		// LIST TEXTURE READING STARTS HERE
   527 		//
   558 		//
   528 		case ESearchLookingGlassIcon:
   559 		case ESearchLookingGlassIcon:
   592 			AknIconUtils::CreateIconL( bitmap, mask, iconFileName,
   623 			AknIconUtils::CreateIconL( bitmap, mask, iconFileName,
   593 	                             EMbmFreestyleemailuiQgn_graf_cmail_list_selector,
   624 	                             EMbmFreestyleemailuiQgn_graf_cmail_list_selector,
   594 	                             EMbmFreestyleemailuiQgn_graf_cmail_list_selector_mask);
   625 	                             EMbmFreestyleemailuiQgn_graf_cmail_list_selector_mask);
   595 			}
   626 			}
   596 			break;
   627 			break;
   597 		case EListControlMarkOnIcon:
   628 		case EListControlMarkIcon:
   598 			{
   629 			{
   599 	        AknsUtils::CreateIconL( AknsUtils::SkinInstance(),
   630 			// <cmail> Platform layout change
   600 	            KAknsIIDQgnFsHscrActionArrowRight, bitmap, mask, iconFileName,
   631 			// Get mark icon from the skin, otherwise use default
   601 	            EMbmFreestyleemailuiQgn_prop_checkbox_on,
   632             AknsUtils::CreateColorIconL(
   602 	            EMbmFreestyleemailuiQgn_prop_checkbox_on_mask );			    
   633                 AknsUtils::SkinInstance(),
   603             TInt tempsize = iAppUi->LayoutHandler()->SearchMarkIconSize();
   634                 KAknsIIDQgnFsListItemSelected,
       
   635                 KAknsIIDQsnIconColors,
       
   636                 EAknsCIQsnIconColorsCG13,
       
   637                 bitmap,
       
   638                 mask,
       
   639                 //KAvkonBitmapFile,
       
   640                 iconFileName,
       
   641                 EMbmFreestyleemailuiQgn_indi_marked_add,
       
   642                 EMbmFreestyleemailuiQgn_indi_marked_add_mask,
       
   643                 KRgbBlack );
       
   644             TInt tempsize = iAppUi->LayoutHandler()->SearchLookingGlassIconSize();
   604             iconSize.SetSize( tempsize, tempsize );
   645             iconSize.SetSize( tempsize, tempsize );
   605 			scalemode = EAspectRatioNotPreserved;
   646 			scalemode = EAspectRatioNotPreserved;
   606 			}
   647 			// </cmail> Platform layout change
   607 			break;
       
   608 		case EListControlMarkOffIcon:
       
   609 			{
       
   610 	        AknsUtils::CreateIconL( AknsUtils::SkinInstance(),
       
   611 	            KAknsIIDQgnFsHscrActionArrowRight, bitmap, mask, iconFileName,
       
   612 	            EMbmFreestyleemailuiQgn_prop_checkbox_off,
       
   613 	            EMbmFreestyleemailuiQgn_prop_checkbox_off_mask );			    
       
   614 
       
   615             TInt tempsize = iAppUi->LayoutHandler()->SearchMarkIconSize();
       
   616             iconSize.SetSize( tempsize, tempsize );
       
   617 			scalemode = EAspectRatioNotPreserved;
       
   618 			}
   648 			}
   619 			break;
   649 			break;
   620 		case EListControlMenuIcon:
   650 		case EListControlMenuIcon:
   621 			{
   651 			{
   622 			// Use mirrored version of the icon on Arabic/Hebrew layout
   652 			// Use mirrored version of the icon on Arabic/Hebrew layout
  1854                 EMbmFreestyleemailuiQgn_indi_todo_high_add,
  1884                 EMbmFreestyleemailuiQgn_indi_todo_high_add,
  1855                 EMbmFreestyleemailuiQgn_indi_todo_high_add_mask,
  1885                 EMbmFreestyleemailuiQgn_indi_todo_high_add_mask,
  1856                 KRgbBlack );
  1886                 KRgbBlack );
  1857 		    }
  1887 		    }
  1858 		    break;
  1888 		    break;
       
  1889         case EMarkingModeBackgroundIcon:
       
  1890             {
       
  1891             TRect mailListRect(iAppUi->LayoutHandler()->GetListRect());
       
  1892             if ( mailListRect.Width() > mailListRect.Height() )
       
  1893                 {
       
  1894                 iconSize.SetSize( mailListRect.Width(), mailListRect.Width() );            
       
  1895                 }
       
  1896             else
       
  1897                 {
       
  1898                 iconSize.SetSize( mailListRect.Height(), mailListRect.Height() );            
       
  1899                 }                
       
  1900             AknIconUtils::CreateIconL( bitmap, mask, iconFileName,
       
  1901                                  EMbmFreestyleemailuiCmail_marking_mode_bg,
       
  1902                                  EMbmFreestyleemailuiCmail_marking_mode_bg);
       
  1903             }
       
  1904             break;
  1859 		case EGridAboutTexture:
  1905 		case EGridAboutTexture:
  1860 		default:
  1906 		default:
  1861 			// Branded mailbox icon
  1907 			// Branded mailbox icon
  1862 			if ( aId >= EBrandedIconStart && aId <= EBrandedIconEnd )
  1908 			if ( aId >= EBrandedIconStart && aId <= EBrandedIconEnd )
  1863 				{
  1909 				{
  2060 		case EBackgroundTextureMailList:
  2106 		case EBackgroundTextureMailList:
  2061 			{
  2107 			{
  2062 			iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EBackgroundTextureMailList, this, EAlfTextureFlagSkinContent);
  2108 			iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EBackgroundTextureMailList, this, EAlfTextureFlagSkinContent);
  2063 			}
  2109 			}
  2064 			break;
  2110 			break;
  2065 		case EListControlMarkOnIcon:
  2111 		case EListControlMarkIcon:
  2066 			{
  2112 			{
  2067 			iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EListControlMarkOnIcon, this, EAlfTextureFlagSkinContent);
  2113 			iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EListControlMarkIcon, this, EAlfTextureFlagSkinContent);
  2068 			break;
       
  2069 			}
       
  2070 		case EListControlMarkOffIcon:
       
  2071 			{
       
  2072 			iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EListControlMarkOffIcon, this, EAlfTextureFlagSkinContent);
       
  2073 			break;
  2114 			break;
  2074 			}
  2115 			}
  2075 		case EListControlMenuIcon:
  2116 		case EListControlMenuIcon:
  2076 			{
  2117 			{
  2077 			iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EListControlMenuIcon, this, EAlfTextureFlagSkinContent);
  2118 			iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EListControlMenuIcon, this, EAlfTextureFlagSkinContent);
  2101 		case EControlBarDescendingArrowTexture:
  2142 		case EControlBarDescendingArrowTexture:
  2102 			{
  2143 			{
  2103 			iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EControlBarDescendingArrowTexture, this, EAlfTextureFlagSkinContent);
  2144 			iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EControlBarDescendingArrowTexture, this, EAlfTextureFlagSkinContent);
  2104 			}
  2145 			}
  2105 			break;
  2146 			break;
       
  2147 		case EMarkingModeBackgroundIcon: 
       
  2148 		    {
       
  2149 		    iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EMarkingModeBackgroundIcon, this, EAlfTextureFlagRetainResolution);
       
  2150 		    }
       
  2151 		    break;
  2106 			
  2152 			
  2107 		// MESSAGE TEXTURES
  2153 		// MESSAGE TEXTURES
  2108 		case EMessageReadIcon: iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EMessageReadIcon, this, EAlfTextureFlagDefault); break;
  2154 		case EMessageReadIcon: iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EMessageReadIcon, this, EAlfTextureFlagDefault); break;
  2109 		case EMessageLowPrioReadIcon: iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EMessageLowPrioReadIcon, this, EAlfTextureFlagDefault); break;
  2155 		case EMessageLowPrioReadIcon: iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EMessageLowPrioReadIcon, this, EAlfTextureFlagDefault); break;
  2110 		case EMessageLowPrioReadIconAttachment: iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EMessageLowPrioReadIconAttachment, this, EAlfTextureFlagDefault); break;
  2156 		case EMessageLowPrioReadIconAttachment: iTextures[aTextureId] = &CAlfStatic::Env().TextureManager().CreateTextureL( EMessageLowPrioReadIconAttachment, this, EAlfTextureFlagDefault); break;