camerauis/activepalette/Src/ActivePalette2SemiTransparentStyler.cpp
branchRCL_3
changeset 24 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     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:  Active Palette Styler*
       
    15 */
       
    16 
       
    17 
       
    18 /**
       
    19  * @file ActivePalette2SemiTransparentStyler.cpp
       
    20  * Active Palette Semi-transparent Styler
       
    21  */
       
    22 
       
    23 #include "ActivePalette2SemiTransparentStyler.h"
       
    24 #include "ActivePalette2Cfg.h"
       
    25 #include "ActivePalette2Utils.h"
       
    26 #include <activepalette2graphics.mbg>
       
    27 
       
    28 #include <AknIconUtils.h>
       
    29 #include <bitstd.h>
       
    30 #include <gdi.h>
       
    31 
       
    32 //#define USE_OPAQUE_TOOLTIPS
       
    33 
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CActivePalette2SemiTransparentStyler::NewL()
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 CActivePalette2SemiTransparentStyler* CActivePalette2SemiTransparentStyler::NewL()
       
    40     {
       
    41 	CActivePalette2SemiTransparentStyler* self = new (ELeave) CActivePalette2SemiTransparentStyler();
       
    42 	CleanupStack::PushL(self);
       
    43 	self->ConstructL();
       
    44 	CleanupStack::Pop(); // this
       
    45 	return self;
       
    46     }
       
    47     
       
    48 // -----------------------------------------------------------------------------
       
    49 // CActivePalette2SemiTransparentStyler::ConstructL()
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 void CActivePalette2SemiTransparentStyler::ConstructL()
       
    53     {
       
    54     CActivePalette2Styler::ConstructL();
       
    55 	
       
    56     iAPTopSectionMask = AknIconUtils::CreateIconL( NAP2Cfg::KUIGraphics, EMbmActivepalette2graphicsQgn_graf_cam4_tb_top_mask);
       
    57     AknIconUtils::SetSize(iAPTopSectionMask, TSize(ActivePalette2Utils::APDimension(ActivePalette2Utils::EPaletteWidth), ActivePalette2Utils::APDimension(ActivePalette2Utils::ETopSectionHeight) ) );
       
    58 
       
    59     iAPItemMask = AknIconUtils::CreateIconL( NAP2Cfg::KUIGraphics, EMbmActivepalette2graphicsQgn_graf_cam4_tb_body_mask);
       
    60     AknIconUtils::SetSize(iAPItemMask, TSize(ActivePalette2Utils::APDimension(ActivePalette2Utils::EPaletteWidth), ActivePalette2Utils::APDimension(ActivePalette2Utils::EItemHeight) ) );
       
    61 
       
    62     iAPGapMask = AknIconUtils::CreateIconL( NAP2Cfg::KUIGraphics, EMbmActivepalette2graphicsQgn_graf_cam4_tb_gap_mask);
       
    63     AknIconUtils::SetSize(iAPGapMask, TSize(ActivePalette2Utils::APDimension(ActivePalette2Utils::EPaletteWidth), ActivePalette2Utils::APDimension(ActivePalette2Utils::EGapBetweenItems) ) );
       
    64 
       
    65     iAPBottomSectionMask = AknIconUtils::CreateIconL( NAP2Cfg::KUIGraphics, EMbmActivepalette2graphicsQgn_graf_cam4_tb_bottom_mask);
       
    66     AknIconUtils::SetSize(iAPBottomSectionMask, TSize(ActivePalette2Utils::APDimension(ActivePalette2Utils::EPaletteWidth), ActivePalette2Utils::APDimension(ActivePalette2Utils::EBottomSectionHeight) ) );
       
    67 
       
    68     }
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CActivePalette2SemiTransparentStyler::~CActivePalette2SemiTransparentStyler()
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 CActivePalette2SemiTransparentStyler::~CActivePalette2SemiTransparentStyler()
       
    75     {
       
    76 	delete iAPTopSectionMask;
       
    77 	delete iAPItemMask;
       
    78 	delete iAPGapMask;
       
    79 	delete iAPBottomSectionMask;
       
    80     }
       
    81     
       
    82 // -----------------------------------------------------------------------------
       
    83 // CActivePalette2SemiTransparentStyler::DrawItem()
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 void CActivePalette2SemiTransparentStyler::DrawItem(TInt aScreenPos, CFbsBitmap* aIcon, CFbsBitmap* aMask, TInt aOffsetFrame, TInt aOffsetTotal)
       
    87     {
       
    88     TRect area(ItemRect(aScreenPos, aOffsetFrame, aOffsetTotal));
       
    89     
       
    90     iDrawBufContext->SetClippingRect(iItemsRect);
       
    91     iDrawBufMaskContext->SetClippingRect(iItemsRect);
       
    92     
       
    93     BlitGraphic(area.iTl, iDrawBufContext, iDrawBufMaskContext, iAPItem, iAPItemMask, EFalse, EFalse);
       
    94 	BlitGraphic(area.iTl + TPoint(ActivePalette2Utils::APDimension(ActivePalette2Utils::EItemXOffset),0), iDrawBufContext, iDrawBufMaskContext, aIcon, aMask, ETrue, ETrue);
       
    95 
       
    96     iDrawBufMaskContext->CancelClippingRect();
       
    97     iDrawBufContext->CancelClippingRect();
       
    98 
       
    99     area.Intersection(iItemsRect);
       
   100     AddToDirtyRect(	area );
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CActivePalette2SemiTransparentStyler::DrawGap()
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 void CActivePalette2SemiTransparentStyler::DrawGap(TInt aScreenPos, TInt aOffsetFrame, TInt aOffsetTotal)
       
   108     {
       
   109     TRect area(GapRect(aScreenPos, aOffsetFrame, aOffsetTotal));
       
   110     
       
   111     iDrawBufContext->SetClippingRect(iItemsRect);
       
   112     iDrawBufMaskContext->SetClippingRect(iItemsRect);
       
   113 
       
   114     BlitGraphic(area.iTl, iDrawBufContext, iDrawBufMaskContext, iAPGap, iAPGapMask, EFalse, EFalse);
       
   115 
       
   116     iDrawBufMaskContext->CancelClippingRect();
       
   117     iDrawBufContext->CancelClippingRect();
       
   118 
       
   119     area.Intersection(iItemsRect);
       
   120     AddToDirtyRect(	area );
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CActivePalette2SemiTransparentStyler::AnimItem()
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 void CActivePalette2SemiTransparentStyler::AnimItem(TInt aScreenPos, CFbsBitmap* aIcon, CFbsBitmap* aMask)
       
   128     {
       
   129     TRect area(ItemRect(aScreenPos));
       
   130     area.iTl.iX = ActivePalette2Utils::APDimension(ActivePalette2Utils::EItemXOffset);
       
   131     area.SetWidth(ActivePalette2Utils::APDimension( ActivePalette2Utils::EItemWidth ));
       
   132 
       
   133     TRect clippingRect(TPoint(ActivePalette2Utils::APDimension(ActivePalette2Utils::EItemXOffset), 0), ActivePalette2Utils::APDimensionSize( ActivePalette2Utils::EItemSize ));
       
   134 
       
   135     iDrawBufContext->BitBlt(area.iTl, iAPItem, clippingRect);
       
   136     iDrawBufMaskContext->BitBlt(area.iTl, iAPItemMask, clippingRect);
       
   137     
       
   138 	BlitGraphic(area.iTl, iDrawBufContext, iDrawBufMaskContext, aIcon, aMask, ETrue, ETrue);
       
   139 
       
   140     AddToDirtyRect(	area );
       
   141     }
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // CActivePalette2SemiTransparentStyler::DrawTopScrollArrowSection()
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 void CActivePalette2SemiTransparentStyler::DrawTopScrollArrowSection(TBool aShowArrow)
       
   148     {
       
   149     TRect area(TopSectionRect());
       
   150     
       
   151     BlitGraphic(TPoint(0,0), iDrawBufContext, iDrawBufMaskContext, iAPTopSection, iAPTopSectionMask, EFalse, EFalse);
       
   152 
       
   153     if ( aShowArrow )
       
   154         {
       
   155         CentreGraphic(area, iDrawBufContext, iDrawBufMaskContext, iScrollUpIcon, iScrollUpIconMask, ETrue, ETrue);
       
   156         }
       
   157 
       
   158     AddToDirtyRect(	area );
       
   159     }
       
   160 
       
   161 // -----------------------------------------------------------------------------
       
   162 // CActivePalette2SemiTransparentStyler::DrawBottomScrollArrowSection()
       
   163 // -----------------------------------------------------------------------------
       
   164 //
       
   165 void CActivePalette2SemiTransparentStyler::DrawBottomScrollArrowSection(TBool aShowArrow)
       
   166     {
       
   167     TRect area(BottomSectionRect());
       
   168     
       
   169     BlitGraphic(area.iTl, iDrawBufContext, iDrawBufMaskContext, iAPBottomSection, iAPBottomSectionMask, EFalse, EFalse);
       
   170 
       
   171     if ( aShowArrow )
       
   172         {
       
   173         CentreGraphic(area, iDrawBufContext, iDrawBufMaskContext, iScrollDownIcon, iScrollDownIconMask, ETrue, ETrue);
       
   174         }
       
   175 
       
   176     AddToDirtyRect(	area );
       
   177     }
       
   178     
       
   179 // -----------------------------------------------------------------------------
       
   180 // CActivePalette2SemiTransparentStyler::TooltipNoseMaskId()
       
   181 // -----------------------------------------------------------------------------
       
   182 //
       
   183 TInt CActivePalette2SemiTransparentStyler::TooltipNoseMaskId()
       
   184     {
       
   185 #ifdef USE_OPAQUE_TOOLTIPS
       
   186     return CActivePalette2Styler::TooltipNoseMaskId();
       
   187 #else    
       
   188     return EMbmActivepalette2graphicsQgn_graf_cam4_tb_tooltip_end_mask;
       
   189 #endif    
       
   190     }
       
   191     
       
   192 // -----------------------------------------------------------------------------
       
   193 // CActivePalette2SemiTransparentStyler::TooltipBodyMaskId()
       
   194 // -----------------------------------------------------------------------------
       
   195 //
       
   196 TInt CActivePalette2SemiTransparentStyler::TooltipBodyMaskId()
       
   197     {
       
   198 #ifdef USE_OPAQUE_TOOLTIPS
       
   199     return CActivePalette2Styler::TooltipBodyMaskId();
       
   200 #else
       
   201     return EMbmActivepalette2graphicsQgn_graf_cam4_tb_tooltip_body_mask;
       
   202 #endif    
       
   203     }
       
   204 
       
   205 
       
   206 
       
   207 
       
   208