worldcontainer.cpp

来自「symbian 二版本的自定义控件」· C++ 代码 · 共 94 行

CPP
94
字号

#include <gulicon.h>
#include <aknutils.h>    // definition of AKN_LAF_COLOR()
#include <avkon.hrh>
#include <akntitle.h>
#include <aknnotewrappers.h>

#include "WorldContainer.h"


//////////////////////////////////////////////////////////////////////////
CWorldContainer::CWorldContainer()
{
}

// EPOC default constructor can leave.
void CWorldContainer::ConstructL(const TRect& aRect)
{
    CreateWindowL();

	iTree = new(ELeave) CNDTree;
	iTree->ConstructL();
	iTree->SetContainerWindowL(*this);

    SetRect( aRect );
    ActivateL();
}

// destructor
CWorldContainer::~CWorldContainer()
{
	if (iTree)
	{
		delete iTree;
		iTree = NULL;
	}
}

void CWorldContainer::SizeChanged()
{
	if(iTree)
	{
		iTree->SetRect(Rect());
	}
}

// ---------------------------------------------------------
// CWorldContainer::CountComponentControls() const
// return the number of controls
// ---------------------------------------------------------
//
TInt CWorldContainer::CountComponentControls() const
{
	// return number of controls inside this container
	return 1; 
}

// ---------------------------------------------------------
// CWorldContainer::ComponentControl(TInt aIndex) const
// return the pointer to specified control.
// ---------------------------------------------------------
//
CCoeControl* CWorldContainer::ComponentControl( TInt /*aIndex*/ ) const
{
	return iTree;
}

// ---------------------------------------------------------
// CWorldContainer::Draw(const TRect& aRect) const
// handle the message when client region must be redrawn.
// ---------------------------------------------------------
//
void CWorldContainer::Draw( const TRect& /*aRect*/ ) const
{
	CWindowGc& gc = SystemGc();
	gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
	gc.SetBrushColor(KRgbBlack);
	gc.DrawRect(Rect());
}

// ---------------------------------------------------------
// CAknExGridContainer::OfferKeyEventL(
//           const TKeyEvent& aKeyEvent, TEventCode aType )
// Handles the key events.
// ---------------------------------------------------------
//
TKeyResponse CWorldContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType )
{
	return EKeyWasConsumed;
}



⌨️ 快捷键说明

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