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

📄 bluetoothpmpexamplertecontainer.cpp

📁 symbian系统下
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CBluetoothPMPExampleRTEContainer
*  Part of  : BLuetoothPMPExample
*  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 "BluetoothPMPExampleRTEContainer.h"
#include "BluetoothPMPExampleRichtexteditorrte.h"

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

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

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

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

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

	iRte = CRichTextEditorRTE::NewL();

	iRte->SetContainerWindowL(*this);
	iRte->SetSize( TSize(aRect.iBr.iX, aRect.iBr.iY)  );
    //So the text editor will be drawn

    SetRect(aRect);
    ActivateL();

    }

// ----------------------------------------------------------------------------
// CBluetoothPMPExampleRTEContainer::~CBluetoothPMPExampleRTEContainer()
//
// Destructor.
// ----------------------------------------------------------------------------
CBluetoothPMPExampleRTEContainer::~CBluetoothPMPExampleRTEContainer()
    {
	delete iRte;
	iRte = NULL;
    }

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

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

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

// ----------------------------------------------------------------------------
// CBluetoothPMPExampleRTEContainer::DrawTextL( const TDesC& aText )
//
// Add text using a RichTextEditor
// ----------------------------------------------------------------------------
void CBluetoothPMPExampleRTEContainer::DrawTextL( const TDesC& aText )
	{
	iRte->AddTextL( aText );
	

	
	}

// ----------------------------------------------------------------------------
// CBluetoothPMPExampleRTEContainer::DrawTextWithoutCarriageL( const TDesC& aText )
//
// Draw text without drawing a line break at the end.
// ----------------------------------------------------------------------------
void CBluetoothPMPExampleRTEContainer::DrawTextWithoutCarriageL( const TDesC& aText )
	{
	iRte->DrawTextWithoutCarriageL(aText);
	}

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

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

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

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

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

void CBluetoothPMPExampleRTEContainer::ShowMessageL(const TDesC& aMsg)
	{
	DrawTextL(aMsg);
	}

void CBluetoothPMPExampleRTEContainer::ClearScreenL()
    {
    iRte->ClearScreenL();
    }

⌨️ 快捷键说明

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