📄 circlecontainer.cpp
字号:
/*
* ============================================================================
* Name : CCircleContainer from CCoeControl, MCoeControlObserver
* Part of : LDMNO20
* Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/
// INCLUDE FILES
#include <LDMNO20.rsg>
#include "LDMNO20.hrh"
#include "CircleContainer.h"
#include "ActiveCircle.h"
#include <EIKMSG.H>
#include "Ball.mbg"
#include <aknutils.h>
#include <EIKAPP.h>
#include <f32file.h>
#include <EIKAPPUI.H>
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CCircleContainer::CCircleContainer()
{
}
// EPOC default constructor can leave.
void CCircleContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
SetRect(aRect);
TBuf<KMaxPath> pathAppMbm;
#ifdef __WINS__
pathAppMbm.Copy(_L("z:\\system\\apps\\LDMNO20\\LDMNO20.mbm"));
#else
// CEikonEnv& ee = *CEikonEnv::Static();
// CEikAppUi& ea = *( ee.EikAppUi() );
// appFullName = (ea.Application())->AppFullName();
TFileName appFullName;
appFullName = iEikonEnv->Static()->EikAppUi()->Application()->AppFullName();
// // TFileName appFullName;
// appFullName = Application()->AppFullName();
TParsePtr parse(appFullName);
pathAppMbm.Copy(parse.DriveAndPath());
pathAppMbm.Append(_L("LDMNO20.mbm"));
#endif
iActive = new( ELeave) CActiveCircle(this, 50,50);
iBall = iEikonEnv->CreateIconL(pathAppMbm,EMbmBallBall,EMbmBallBall_mask);
ActivateL();
}
// Destructor
CCircleContainer::~CCircleContainer()
{
iActive->Cancel();
if(iBall != NULL)
{
delete iBall;
iBall = NULL;
}
if(iActive != NULL)
{
delete iActive;
iActive = NULL;
}
}
// ---------------------------------------------------------
// CCircleContainer::FocusTo(TInt aCommand)
// Change foccused control.
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CCircleContainer::FocusTo(TInt aCommand)
{
}
// ---------------------------------------------------------
// CCircleContainer::SizeChanged()
// Called by framework when the view size is changed
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CCircleContainer::SizeChanged()
{
}
// ---------------------------------------------------------
// CCircleContainer::CountComponentControls() const
// (other items were commented in a header).
// ---------------------------------------------------------
//
TInt CCircleContainer::CountComponentControls() const
{
return 0; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CCircleContainer::ComponentControl(TInt aIndex) const
// (other items were commented in a header).
// ---------------------------------------------------------
//
CCoeControl* CCircleContainer::ComponentControl(TInt aIndex) const
{
return NULL;
}
// ---------------------------------------------------------
// CCircleContainer::Draw(const TRect& aRect) const
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CCircleContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
// Clear the screen
gc.Clear(Rect());
gc.SetPenStyle(CGraphicsContext::ENullPen);
gc.SetBrushColor(KRgbWhite);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(aRect);
gc.BitBlt(iActive->GetPoint(), iBall->Bitmap());
TSize PenSize(3,3);
gc.SetPenSize(PenSize);
gc.SetPenStyle(CGraphicsContext::ESolidPen);
gc.SetPenColor(KRgbRed);
gc.DrawLine(TPoint(0,0),TPoint(175,0));
gc.DrawLine(TPoint(0,0),TPoint(0,143));
gc.DrawLine(TPoint(175,143),TPoint(175,0));
gc.DrawLine(TPoint(175,143),TPoint(0,143));
}
// ---------------------------------------------------------
// CCircleContainer::OfferKeyEventL(...)
// Notify key events to editors.
// (other items were commented in a header).
// ---------------------------------------------------------
//
TKeyResponse CCircleContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent, TEventCode aType)
{
return EKeyWasNotConsumed;
}
// ---------------------------------------------------------
// CCircleContainer::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CCircleContainer::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
}
CActiveCircle* CCircleContainer::GetiActive()
{
return iActive;
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -