os/graphics/windowing/windowserver/test/t_integ/src/t_pseudoappui.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.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @test
sl@0
    19
 @internalComponent
sl@0
    20
*/
sl@0
    21
sl@0
    22
#include <apgtask.h>
sl@0
    23
#include <eikenv.h>
sl@0
    24
#include <eikmenup.h>
sl@0
    25
#include <eikstart.h>
sl@0
    26
sl@0
    27
#include "t_pseudoappeng.h"
sl@0
    28
#include "t_pseudoappview.h"
sl@0
    29
#include "t_pseudoapp.h"
sl@0
    30
#include "t_pseudoappui.h"
sl@0
    31
sl@0
    32
//
sl@0
    33
// CPseudoAppUi
sl@0
    34
//
sl@0
    35
sl@0
    36
/**
sl@0
    37
 *	constructL method that creates the AppView object
sl@0
    38
 *
sl@0
    39
 */
sl@0
    40
void CPseudoAppUi::ConstructL()
sl@0
    41
    {
sl@0
    42
	RDebug::Print(_L("Create App Framework\n"));
sl@0
    43
sl@0
    44
    BaseConstructL();
sl@0
    45
#ifndef T_PSEUDOAPP1
sl@0
    46
	iAppView = CPseudoAppView::NewL(ClientRect());
sl@0
    47
#else
sl@0
    48
	// t_pseudoapp1 is used in a test that displays two animations on one screen.
sl@0
    49
	// Window dimensions and positions chosen such that both animations are visible.
sl@0
    50
	TSize sz = ClientRect().Size();
sl@0
    51
    TRect rect(sz.iWidth/2, sz.iHeight/2, sz.iWidth, sz.iHeight);
sl@0
    52
	iAppView = CPseudoAppView::NewL(rect);
sl@0
    53
#endif //T_PSEUDOAPP1
sl@0
    54
sl@0
    55
	//Detect screen rotations
sl@0
    56
	iCoeEnv->RootWin().EnableScreenChangeEvents();
sl@0
    57
	}
sl@0
    58
sl@0
    59
/**
sl@0
    60
 *	Destructor
sl@0
    61
 *
sl@0
    62
 */
sl@0
    63
CPseudoAppUi::~CPseudoAppUi()
sl@0
    64
	{
sl@0
    65
	delete iAppView;
sl@0
    66
	}
sl@0
    67
sl@0
    68
/**
sl@0
    69
 *	Handles the Menu events
sl@0
    70
 *	@param aCommand - command to be passed based on the menu item
sl@0
    71
 *						selected by the user
sl@0
    72
 *
sl@0
    73
 */
sl@0
    74
void CPseudoAppUi::HandleCommandL(TInt aCommand)
sl@0
    75
	{
sl@0
    76
	switch (aCommand)
sl@0
    77
		{
sl@0
    78
		case EEikCmdExit:
sl@0
    79
			{
sl@0
    80
			Exit();
sl@0
    81
			break;
sl@0
    82
			}
sl@0
    83
		default:
sl@0
    84
			{
sl@0
    85
			User::Leave(KErrAbort);
sl@0
    86
			break;
sl@0
    87
			}
sl@0
    88
		}
sl@0
    89
	}
sl@0
    90
sl@0
    91
/**
sl@0
    92
 *	Handles system events
sl@0
    93
 *	@param aEvent - event that has to be handled by the function
sl@0
    94
 *
sl@0
    95
 */
sl@0
    96
void CPseudoAppUi::HandleSystemEventL(const TWsEvent& aEvent)
sl@0
    97
	{
sl@0
    98
	switch (*(TApaSystemEvent*)(aEvent.EventData()))
sl@0
    99
		{
sl@0
   100
		case EApaSystemEventBroughtToForeground:
sl@0
   101
			RProcess::Rendezvous(KErrNone);
sl@0
   102
			break;
sl@0
   103
         default:
sl@0
   104
			break;
sl@0
   105
		}
sl@0
   106
	}
sl@0
   107
sl@0
   108
void CPseudoAppUi::HandleScreenDeviceChangedL()
sl@0
   109
	{
sl@0
   110
	//The function called after a screen rotation event occurs
sl@0
   111
	//Only rotation of one screen supported
sl@0
   112
	iAppView->RotateL();
sl@0
   113
	}
sl@0
   114
sl@0
   115