⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myappui.cpp

📁 &#8226 Symbian OS basics, Memory Management, Descriptors, Application Structure, Client-Server, Act
💻 CPP
字号:

// INCLUDE FILES
#include "MyAppUi.h"
#include <MyApp.rsg>
#include "MyApp.hrh"
#include <eikenv.h>
#include <AknGlobalNote.h>

#include "MyViews.h"
#include "MyEngine.h"

// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CMyAppUi::ConstructL()
// ?implementation_description
// ----------------------------------------------------------
//
void CMyAppUi::ConstructL()
    {
    BaseConstructL();

	// engine
	iEngine = new (ELeave) CMyEngine();
	iEngine->ConstructL();

	// view stuff
	CMyViewOne* myAppViewOne = CMyViewOne::NewL();
	AddViewL(myAppViewOne);

	CMyViewTwo* myAppViewTwo = CMyViewTwo::NewL();
	AddViewL(myAppViewTwo);

	SetDefaultViewL(*myAppViewOne);
    }

// ----------------------------------------------------
// CMyAppUi::~CMyAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CMyAppUi::~CMyAppUi()
    {
	delete iEngine;

   }


// ----------------------------------------------------
// CMyAppUi::HandleKeyEventL(
//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// ?implementation_description
// ----------------------------------------------------
//
TKeyResponse CMyAppUi::HandleKeyEventL(
    const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
    {
    return EKeyWasNotConsumed;
    }


void CMyAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
        case EMyAppCmdMessageType1:
            {
			CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
			globalNote->ShowNoteL(EAknGlobalInformationNote, _L("Information Note"));
			CleanupStack::PopAndDestroy();
			break;
			}
        case EMyAppCmdViewOne:
            {
            iEikonEnv->InfoMsg(_L("View One"));
			TVwsViewId id(KUidMyApp, KUidMyAppViewOne);
			ActivateViewL(id);
            break;
            }
       case EMyAppCmdViewTwo:
            {
            iEikonEnv->InfoMsg(_L("View Two"));
			TVwsViewId id(KUidMyApp, KUidMyAppViewTwo);
			ActivateViewL(id);
            break;
            }
	   case EAknSoftkeyBack:
	   case EEikCmdExit:
		   Exit();
		   break;

       default:
            break;
       }
    }

CMyEngine* CMyAppUi::GetEngine()
	{
	return iEngine;
	}

// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -