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

📄 richtexteditorappui.cpp

📁 symbian C++ 开发学习的一个很好的例子
💻 CPP
字号:
 /*
* ============================================================================
*  Name     : CRTEAppUi from RichTextEditorAppUi.cpp
*  Part of  : RichTextEditor
*  Created  : 05/08/2006 by Forum Nokia 
*  Version  : 2.0
*  Copyright: Forum Nokia
* ============================================================================
*/

// INCLUDE FILES
#include "RichTextEditorAppUi.h"
#include "RichTextEditorContainer.h" 
#include <RichTextEditor.rsg>
#ifdef __SERIES60_3X__ 
#include <avkon.hrh> //Font ids
#else
#include <AknUtils.h> //Defined font name
#endif
#include "RichTextEditor.hrh"

#define KEnableSkinFlag 0x1000
#define KLayoutAwareApp 0x08

// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CRTEAppUi::ConstructL()
// 
// ----------------------------------------------------------
//
void CRTEAppUi::ConstructL()
    {
    #ifdef __SERIES60_3X__
	BaseConstructL(EAknEnableSkin);
	#else
	BaseConstructL(KEnableSkinFlag | KLayoutAwareApp);
	#endif
    iAppContainer = new (ELeave) CRTEContainer;
    iAppContainer->SetMopParent(this);
    iAppContainer->ConstructL( ClientRect() );
    AddToStackL( iAppContainer );
    }
    
// ----------------------------------------------------
// CRTEAppUi::~CRTEAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CRTEAppUi::~CRTEAppUi()
    {
    if (iAppContainer)
        {
        RemoveFromStack( iAppContainer );
        delete iAppContainer;
        }
   }

// ----------------------------------------------------
// CRTEAppUi::HandleCommandL(TInt aCommand)
// 
// ----------------------------------------------------
//
void CRTEAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
        case EAknSoftkeyBack:
		case EEikCmdExit:
            {
            Exit();
            break;
            }
        case ERichTextCmdAppSetbold:
			iAppContainer->SetCharacterBIUAttribL(CEikGlobalTextEditor::EBold);
			break;
		case ERichTextCmdAppSetItalic:
			iAppContainer->SetCharacterBIUAttribL(CEikGlobalTextEditor::EItalic);
			break;
		case ERichTextCmdAppSetUnderline:
			iAppContainer->SetCharacterBIUAttribL(CEikGlobalTextEditor::EUnderline);
            break;
		// Font names defined at AknUtils.h in 1st and 2nd editions.
		// Font ids at avkon.hrh from 3rd Edition onwards.
		case ERichTextCmdAppFont1:
			#ifdef __SERIES60_3X__
			iAppContainer->SetFont(EAknLogicalFontPrimaryFont);
			#else
			iAppContainer->SetFont(LatinPlain12());
			#endif
			break;
		case ERichTextCmdAppFont2: 
			#ifdef __SERIES60_3X__
			iAppContainer->SetFont(EAknLogicalFontSecondaryFont);
			#else
			// default font at Typo application startup in 1st and 2nd edition.
			iAppContainer->SetFont(LatinBold12());
			#endif
			break;
		case ERichTextCmdAppFont3:
			#ifdef __SERIES60_3X__
			iAppContainer->SetFont(EAknLogicalFontPrimarySmallFont);
			#else
			iAppContainer->SetFont(LatinBold19());
			#endif
			break;	
		case ERichTextCmdAppSetStrikethrough:
			iAppContainer->Strike();
			break;
		case ERichTextCmdAppLeft:
			iAppContainer->SetAlignment(CParaFormat::ELeftAlign);
			break;
		case ERichTextCmdAppCenter:
			iAppContainer->SetAlignment(CParaFormat::ECenterAlign);
			break;
		case ERichTextCmdAppRight:
			iAppContainer->SetAlignment(CParaFormat::ERightAlign);
			break;
		case ERichTextCmdAppSetRed:
			iAppContainer->SetColor(KRgbRed);
			break;
		case ERichTextCmdAppSetGreen:
			iAppContainer->SetColor(KRgbGreen);
			break;
		case ERichTextCmdAppSetBlue:
			iAppContainer->SetColor(KRgbBlue);
			break;
		case ERichTextCmdAppSetBlack:
			iAppContainer->SetColor(KRgbBlack);
			break;
		case ERichTextCmdAppDemo:
			iAppContainer->DemoL();
			break;
        default:
        	_LIT(KInfoMsg, "This should be an Invisible Message");
            iEikonEnv->InfoMsg(KInfoMsg);
			// Let's Panic
			// User::Panic(_L("Unrecognised command"),41);
            break;       
        }
    }

// ---------------------------------------------------------
// CRTEAppUi::HandleStatusPaneSizeChange()
// Called by framework when resource is changed.
// ---------------------------------------------------------
//
void CRTEAppUi::HandleStatusPaneSizeChange()
	{
	CAknAppUi::HandleStatusPaneSizeChange(); //call to upper class

	if(iAppContainer)
		iAppContainer->SetRect( ClientRect() );
	}
// End of File  

⌨️ 快捷键说明

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