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

📄 normaltexteditorcontainer.cpp

📁 《基于symbian手机开发与应用》一书的源代码
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CNormalTextEditorContainer from NormalTextEditorContainer.h
*  Part of  : NormalTextEditor
*  Created  : 2006-4-7 by hewei
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: myself
* ============================================================================
*/

// INCLUDE FILES
#include "NormalTextEditorContainer.h"
#include <barsread.h>
#include <eikenv.h>
#include <normaltexteditor.rsg>

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

// ---------------------------------------------------------
// CNormalTextEditorContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CNormalTextEditorContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();
    
	iEditor=new(ELeave)CEikEdwin;
	iEditor->SetContainerWindowL(*this);

	TResourceReader reader;
	iEikonEnv->CreateResourceReaderLC(reader,R_PLAIN_TEXT_EDITOR);
	iEditor->ConstructFromResourceL(reader);
	CleanupStack::PopAndDestroy();
	iEditor->SetFocus(ETrue);

    SetRect(aRect);
    ActivateL();
    }

// Destructor
CNormalTextEditorContainer::~CNormalTextEditorContainer()
    {
     delete iEditor;
    }

// ---------------------------------------------------------
// CNormalTextEditorContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CNormalTextEditorContainer::SizeChanged()
    {
	 
    }

// ---------------------------------------------------------
// CNormalTextEditorContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CNormalTextEditorContainer::CountComponentControls() const
    {
    return 1; // return nbr of controls inside this container
    }

// ---------------------------------------------------------
// CNormalTextEditorContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CNormalTextEditorContainer::ComponentControl(TInt aIndex) const
    {
    switch ( aIndex )
        {
        case 0:
			return iEditor;
        default:
            return NULL;
        }
    }

// ---------------------------------------------------------
// CNormalTextEditorContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CNormalTextEditorContainer::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    gc.Clear(aRect);
   }

// ---------------------------------------------------------
// CNormalTextEditorContainer::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CNormalTextEditorContainer::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
    {
    // TODO: Add your control event handler code here
    }
TKeyResponse CNormalTextEditorContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode& aType)
{
	if(iEditor)
		return iEditor->OfferKeyEventL(aKeyEvent,aType);
	else
		return CCoeControl::OfferKeyEventL(aKeyEvent,aType);
}


// End of File  

⌨️ 快捷键说明

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