www.pudn.com > symbianex.rar > HelloWorldContainer.cpp


/*
* ============================================================================
* Name : CHelloWorldContainer from HelloWorldContainer.h
* Part of : HelloWorld
* Created : 2006-3-9 by Hewei
* Implementation notes:
* Initial content was generated by Series 60 AppWizard.
* Version :
* Copyright:
* ============================================================================
*/

// INCLUDE FILES
#include "HelloWorldContainer.h"

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


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

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

iLabel = new (ELeave) CEikLabel;
iLabel->SetContainerWindowL( *this );
iLabel->SetTextL( _L("Example View") );

iToDoLabel = new (ELeave) CEikLabel;
iToDoLabel->SetContainerWindowL( *this );
iToDoLabel->SetTextL( _L("Add Your controls\n here") );

SetRect(aRect);
ActivateL();
}

// Destructor
CHelloWorldContainer::~CHelloWorldContainer()
{
delete iLabel;
delete iToDoLabel;
}

// ---------------------------------------------------------
// CHelloWorldContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CHelloWorldContainer::SizeChanged()
{
// TODO: Add here control resize code etc.
iLabel->SetExtent( TPoint(10,10), iLabel->MinimumSize() );
iToDoLabel->SetExtent( TPoint(10,100), iToDoLabel->MinimumSize() );
}

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

// ---------------------------------------------------------
// CHelloWorldContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CHelloWorldContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iLabel;
case 1:
return iToDoLabel;
default:
return NULL;
}
}

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

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


// End of File