📄 graphicexamcontainer.cpp
字号:
/*
============================================================================
Name : CGraphicExamContainer from GraphicExamContainer.h
Author : hou maoqing
Version :
Copyright : Copyright (c) Hou maoqing 2008
Description : Container control implementation
============================================================================
*/
// INCLUDE FILES
#include "GraphicExamContainer.h"
#include <eiklabel.h> // for example label control
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CGraphicExamContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CGraphicExamContainer::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
CGraphicExamContainer::~CGraphicExamContainer()
{
delete iLabel;
delete iToDoLabel;
}
// ---------------------------------------------------------
// CGraphicExamContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CGraphicExamContainer::SizeChanged()
{
// TODO: Add here control resize code etc.
//iLabel->SetExtent( TPoint(10,10), iLabel->MinimumSize() );
//iToDoLabel->SetExtent( TPoint(10,100), iToDoLabel->MinimumSize() );
}
// ---------------------------------------------------------
// CGraphicExamContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CGraphicExamContainer::CountComponentControls() const
{
return 0; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CGraphicExamContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CGraphicExamContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iLabel;
case 1:
return iToDoLabel;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CGraphicExamContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CGraphicExamContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
//清空窗口上的内容
gc.SetPenStyle( CGraphicsContext::ENullPen );
gc.SetBrushColor( KRgbGray );
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
gc.DrawRect( aRect );
//绘制图形
gc.SetPenStyle(CGraphicsContext::ESolidPen);
gc.SetPenSize(TSize(3,3));
gc.SetPenColor(KRgbBlack);
gc.DrawEllipse(aRect);
gc.SetPenColor(KRgbBlue);
gc.SetPenStyle(CGraphicsContext::EDottedPen);
gc.SetPenSize(TSize(4,4));
gc.DrawLine(aRect.iTl,aRect.iBr);
}
// ---------------------------------------------------------
// CGraphicExamContainer::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CGraphicExamContainer::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
// TODO: Add your control event handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -