?? s60testappui.cpp
字號:
#include <avkon.hrh>
#include <aknnotewrappers.h>
#include <eikmenup.h>
#include "S60Test.pan"
#include "S60TestDocument.h"
#include "S60TestAppUi.h"
#include "S60TestAppView.h"
#include "S60Test.hrh"
#include "Step6.rsg"
void CS60TestAppUi::ConstructL()
{
BaseConstructL();
iEngine=CS60TestEngine::NewL(iDoc);
iAppView=CS60TestAppView::NewL(ClientRect(), iDoc, iEngine);
AddToStackL(iAppView);
}
CS60TestAppUi::CS60TestAppUi(CS60TestDocument *aDoc)
:iEngine(NULL)
{
iDoc=aDoc;
}
CS60TestAppUi::~CS60TestAppUi()
{
if (iAppView)
{
RemoveFromStack(iAppView);
delete iAppView;
iAppView = NULL;
}
delete iEngine;
}
void CS60TestAppUi::UpdateBoard()
{
iAppView->DrawDeferred();
}
void CS60TestAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane)
{
if (aResourceId==R_S60TEST_MENU)
{
if (iEngine->iPauseRef>0)
aMenuPane->SetItemTextL(ES60TestPause, R_MENU_UNPAUSE_TITLE);
else aMenuPane->SetItemTextL(ES60TestPause, R_MENU_PAUSE_TITLE);
}
}
// handle any menu commands
void CS60TestAppUi::HandleCommandL(TInt aCommand)
{
switch(aCommand)
{
case EEikCmdExit:
case EAknSoftkeyExit:
Exit();
break;
case ES60TestNewGame:
iDoc->Reset();
iEngine->Reset();
UpdateBoard();
break;
case ES60TestPause:
if (iEngine->iPauseRef>0) iEngine->Unpause();
else iEngine->Pause();
break;
default:
Panic(ES60TestBasicUi);
break;
}
}
TKeyResponse CS60TestAppUi::HandleKeyEventL(const TKeyEvent &aKeyEvent,
TEventCode aType)
{
if (aType==EEventKey)
{
if (aKeyEvent.iCode==EKeyUpArrow)
iEngine->KeyRotate(1);
if (aKeyEvent.iCode==EKeyDownArrow)
iEngine->KeyDrop();
if (aKeyEvent.iCode==EKeyLeftArrow)
iEngine->KeyLeft();
if (aKeyEvent.iCode==EKeyRightArrow)
iEngine->KeyRight();
if (aKeyEvent.iCode=='1')
iEngine->KeyRotate(-1);
if (aKeyEvent.iCode=='0' || aKeyEvent.iCode=='3')
iEngine->KeyRotate(1);
}
return EKeyWasNotConsumed;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -