// ----------------------------------------------------
// CMyAppUi::SendToBackground()
// Send the application to background.
// ----------------------------------------------------
//
void CHelloWorldBasicAppUi::SendToBackground()
{
// Construct en empty TApaTask object
// giving it a reference to the Window Server session
TApaTask task(iEikonEnv->WsSession( ));
// Initialise the object with the window group id of
// our application (so that it represent our app)
task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
// Request window server to bring our application
// to background
task.SendToBackground();
}
// ----------------------------------------------------
// CMyAppUi::BringToForeground()
// Bring the application to foreground.
// ----------------------------------------------------
//
void CHelloWorldBasicAppUi::BringToForeground()
{
// Construct en empty TApaTask object
// giving it a reference to the Window Server session
TApaTask task(iEikonEnv->WsSession( ));
// Initialise the object with the window group id of
// our application (so that it represent our app)
task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
// Request window server to bring our application
// to foreground
task.BringToForeground();
}
// ---------------------------------------------------------
// CTextTrisContainer::HandleKeyEvent
// Translate the key events to Game specific key events.
// ---------------------------------------------------------
//
TKeyResponse CHelloWorldBasicAppUi::OfferKeyEventL( const TKeyEvent& aKeyEvent ,TEventCode aType )
{
switch( aType )
{
case( EEventKeyDown ):
{
switch( aKeyEvent.iScanCode )
{
case( 0x34 ): //For the 4 key
{
BringToForeground();
break;
}
default:
break;
}
break;
}
case( EEventKeyUp ):
{
switch( aKeyEvent.iScanCode )
{
case( 0x34 ): //For the 4 key
{
SendToBackground();
break;
}
default:
break;
}
break;
}
default:
{
break;
}
}
return EKeyWasConsumed;
}