📄 hellocontainer.cpp
字号:
/*
* ============================================================================
* Name : CHelloContainer from HelloContainer.h
* Part of : Hello
* Created : 21/05/2002 by
* Implementation notes:
* Initial content was generated by Nokia Series 60 AppWizard.
* Version :
* Copyright:
* ============================================================================
*/
// INCLUDE FILES
#include "HelloContainer.h"
#include <eiklabel.h> // for example label control
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CHelloContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CHelloContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
iLabel = new (ELeave) CEikLabel;
iLabel->SetContainerWindowL( *this );
iLabel->SetTextL( _L("Hello World!") );
SetRect(aRect);
ActivateL();
}
// Destructor
CHelloContainer::~CHelloContainer()
{
delete iLabel;
}
// ---------------------------------------------------------
// CHelloContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CHelloContainer::SizeChanged()
{
// TODO: Add here control resize code etc.
iLabel->SetExtent( TPoint(10,10), iLabel->MinimumSize() );
}
// ---------------------------------------------------------
// CHelloContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CHelloContainer::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CHelloContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CHelloContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iLabel;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CHelloContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CHelloContainer::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);
}
// ---------------------------------------------------------
// CHelloContainer::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CHelloContainer::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 + -