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

📄 smsexamplertecontainer.cpp

📁 symbian平台
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CSMSExampleRTEContainer from SMSExampleRTEContainer.h
*  Part of  : SMSExample
*  Created  : 08.02.2005 by Forum Nokia
*  Implementation notes:
*     Initial content was generated by Series 60 Application Wizard.
*  Version  : 1.0
*  Copyright: Nokia Corporation
* ============================================================================
*/

// INCLUDE FILES
#include "SMSExampleRTEContainer.h"
#include "SMSExamplerichtexteditorrte.h"

// Rich text editor starting position
#define KEditorPosition TPoint(0,0) 

_LIT(KEventLog, "Event log: \n" );

// ----------------------------------------------------------------------------
// CSMSExampleRTEContainer::NewL(const TRect& aRect)
//
// Symbian OS 2 phase constructor.
// ----------------------------------------------------------------------------
CSMSExampleRTEContainer* CSMSExampleRTEContainer::NewL(const TRect& aRect)
	{
	CSMSExampleRTEContainer* self = CSMSExampleRTEContainer::NewLC(aRect);
	CleanupStack::Pop(self);
	return self;
	}

// ----------------------------------------------------------------------------
// CSMSExampleRTEContainer::NewLC(const TRect& aRect)
//
// Symbian OS 2 phase constructor.
// ----------------------------------------------------------------------------
CSMSExampleRTEContainer* CSMSExampleRTEContainer::NewLC(const TRect& aRect)
	{
	CSMSExampleRTEContainer* self = new (ELeave) CSMSExampleRTEContainer;
	CleanupStack::PushL(self);
	self->ConstructL(aRect);
	return self;
	}

// ---------------------------------------------------------
// CSMSExampleRTEContainer::ConstructL(const TRect& aRect)
// Symbian OS two phased constructor.
// ---------------------------------------------------------
//
void CSMSExampleRTEContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

	iRte = CRichTextEditorRTE::NewL();

	iRte->SetContainerWindowL(*this);

    SetRect(aRect);
    ActivateL();

	iRte->AddTextL( KEventLog );
    }

// ----------------------------------------------------------------------------
// CSMSExampleRTEContainer::~CSMSExampleRTEContainer()
//
// Destructor.
// ----------------------------------------------------------------------------
CSMSExampleRTEContainer::~CSMSExampleRTEContainer()
    {
	delete iRte;
	iRte = 0;
    }

// ----------------------------------------------------------------------------
// CSMSExampleRTEContainer::DrawUnderlinedTextL( const TDesC& aText )
//
// Draw using a RichtTextEditor. Set Underline off when finished drawing.
// ----------------------------------------------------------------------------
void CSMSExampleRTEContainer::DrawUnderlinedTextL( const TDesC& aText )
	{
	iRte->SetTextUnderlineOn(ETrue);
	DrawTextWithoutCarriageL(aText);
	iRte->SetTextUnderlineOn(EFalse);
	}

// ----------------------------------------------------------------------------
// CSMSExampleRTEContainer::DrawLineL()
//
// Draw one line.
// ----------------------------------------------------------------------------
void CSMSExampleRTEContainer::DrawLineL()
	{
	iRte->DrawLineL();
	}

// ---------------------------------------------------------
// CSMSExampleRTEContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
void CSMSExampleRTEContainer::SizeChanged()
    {
    iRte->SetExtent(KEditorPosition, iRte->MinimumSize());
    }

// ----------------------------------------------------------------------------
// CSMSExampleRTEContainer::DrawTextL( const TDesC& aText )
//
// Add text using a RichTextEditor
// ----------------------------------------------------------------------------
void CSMSExampleRTEContainer::DrawTextL( const TDesC& aText )
	{
	iRte->AddTextL( aText );
	}
	
// ----------------------------------------------------------------------------
// CSMSExampleRTEContainer::DrawTextWithoutCarriageL( const TDesC& aText )
//
// Draw text without drawing a line break at the end.
// ----------------------------------------------------------------------------
void CSMSExampleRTEContainer::DrawTextWithoutCarriageL( const TDesC& aText )
	{
	iRte->DrawTextWithoutCarriageL(aText);
	}

// ----------------------------------------------------------------------------
// CSMSExampleRTEContainer::AddCarriageReturnL()
//
// Add one line break.
// ----------------------------------------------------------------------------
void CSMSExampleRTEContainer::AddCarriageReturnL()
	{
	iRte->AddCarriageReturnL();
	}
// ---------------------------------------------------------
// CSMSExampleRTEContainer::CountComponentControls() const
// ---------------------------------------------------------
TInt CSMSExampleRTEContainer::CountComponentControls() const
    {
    return 1; // return number of controls inside this container
    }

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

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

// ---------------------------------------------------------
// CSMSExampleRTEContainer::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
void CSMSExampleRTEContainer::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
    {
    }

// ----------------------------------------------------------------------------
// CSMSExampleRTEContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
// ----------------------------------------------------------------------------
TKeyResponse CSMSExampleRTEContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
	{
	if (iRte)
		return iRte->OfferKeyEventL(aKeyEvent, aType);
	else 
		return CCoeControl::OfferKeyEventL(aKeyEvent, aType);
	}

⌨️ 快捷键说明

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