os/graphics/windowing/windowserver/test/t_integ/src/t_pseudoappui.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/t_integ/src/t_pseudoappui.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,115 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent
    1.23 +*/
    1.24 +
    1.25 +#include <apgtask.h>
    1.26 +#include <eikenv.h>
    1.27 +#include <eikmenup.h>
    1.28 +#include <eikstart.h>
    1.29 +
    1.30 +#include "t_pseudoappeng.h"
    1.31 +#include "t_pseudoappview.h"
    1.32 +#include "t_pseudoapp.h"
    1.33 +#include "t_pseudoappui.h"
    1.34 +
    1.35 +//
    1.36 +// CPseudoAppUi
    1.37 +//
    1.38 +
    1.39 +/**
    1.40 + *	constructL method that creates the AppView object
    1.41 + *
    1.42 + */
    1.43 +void CPseudoAppUi::ConstructL()
    1.44 +    {
    1.45 +	RDebug::Print(_L("Create App Framework\n"));
    1.46 +
    1.47 +    BaseConstructL();
    1.48 +#ifndef T_PSEUDOAPP1
    1.49 +	iAppView = CPseudoAppView::NewL(ClientRect());
    1.50 +#else
    1.51 +	// t_pseudoapp1 is used in a test that displays two animations on one screen.
    1.52 +	// Window dimensions and positions chosen such that both animations are visible.
    1.53 +	TSize sz = ClientRect().Size();
    1.54 +    TRect rect(sz.iWidth/2, sz.iHeight/2, sz.iWidth, sz.iHeight);
    1.55 +	iAppView = CPseudoAppView::NewL(rect);
    1.56 +#endif //T_PSEUDOAPP1
    1.57 +
    1.58 +	//Detect screen rotations
    1.59 +	iCoeEnv->RootWin().EnableScreenChangeEvents();
    1.60 +	}
    1.61 +
    1.62 +/**
    1.63 + *	Destructor
    1.64 + *
    1.65 + */
    1.66 +CPseudoAppUi::~CPseudoAppUi()
    1.67 +	{
    1.68 +	delete iAppView;
    1.69 +	}
    1.70 +
    1.71 +/**
    1.72 + *	Handles the Menu events
    1.73 + *	@param aCommand - command to be passed based on the menu item
    1.74 + *						selected by the user
    1.75 + *
    1.76 + */
    1.77 +void CPseudoAppUi::HandleCommandL(TInt aCommand)
    1.78 +	{
    1.79 +	switch (aCommand)
    1.80 +		{
    1.81 +		case EEikCmdExit:
    1.82 +			{
    1.83 +			Exit();
    1.84 +			break;
    1.85 +			}
    1.86 +		default:
    1.87 +			{
    1.88 +			User::Leave(KErrAbort);
    1.89 +			break;
    1.90 +			}
    1.91 +		}
    1.92 +	}
    1.93 +
    1.94 +/**
    1.95 + *	Handles system events
    1.96 + *	@param aEvent - event that has to be handled by the function
    1.97 + *
    1.98 + */
    1.99 +void CPseudoAppUi::HandleSystemEventL(const TWsEvent& aEvent)
   1.100 +	{
   1.101 +	switch (*(TApaSystemEvent*)(aEvent.EventData()))
   1.102 +		{
   1.103 +		case EApaSystemEventBroughtToForeground:
   1.104 +			RProcess::Rendezvous(KErrNone);
   1.105 +			break;
   1.106 +         default:
   1.107 +			break;
   1.108 +		}
   1.109 +	}
   1.110 +
   1.111 +void CPseudoAppUi::HandleScreenDeviceChangedL()
   1.112 +	{
   1.113 +	//The function called after a screen rotation event occurs
   1.114 +	//Only rotation of one screen supported
   1.115 +	iAppView->RotateL();
   1.116 +	}
   1.117 +
   1.118 +