os/graphics/graphicstest/uibench/s60/src/windows/tsmallwindowzoom.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 /**
    17  @file
    18  @test
    19  @internalComponent - Internal Symbian test code 
    20 */
    21 
    22 #include "tsmallwindowzoom.h"
    23 
    24 
    25 const TRect KMinimumZoomRect(TSize(20, 20));
    26 
    27 CTSmallWindowZoom::CTSmallWindowZoom(const TPoint& aStartingPoint, const TSize& aWindowSize):
    28         CTSmallWindowRaster(aStartingPoint, aWindowSize)
    29 	{
    30 	// empty
    31 	}
    32 
    33 CTSmallWindowZoom::~CTSmallWindowZoom()
    34 	{
    35 	// empty
    36 	}
    37 
    38 CTWindow* CTSmallWindowZoom::NewL(RWsSession &aWs, 
    39 		const RWindowTreeNode &aParent, 
    40 		const TPoint& aStartingPoint,
    41 		const TSize& aWindowSize)
    42 	{
    43 	CTSmallWindowZoom* self = new (ELeave)CTSmallWindowZoom(aStartingPoint, aWindowSize);
    44 	CleanupStack::PushL(self);
    45     self->ConstructL(aWs, aParent);
    46     CleanupStack::Pop(self);
    47 	return self;
    48 	}
    49 
    50 void CTSmallWindowZoom::ConstructL(RWsSession &aWs, const RWindowTreeNode &aParent)
    51 	{
    52 	CTSmallWindowRaster::ConstructL(aWs, aParent);
    53 	iDelta = 1;
    54 	iZoom = EZoomIn;
    55 	}
    56 
    57 void CTSmallWindowZoom::LoadL(CSurfaceUtility* aUtility, TPtrC aFileName)
    58 	{
    59 	CTSmallWindowRaster::LoadL(aUtility, aFileName);
    60     iZoomRect = iSourceRect;
    61 	}
    62 
    63 void CTSmallWindowZoom::RenderL()
    64 	{
    65 	CTWindow::RenderL();
    66 	if (iLoaded)
    67 	    {
    68 	    DrawBitmap(iZoomRect);
    69 	    if (iZoom == EZoomIn)
    70             {
    71             iZoomRect.Shrink(iDelta, iDelta);
    72             if (iZoomRect.Width() <= KMinimumZoomRect.Width())
    73                 {
    74                 iZoom = EZoomOut;
    75                 }
    76             }
    77         else 
    78             {
    79             iZoomRect.Grow(iDelta, iDelta);
    80             if (iZoomRect.Width() >= iSourceRect.Width())
    81                 {
    82                 iZoom = EZoomIn;
    83                 }
    84             }
    85 	    }
    86         
    87     
    88 	}