camerauis/activepalette/Src/ActivePalette2OpaqueStyler.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 Opaque Styler*
       
    15 */
       
    16 
       
    17 
       
    18 /**
       
    19  * @file ActivePalette2OpaqueStyler.cpp
       
    20  * Active Palette Opaque Styler
       
    21  */
       
    22 
       
    23 #include "ActivePalette2OpaqueStyler.h"
       
    24 #include "ActivePalette2Cfg.h"
       
    25 #include "ActivePalette2Utils.h"
       
    26 
       
    27 #include <bitstd.h>
       
    28 #include <gdi.h>
       
    29 
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CActivePalette2OpaqueStyler::NewL()
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CActivePalette2OpaqueStyler* CActivePalette2OpaqueStyler::NewL()
       
    36     {
       
    37 	CActivePalette2OpaqueStyler* self = new (ELeave) CActivePalette2OpaqueStyler();
       
    38 	CleanupStack::PushL(self);
       
    39 	self->ConstructL();
       
    40 	CleanupStack::Pop(); // this
       
    41 	return self;
       
    42     }
       
    43     
       
    44 // -----------------------------------------------------------------------------
       
    45 // CActivePalette2OpaqueStyler::ConstructL()
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 void CActivePalette2OpaqueStyler::ConstructL()
       
    49     {
       
    50     CActivePalette2Styler::ConstructL();
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CActivePalette2OpaqueStyler::DrawItem()
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 void CActivePalette2OpaqueStyler::DrawItem(TInt aScreenPos, CFbsBitmap* aIcon, CFbsBitmap* aMask, TInt aOffsetFrame, TInt aOffsetTotal)
       
    58     {
       
    59     TRect area(ItemRect(aScreenPos, aOffsetFrame, aOffsetTotal));
       
    60     
       
    61     iDrawBufContext->SetClippingRect(iItemsRect);
       
    62     
       
    63     iDrawBufContext->SetBrushColor(TRgb(0xDDDDDD));
       
    64     iDrawBufContext->Clear(area);
       
    65 
       
    66 	iDrawBufContext->BitBltMasked(area.iTl + TPoint(ActivePalette2Utils::APDimension(ActivePalette2Utils::EItemXOffset),0),
       
    67 								 aIcon,
       
    68 								 TRect(TPoint(0,0), ActivePalette2Utils::APDimensionSize( ActivePalette2Utils::EItemSize )),
       
    69 								 aMask,
       
    70 								 ETrue);
       
    71 
       
    72     iDrawBufContext->CancelClippingRect();
       
    73     
       
    74     area.Intersection(iItemsRect);
       
    75     AddToDirtyRect(	area );
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CActivePalette2OpaqueStyler::DrawGap()
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 void CActivePalette2OpaqueStyler::DrawGap(TInt aScreenPos, TInt aOffsetFrame, TInt aOffsetTotal)
       
    83     {
       
    84     TRect area(GapRect(aScreenPos, aOffsetFrame, aOffsetTotal));
       
    85     
       
    86     iDrawBufContext->SetClippingRect(iItemsRect);
       
    87 
       
    88     iDrawBufContext->SetBrushColor(TRgb(0xCCCCCC));
       
    89     iDrawBufContext->Clear(area);
       
    90 
       
    91     iDrawBufContext->CancelClippingRect();
       
    92 
       
    93     area.Intersection(iItemsRect);
       
    94     AddToDirtyRect(	area );
       
    95     }
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CActivePalette2OpaqueStyler::AnimItem()
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 void CActivePalette2OpaqueStyler::AnimItem(TInt aScreenPos, CFbsBitmap* aIcon, CFbsBitmap* aMask)
       
   102     {
       
   103     TRect area(ItemRect(aScreenPos));
       
   104     area.iTl.iX = ActivePalette2Utils::APDimension(ActivePalette2Utils::EItemXOffset);
       
   105     area.SetWidth(ActivePalette2Utils::APDimension( ActivePalette2Utils::EItemWidth ));
       
   106     
       
   107     iDrawBufContext->SetBrushColor(TRgb(0xDDDDDD));
       
   108     iDrawBufContext->Clear(area);
       
   109 
       
   110 	iDrawBufContext->BitBltMasked(area.iTl,
       
   111 								 aIcon,
       
   112 								 TRect(TPoint(0,0), area.Size()),
       
   113 								 aMask,
       
   114 								 ETrue);
       
   115 
       
   116     AddToDirtyRect(	area );
       
   117     }
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CActivePalette2OpaqueStyler::DrawTopScrollArrowSection()
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 void CActivePalette2OpaqueStyler::DrawTopScrollArrowSection(TBool aShowArrow)
       
   124     {
       
   125     TRect area(TopSectionRect());
       
   126     
       
   127     iDrawBufContext->SetBrushColor(TRgb(0x8888FF));
       
   128     iDrawBufContext->Clear(area);
       
   129 
       
   130     if ( aShowArrow )
       
   131         {
       
   132         CentreGraphic(area, iDrawBufContext, iDrawBufMaskContext, iScrollUpIcon, iScrollUpIconMask, ETrue, ETrue);
       
   133         }
       
   134 
       
   135     AddToDirtyRect(	area );
       
   136     }
       
   137 
       
   138 // -----------------------------------------------------------------------------
       
   139 // CActivePalette2OpaqueStyler::DrawBottomScrollArrowSection()
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 void CActivePalette2OpaqueStyler::DrawBottomScrollArrowSection(TBool aShowArrow)
       
   143     {
       
   144     TRect area(BottomSectionRect());
       
   145     
       
   146     iDrawBufContext->SetBrushColor(TRgb(0xFF8888));
       
   147     iDrawBufContext->Clear(area);
       
   148 
       
   149     if ( aShowArrow )
       
   150         {
       
   151         CentreGraphic(area, iDrawBufContext, iDrawBufMaskContext, iScrollDownIcon, iScrollDownIconMask, ETrue, ETrue);
       
   152         }
       
   153 
       
   154     AddToDirtyRect(	area );
       
   155     }
       
   156