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