camerauis/activepalette/Src/ActivePalette2OpaqueStyler.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:30:54 +0100
branchRCL_3
changeset 24 bac7acad7cb3
parent 0 1ddebce53859
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Active Palette Opaque Styler*
*/


/**
 * @file ActivePalette2OpaqueStyler.cpp
 * Active Palette Opaque Styler
 */

#include "ActivePalette2OpaqueStyler.h"
#include "ActivePalette2Cfg.h"
#include "ActivePalette2Utils.h"

#include <bitstd.h>
#include <gdi.h>


// -----------------------------------------------------------------------------
// CActivePalette2OpaqueStyler::NewL()
// -----------------------------------------------------------------------------
//
CActivePalette2OpaqueStyler* CActivePalette2OpaqueStyler::NewL()
    {
	CActivePalette2OpaqueStyler* self = new (ELeave) CActivePalette2OpaqueStyler();
	CleanupStack::PushL(self);
	self->ConstructL();
	CleanupStack::Pop(); // this
	return self;
    }
    
// -----------------------------------------------------------------------------
// CActivePalette2OpaqueStyler::ConstructL()
// -----------------------------------------------------------------------------
//
void CActivePalette2OpaqueStyler::ConstructL()
    {
    CActivePalette2Styler::ConstructL();
    }

// -----------------------------------------------------------------------------
// CActivePalette2OpaqueStyler::DrawItem()
// -----------------------------------------------------------------------------
//
void CActivePalette2OpaqueStyler::DrawItem(TInt aScreenPos, CFbsBitmap* aIcon, CFbsBitmap* aMask, TInt aOffsetFrame, TInt aOffsetTotal)
    {
    TRect area(ItemRect(aScreenPos, aOffsetFrame, aOffsetTotal));
    
    iDrawBufContext->SetClippingRect(iItemsRect);
    
    iDrawBufContext->SetBrushColor(TRgb(0xDDDDDD));
    iDrawBufContext->Clear(area);

	iDrawBufContext->BitBltMasked(area.iTl + TPoint(ActivePalette2Utils::APDimension(ActivePalette2Utils::EItemXOffset),0),
								 aIcon,
								 TRect(TPoint(0,0), ActivePalette2Utils::APDimensionSize( ActivePalette2Utils::EItemSize )),
								 aMask,
								 ETrue);

    iDrawBufContext->CancelClippingRect();
    
    area.Intersection(iItemsRect);
    AddToDirtyRect(	area );
    }

// -----------------------------------------------------------------------------
// CActivePalette2OpaqueStyler::DrawGap()
// -----------------------------------------------------------------------------
//
void CActivePalette2OpaqueStyler::DrawGap(TInt aScreenPos, TInt aOffsetFrame, TInt aOffsetTotal)
    {
    TRect area(GapRect(aScreenPos, aOffsetFrame, aOffsetTotal));
    
    iDrawBufContext->SetClippingRect(iItemsRect);

    iDrawBufContext->SetBrushColor(TRgb(0xCCCCCC));
    iDrawBufContext->Clear(area);

    iDrawBufContext->CancelClippingRect();

    area.Intersection(iItemsRect);
    AddToDirtyRect(	area );
    }

// -----------------------------------------------------------------------------
// CActivePalette2OpaqueStyler::AnimItem()
// -----------------------------------------------------------------------------
//
void CActivePalette2OpaqueStyler::AnimItem(TInt aScreenPos, CFbsBitmap* aIcon, CFbsBitmap* aMask)
    {
    TRect area(ItemRect(aScreenPos));
    area.iTl.iX = ActivePalette2Utils::APDimension(ActivePalette2Utils::EItemXOffset);
    area.SetWidth(ActivePalette2Utils::APDimension( ActivePalette2Utils::EItemWidth ));
    
    iDrawBufContext->SetBrushColor(TRgb(0xDDDDDD));
    iDrawBufContext->Clear(area);

	iDrawBufContext->BitBltMasked(area.iTl,
								 aIcon,
								 TRect(TPoint(0,0), area.Size()),
								 aMask,
								 ETrue);

    AddToDirtyRect(	area );
    }

// -----------------------------------------------------------------------------
// CActivePalette2OpaqueStyler::DrawTopScrollArrowSection()
// -----------------------------------------------------------------------------
//
void CActivePalette2OpaqueStyler::DrawTopScrollArrowSection(TBool aShowArrow)
    {
    TRect area(TopSectionRect());
    
    iDrawBufContext->SetBrushColor(TRgb(0x8888FF));
    iDrawBufContext->Clear(area);

    if ( aShowArrow )
        {
        CentreGraphic(area, iDrawBufContext, iDrawBufMaskContext, iScrollUpIcon, iScrollUpIconMask, ETrue, ETrue);
        }

    AddToDirtyRect(	area );
    }

// -----------------------------------------------------------------------------
// CActivePalette2OpaqueStyler::DrawBottomScrollArrowSection()
// -----------------------------------------------------------------------------
//
void CActivePalette2OpaqueStyler::DrawBottomScrollArrowSection(TBool aShowArrow)
    {
    TRect area(BottomSectionRect());
    
    iDrawBufContext->SetBrushColor(TRgb(0xFF8888));
    iDrawBufContext->Clear(area);

    if ( aShowArrow )
        {
        CentreGraphic(area, iDrawBufContext, iDrawBufMaskContext, iScrollDownIcon, iScrollDownIconMask, ETrue, ETrue);
        }

    AddToDirtyRect(	area );
    }