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

📄 chinesedisplayappui.cpp

📁 This C++ application demonstrates how to display Chinese characters from resource files. The applica
💻 CPP
字号:
/*
* ============================================================================
*  Name     : ChineseDisplayAppUi from ChineseDisplayAppUi.cpp
*  Part of  : ChineseDisplay
*  Created  : 18.3.2003 by Forum Nokia
*  Implementation notes:
*  Version  :
*  Copyright: Nokia Corporation, 2003
* ============================================================================
*/

#include <aknnotewrappers.h>
#include <hlplch.h>
#include <avkon.hrh>
#include <ChineseDisplay.rsg>

#include "ChineseDisplayAppUi.h"
#include "ChineseDisplayContainer.h" 
#include "ChineseDisplay.hrh"
#include "ChineseDisplayApp.h"
#include "..\help\ChineseDisplay.hlp.hrh"

// ----------------------------------------------------------
// ChineseDisplayAppAppUi::ConstructL()
// Second-phase constructor
// ----------------------------------------------------------
//
void CChineseDisplayAppUi::ConstructL()
    {
    BaseConstructL( );
    iAppContainer = new (ELeave) CChineseDisplayContainer;
    iAppContainer->SetMopParent( this );
    iAppContainer->ConstructL( ClientRect() );
    AddToStackL( iAppContainer );
    }

// ----------------------------------------------------
// ChineseDisplayAppAppUi::~ChineseDisplayAppAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CChineseDisplayAppUi::~CChineseDisplayAppUi()
    {
    if ( iAppContainer )
        {
        RemoveFromStack( iAppContainer );
        delete iAppContainer;
        }
   }

// ------------------------------------------------------------------------------
// ChineseDisplayAppAppUi::::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
//  This function is called by the EIKON framework just before it displays
//  a menu pane. Its default implementation is empty, and by overriding it,
//  the application can set the state of menu items dynamically according
//  to the state of application data.
// ------------------------------------------------------------------------------
//
void CChineseDisplayAppUi::DynInitMenuPaneL(
    TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
    {
    }

// ----------------------------------------------------
// ChineseDisplayAppAppUi::HandleKeyEventL(
//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// Handles the key events
// ----------------------------------------------------
//
TKeyResponse CChineseDisplayAppUi::HandleKeyEventL(
    const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
    {
    return EKeyWasNotConsumed;
    }

// ----------------------------------------------------
// ChineseDisplayAppAppUi::HandleCommandL(TInt aCommand)
// handle menu commands
// ----------------------------------------------------
//
void CChineseDisplayAppUi::HandleCommandL(TInt aCommand)
    {
    switch (aCommand)
        {
        case EAknSoftkeyExit:
        case EEikCmdExit:
        case EAknCmdExit:
            Exit();
            break;

        case EChineseDisplayCmdTest:
            {
			HBufC* helloText;

			// now reads the text from resource file to helloText
			helloText = iEikonEnv->AllocReadResourceL( R_EXAMPLE_TEXT_HELLO );
			iEikonEnv->InfoMsg( *helloText );
			delete helloText;
            break;
			}
        
        case EChineseDisplayCmdHello:
			{
			HBufC* helloText;

			// now reads the text from resource file to helloText
			helloText = iEikonEnv->AllocReadResourceL( R_EXAMPLE_TEXT_HELLO );
			CleanupStack::PushL( helloText );
			CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
				informationNote->ExecuteLD( *helloText );
			CleanupStack::PopAndDestroy();
            break;
			}

		case EChineseDisplayCmdHelp:
            HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), AppHelpContextL() );
			break;

        default:
            break;      
        }
    }

CArrayFix <TCoeHelpContext>* CChineseDisplayAppUi::HelpContextL() const
    {
    CArrayFixFlat <TCoeHelpContext>* array = 
                new ( ELeave )CArrayFixFlat <TCoeHelpContext> ( 1 );
    CleanupStack::PushL( array );
    array->AppendL( TCoeHelpContext( KUidChineseDisplay, KContextChinese ) );
    CleanupStack::Pop( array );
    return array;
    }

⌨️ 快捷键说明

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