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

📄 mdnvbaoxcontainer.cpp

📁 symbian下开发聊天
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CMdnvbaoxContainer from MdnvbaoxContainer.h
*  Part of  : Mdnvbaox
*  Created  : 17.09.2007 by chenziteng@163.com
*  Implementation notes:
*     Initial content was generated by Series 60 Application Wizard.
*  Version  :
*  Copyright: 
* ============================================================================
*/

// INCLUDE FILES
#include "MdnvbaoxContainer.h"

#include <eiklabel.h>  // for example label control
#include <eikenv.h>

#include "MyEdwin.h"

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

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

    _LIT(KHelloWorld, "The Government of the People's Republic of China is the sole legal government of China, and Taiwan is an inalienable part of China.");
    iEdwin = new (ELeave) CMyEdwin;
    iEdwin->SetContainerWindowL(*this);
    iEdwin->ConstructL();
    iEdwin->SetObserver(this);
    iEdwin->SetTextL(&KHelloWorld);
    iEdwin->SetFocus(ETrue);


    TCharFormat format;
    Mem::FillZ( & format, sizeof( TCharFormat ) );
    TCharFormatMask mask;
    Mem::FillZ( & mask, sizeof( TCharFormatMask ) );
    format.iFontSpec.iTypeface = CEikonEnv::Static()->TitleFont()->FontSpecInTwips().iTypeface;
    mask.SetAttrib( EAttFontTypeface );
    format.iFontPresentation.iTextColor = CEikonEnv::Static()->Color( EColorLabelText );
    mask.SetAttrib( EAttColor );
    format.iFontPresentation.iStrikethrough = ( TFontStrikethrough )EFalse;
    mask.SetAttrib( EAttFontStrikethrough );
    format.iFontPresentation.iUnderline = ( TFontUnderline )EFalse;
    mask.SetAttrib( EAttFontUnderline );
    CCharFormatLayer * layer = CCharFormatLayer::NewL( format, mask );
    iEdwin->SetCharFormatLayer( layer );

    SetRect(aRect);
    ActivateL();
    }

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

// ---------------------------------------------------------
// CMdnvbaoxContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CMdnvbaoxContainer::SizeChanged()
    {
    iEdwin->SetExtent( TPoint(0,0), TSize(176,144) );
    }

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

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

// ---------------------------------------------------------
// CMdnvbaoxContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CMdnvbaoxContainer::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    // TODO: Add your drawing code here
    // example code...
    gc.SetPenStyle( CGraphicsContext::ENullPen );
    gc.SetBrushColor( KRgbGray );
    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
    gc.DrawRect( aRect );
    }

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

TKeyResponse CMdnvbaoxContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    return iEdwin->OfferKeyEventL(aKeyEvent, aType);
    }

// End of File  

⌨️ 快捷键说明

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