TetrisAppUi.cpp
上传用户:snevogroup
上传日期:2008-06-06
资源大小:432k
文件大小:1k
- #include <avkon.hrh>
- #include "TetrisAppUi.h"
- #include "TetrisContainer.h"
- #include "Tetris.hrh"
- #include <Tetris.rsg>
- // Constuct and destruct
- // ConstructL()
- void CTetrisAppUi::ConstructL()
- {
- BaseConstructL();
- iAppContainer= new (ELeave) CTetrisContainer(iDocument);
- iAppContainer->ConstructL( ClientRect() );
- AddToStackL(iAppContainer);
- }
- // CTetrisAppUi()
- CTetrisAppUi::CTetrisAppUi(CTetrisDocument* aDocument) : iDocument(aDocument)
- {
- }
- // ~CTetrisAppUi()
- CTetrisAppUi::~CTetrisAppUi()
- {
- if(iAppContainer)
- {
- RemoveFromStack(iAppContainer);
- delete iAppContainer;
- }
- }
- ////////////////////////////////////////////////////////////////
- // Method
- // HandleCommandL()
- void CTetrisAppUi::HandleCommandL(TInt aCommand)
- {
- switch(aCommand)
- {
- case EEikCmdExit:
- case EAknSoftkeyExit:
- {
- iAppContainer->Command('q');
- }break;
-
- default:
- {}break;
- }
- }
- // HandleKeyEventL()
- TKeyResponse CTetrisAppUi::HandleKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType)
- {
- if(aType == EEventKey)
- {
- iAppContainer->Command(aKeyEvent.iCode);
- }
- return EKeyWasNotConsumed;
- }
- void CTetrisAppUi::Quit()
- {
- Exit();
- }