helloworldappui.cpp

来自「symbian平台helloword 的例子。」· C++ 代码 · 共 91 行

CPP
91
字号
/**
* 
* @brief Definition of CHelloWorldAppUi
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

// INCLUDE FILES

// Class include
#include "HelloWorldAppUi.h"

// System includes
//#include <avkon.hrh>
#include <aknnotewrappers.h>	// CAknInformationNote
#include <helloworld.rsg>		// R_DIALOG_TEXT
#include <stringloader.h>		// StringLoader

// User includes
#include "HelloWorld.hrh"			// Command IDs.
#include "HelloWorldContainer.h"	// CHelloWorldContainer

// ================= MEMBER FUNCTIONS =======================

/**
* Symbian OS 2nd phase constructor.  Constructs the application's container, 
* setting itself as the container's MOP parent, and adds it to the control 
* stack.
*/		
void CHelloWorldAppUi::ConstructL()
	{
	BaseConstructL();
	iAppContainer = CHelloWorldContainer::NewL(ClientRect());
	iAppContainer->SetMopParent(this);
	AddToStackL(iAppContainer);
	}

/**
* Destructor.
* Removes the application's container from the stack and deletes it.
*/	
CHelloWorldAppUi::~CHelloWorldAppUi()
	{
	if (iAppContainer)
		{
		RemoveFromStack(iAppContainer);
		delete iAppContainer;
		}
	}

/**
* From CEikAppUi, takes care of command handling.
*
* @param aCommand command to be handled
*/
void CHelloWorldAppUi::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
        case EEikCmdExit:
        case EAknSoftkeyExit:
			{
			Exit();
			break;
			}
        case EHelloWorldCommand1:
            {
			HBufC* message = StringLoader::LoadLC(R_DIALOG_TEXT);	// Pushes message onto the Cleanup Stack.

            CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
            informationNote->ExecuteLD(*message);
			
			CleanupStack::PopAndDestroy(message);	// Removes message from the Cleanup Stack.
			break;
            }
            
        // TODO: Add your command handling code here
		default:
			{
			// Abort application if we don't recognize the command
			_LIT(applicationName, "HelloWorld");
			User::Panic(applicationName, KErrUnknown);
			break;
			}
			
		}
	}

// End of File	

⌨️ 快捷键说明

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