📄 helloworldcontainer.cpp
字号:
/*
* ============================================================================
* Name : CHelloWorldContainer from HelloWorldContainer.h
* Part of : HelloWorld
* Created : 08.02.2006 by My Name
* Implementation notes:
* Initial content was generated by Series 60 Application Wizard.
* Version :
* Copyright: Put Copyright statement here
* ============================================================================
*/
// INCLUDE FILES
#include "HelloWorldContainer.h"
#include <eiklabel.h> // for example label control
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CHelloWorldContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CHelloWorldContainer::ConstructL(const TRect& 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& aRect) const
// ---------------------------------------------------------
//
void CHelloWorldContainer::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 );
}
// ---------------------------------------------------------
// CHelloWorldContainer::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CHelloWorldContainer::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 + -