helloworldlocappui.cpp

来自「series60 应用程序开发的源代码 series60 应用程序开发的源代码」· C++ 代码 · 共 89 行

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


// Class includes
#include "HelloWorldLocAppUi.h"

// System Includes
#include <avkon.hrh>
#include <aknnotewrappers.h>
#include <stringloader.h>

// User includes
#include "HelloWorldLocContainer.h" // CHelloWorldLocContainer
#include "HelloWorldLoc.hrh"
#include <HelloWorldLoc.rsg> // Resource IDs



// ================= 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 CHelloWorldLocAppUi::ConstructL()
{
    BaseConstructL();
    iAppContainer = CHelloWorldLocContainer::NewL(ClientRect());
    iAppContainer->SetMopParent(this);
    AddToStackL(iAppContainer);
}

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

/**
* From CEikAppUi, takes care of command handling.
*
* @param aCommand command to be handled
*/
void CHelloWorldLocAppUi::HandleCommandL(TInt aCommand)
{
    switch (aCommand)
    {
        case EAknSoftkeyExit:
        case EEikCmdExit:
        {
            Exit();
            break;
        }
        case EHelloWorldLocCommand1:
        {
            // load a string from the resource file and display it
            HBufC* textCommand = StringLoader::LoadLC(R_COMMAND1_STRING_RESOURCE);
            CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
            informationNote->ExecuteLD(textCommand->Des());
            CleanupStack::PopAndDestroy(textCommand);
            break;
        }
        default:
        {
            // abort application if we don't recognize the command
            HBufC* textPanic = StringLoader::LoadLC(R_PANIC1_STRING_RESOURCE);
            User::Panic(textPanic->Des(), KErrUnknown);
            CleanupStack::PopAndDestroy(textPanic);
        }
            break;
    }
}

// End of File

⌨️ 快捷键说明

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