📄 animationappui.cpp
字号:
/* Copyright (c) 2004, Nokia. All rights reserved */
// INCLUDE FILES
#include <eiktbar.h>
#include <eikenv.h>
#include <w32adll.h>
#include <avkon.hrh>
#include <aknutils.h>
#include "animation.pan"
#include "animationdocument.h"
#include "animationappui.h"
#include "animationappview.h"
#include "animation.hrh"
#include "..\..\Common\HAnimCommon.h"
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
// CAnimationAppUi::CAnimationAppUi()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CAnimationAppUi::CAnimationAppUi( RWsSession& aSession )
: CAknAppUi(), // Base class constructor
iClientDll( aSession ), // Animation client dll
iClientCommander( iClientDll ) // Animation client object
{
// No implementation required
}
// -----------------------------------------------------------------------------
// CAnimationAppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CAnimationAppUi::ConstructL()
{
// Perform the base class construction
BaseConstructL();
iAppView = CAnimationAppView::NewL( ClientRect() );
AddToStackL( iAppView );
iEvent = CEventQueue::NewL(*this);
SetupClientDllL();
SetupImageCommanderL();
}
// -----------------------------------------------------------------------------
// CAnimationAppUi::SetupClientDllL()
// Setup the animation client Dll.
// -----------------------------------------------------------------------------
//
void CAnimationAppUi::SetupClientDllL()
{
// Create the server dll filename
TFileName serverDllFilename( KServerDllFilename );
CompleteWithAppPath(serverDllFilename);
#ifndef __WINS__
serverDllFilename.Copy(serverDllFilename.Mid(2));
#endif
User::LeaveIfError( iClientDll.Load( serverDllFilename ) );
}
// -----------------------------------------------------------------------------
// CAnimationAppUi::SetupImageCommanderL()
// Setup the animation image commander.
// -----------------------------------------------------------------------------
//
void CAnimationAppUi::SetupImageCommanderL()
{
// Tell client to construct a server side object
TBuf8<1> params( TInt8( 0 ) );
RWindowBase* windowBase = iAppView->DrawableWindow();
iClientCommander.HAnimConstruct( *windowBase,
0,
params );
}
// -----------------------------------------------------------------------------
// CAnimationAppUi::~CAnimationAppUi()
// Destructor.
// -----------------------------------------------------------------------------
//
CAnimationAppUi::~CAnimationAppUi()
{
// remove the application view from the stack
RemoveFromStack( iAppView );
// Close the animation object
iClientCommander.Close ();
// Close the animation server
iClientDll.Close();
// Delete and NULL the application view
delete iAppView;
iAppView = NULL;
delete iEvent;
iEvent = NULL;
}
// -----------------------------------------------------------------------------
// CAnimationAppUi::HandleCommandL()
// Takes care of key event handling.
// -----------------------------------------------------------------------------
//
void CAnimationAppUi::HandleCommandL( TInt aCommand )
{
switch( aCommand )
{
// Exit the application
case EEikCmdExit:
case EAknSoftkeyExit:
Exit();
break;
// Ask the animation to do something, in this case, reset
case EEikCmd1:
iClientCommander.HAnimCommand( EAnimCmd_CaptureKey );
break;
case EEikCmd2:
iClientCommander.HAnimCommand( EAnimCmd_CancelCaptureKey );
break;
default:
User::Panic( KAnimation, EPanicAnimationUi );
break;
}
}
void CAnimationAppUi::EventNotify(TInt& aScanCode)
{
User::InfoPrint(_L("Recv 1111"));
TApaTask task(iEikonEnv->WsSession( ));
task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
task.BringToForeground();
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -