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

📄 asyncserialcontainer.cpp

📁 《基于Symbian OS的手机开发与应用实践》这本书的配套源码。
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CAsyncSerialContainer from AsyncSerialContainer.h
*  Part of  : AsyncSerial
*  Created  : 23.02.2006 by ToBeReplacedByAuthor
*  Implementation notes:
*     Initial content was generated by Series 60 Application Wizard.
*  Version  :
*  Copyright: ToBeReplacedByCopyright
* ============================================================================
*/

// INCLUDE FILES
#include "AsyncSerialContainer.h"

#include <eikedwin.h>  // for example label control


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

// ---------------------------------------------------------
// CAsyncSerialContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CAsyncSerialContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    iEdwin = new(ELeave) CEikEdwin;
    iEdwin->SetContainerWindowL( *this );
    iEdwin->ConstructL();
    iEdwin->SetReadOnly(ETrue);

    SetRect(aRect);
    ActivateL();
    }

// Destructor
CAsyncSerialContainer::~CAsyncSerialContainer()
    {
    delete iEdwin;
    }

void CAsyncSerialContainer::AppendTextL(TDesC& aText)
    {
    CPlainText* text = iEdwin->Text();
    TInt len = text->DocumentLength();
    text->InsertL(len, aText);
    len = text->DocumentLength();
    iEdwin->SetCursorPosL(len, EFalse);
    DrawDeferred();
    }

// ---------------------------------------------------------
// CAsyncSerialContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CAsyncSerialContainer::SizeChanged()
    {
    // TODO: Add here control resize code etc.
    iEdwin->SetRect(Rect());
    }

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

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

// ---------------------------------------------------------
// CAsyncSerialContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CAsyncSerialContainer::Draw(const TRect& aRect) const
    {
    }

// ---------------------------------------------------------
// CAsyncSerialContainer::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CAsyncSerialContainer::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
    {
    // TODO: Add your control event handler code here
    }


// End of File  

⌨️ 快捷键说明

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