sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: /**
sl@0:  @file
sl@0:  @test
sl@0:  @internalComponent
sl@0: */
sl@0: 
sl@0: #include <eikenv.h>
sl@0: #include <eikmenup.h>
sl@0: #include <t_app1.rsg>
sl@0: #include "t_app1view.h"
sl@0: #include "t_app1eng.h"
sl@0: 
sl@0: /**
sl@0:  *	Private constructor, does nothing	
sl@0:  *
sl@0:  */  
sl@0: CTApp1View::CTApp1View()
sl@0: 	{
sl@0: 	}
sl@0: 	
sl@0: /**
sl@0:  *	Standard 2 phase construction, constructs a View object
sl@0:  *	@return pointer to the  CTApp1View
sl@0:  *	@param aRect - rectangle coordinate defining control's extent
sl@0:  */  
sl@0:  CTApp1View* CTApp1View::NewL(const TRect& aRect)
sl@0: 	{
sl@0: 	CTApp1View* self = new(ELeave) CTApp1View();
sl@0: 	CleanupStack::PushL(self);
sl@0: 	self->ConstructL(aRect);
sl@0: 	CleanupStack::Pop();
sl@0: 	return self;
sl@0: 	}
sl@0: 	
sl@0: /**
sl@0:  *	
sl@0:  *	Destructor
sl@0:  */  
sl@0: CTApp1View::~CTApp1View()
sl@0: 	{
sl@0: 	delete iTApp1Text;
sl@0: 	iTApp1Text = NULL;
sl@0: 	delete iEng;
sl@0: 	iEng = NULL;
sl@0: 	}
sl@0: 	
sl@0: /**
sl@0:  *	constructL method
sl@0:  *	@param aRect - rectangle coordinate defining control's extent
sl@0:  *	
sl@0:  */  
sl@0: void CTApp1View::ConstructL(const TRect& aRect)
sl@0:     {
sl@0: 	iTApp1Text = iEikonEnv->AllocReadResourceL(R_EXAMPLE_TEXT_TITLE);
sl@0: 	
sl@0: 	CreateWindowL();
sl@0: 	iEng = CTApp1Eng::NewL(iEikonEnv->WsSession(), 
sl@0:                       *(CCoeEnv::Static()->ScreenDevice()), 
sl@0: 					  Window());
sl@0: 	SetRect(aRect);
sl@0: 	ActivateL();
sl@0: 	}
sl@0: 	
sl@0: /**
sl@0:  *	
sl@0:  *	Draws the text on the screen
sl@0:  *	
sl@0:  */  
sl@0: void CTApp1View::Draw(const TRect& /*aRect*/) const
sl@0: 	{
sl@0: 	if(iEng->Drawing())
sl@0: 		{
sl@0:         return;
sl@0: 		}
sl@0: 	
sl@0: 	iEng->StartDrawing();
sl@0: 	}