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

📄 iapconnectconninfocontainer.cpp

📁 symbian中如何取得内部联网方式
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CIAPConnectConnInfoContainer from IAPConnectConnInfoContainer.cpp
*  Part of  : Internet Access Points Example v2.0
*  Created  : 01.09.2006 by Forum Nokia
*  Version  : 2.0
*  Copyright: Forum Nokia
* ============================================================================
*/

// INCLUDE FILES
#include "IAPConnectConnInfoContainer.h"

#include <iapconnect.rsg>
#include <txtrich.h>   //Richtext
#include <eikrted.h>  //RichText Editor
#include <AknUtils.h>

// Constants
_LIT(KEmptyLiteral, "");

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

// ---------------------------------------------------------
// CIAPConnectConnInfoContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CIAPConnectConnInfoContainer::ConstructL(const TRect& aRect)
    {
	CreateWindowL();
	iRtEd = new(ELeave) CEikRichTextEditor;
	iRtEd->SetAknEditorCase(EAknEditorLowerCase);
	iRtEd->SetAknEditorFlags  // This must be called before ConstructL
		(
		EAknEditorFlagFixedCase| 	   // Set up fixed case
		EAknEditorFlagEnableScrollBars // Set up the scrollbars
		);
	// Set some additional flags in ConstructL as well
    iRtEd->ConstructL(this,0,0,
        CEikEdwin::ENoAutoSelection |
        CEikEdwin::EAvkonDisableCursor |
        CEikEdwin::EReadOnly);

	iRtEd->SetFocus(ETrue);
	SetRect(aRect);
    // Update the scrollbar manually and notify SizeChanged    
	iRtEd->UpdateScrollBarsL(); 
	SizeChanged();
	ActivateL();
    }

// ---------------------------------------------------------
// CIAPConnectConnInfoContainer::~CIAPConnectConnInfoContainer()
// Destructor - Free the allocated resources
// ---------------------------------------------------------

CIAPConnectConnInfoContainer::~CIAPConnectConnInfoContainer()
    {
    if(iRtEd)
        {
        delete iRtEd;
        iRtEd = NULL;
        }
    }

void CIAPConnectConnInfoContainer::ShowInfoL(const TDesC& aInfoText)
	{
    iRtEd->SetTextL(&aInfoText);
    iRtEd->UpdateScrollBarsL(); 
    SizeChanged();
	}

void CIAPConnectConnInfoContainer::AppendInfoL(const TDesC& aInfoText)
    {
    // Append to the end of the rich text editor window
    iRtEd->RichText()->InsertL(iRtEd->Text()->DocumentLength()/* at the end*/,
        aInfoText);
    iRtEd->UpdateScrollBarsL(); 
    SizeChanged();
    }

void CIAPConnectConnInfoContainer::ClearInfoL()
    {
    ShowInfoL(KEmptyLiteral);
    }

// ---------------------------------------------------------
// CIAPConnectConnInfoContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CIAPConnectConnInfoContainer::SizeChanged()
    {
	TRect rect = Rect();
	#ifdef __SERIES60_3X__
	TRect ScrollBarRect = iRtEd->ScrollBarFrame()->VerticalScrollBar()->Rect();
	iRtEd->SetExtent(TPoint(0,0), TSize(rect.Width()-ScrollBarRect.Width(), 
        rect.Height()));
	#else
    iRtEd->SetExtent(TPoint(0,0), rect.Size());
    #endif
    }

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

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

// ---------------------------------------------------------
// CIAPConnectConnInfoContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CIAPConnectConnInfoContainer::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    gc.SetPenStyle(CGraphicsContext::ENullPen);
    gc.SetBrushColor(KRgbWhite);
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    gc.DrawRect(aRect);
    }

// ---------------------------------------------------------
// OfferKeyEventL() 
// Distribute the key event to the Editor
// ---------------------------------------------------------
//
TKeyResponse CIAPConnectConnInfoContainer::OfferKeyEventL(
    const TKeyEvent& aKeyEvent,TEventCode aType)
	{
	if (iRtEd->IsFocused())
		{
		return iRtEd->OfferKeyEventL(aKeyEvent, aType);	
		}
	else
		{
		return EKeyWasNotConsumed;
		}
	}

// End of File

⌨️ 快捷键说明

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