shapessplashcontainer.cpp
来自「series60 应用程序开发的源代码 series60 应用程序开发的源代码」· C++ 代码 · 共 127 行
CPP
127 行
/**
*
* @brief Definition of CShapesSplashContainer
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
// INCLUDE FILES
// Class includes
#include "ShapesSplashContainer.h"
// System includes
#include <aknutils.h> // CEikonEnv iEikonEnv and AKN_LAF_COLOR
#include <Shapes.rsg> // R_SHAPES_DISPLAY_SHAPES, R_SHAPES_DISPLAY_INSTRUCTIONS, R_SHAPES_DISPLAY_INSTRUCTIONS2
#include <StringLoader.h> // StringLoader
// CONSTANTS
const TInt KColorGray = 86;
const TInt KTextMaxLength = 30;
#define KText1Point TPoint(60, 30)
#define KText2Point TPoint(20, 80)
#define KText3Point TPoint(10, 130)
// ================= MEMBER FUNCTIONS =======================
/**
* Symbian OS 2 phase constructor.
* Constructs the CShapesSplashContainer using the NewLC method, popping
* the constructed object from the CleanupStack before returning it.
*
* @param aRect The rectangle for this window
* @return The newly constructed CShapesSplashContainer
*/
CShapesSplashContainer* CShapesSplashContainer::NewL(const TRect& aRect)
{
CShapesSplashContainer* self = CShapesSplashContainer::NewLC(aRect);
CleanupStack::Pop(self);
return self;
}
/**
* Symbian OS 2 phase constructor.
* Constructs the CShapesSplashContainer using the constructor and ConstructL
* method, leaving the constructed object on the CleanupStack before returning it.
*
* @param aRect The rectangle for this window
* @return The newly constructed CShapesSplashContainer
*/
CShapesSplashContainer* CShapesSplashContainer::NewLC(const TRect& aRect)
{
CShapesSplashContainer* self = new (ELeave) CShapesSplashContainer();
CleanupStack::PushL(self);
self->ConstructL(aRect);
return self;
}
/**
* C++ constructor
*/
CShapesSplashContainer::CShapesSplashContainer()
{
}
/**
* Symbian OS 2nd phase constructor. Creates a Window for the control to draw to.
* Activates the control
*
* @param aRect The rectangle for this window
*/
void CShapesSplashContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
SetRect(aRect);
ActivateL();
}
/**
* Destructor
*/
CShapesSplashContainer::~CShapesSplashContainer()
{
}
/**
* Simple draw function for splash screen. Displays message on how to use application
*
* @param aRect The rectangular area to be drawn
*/
void CShapesSplashContainer::Draw(const TRect& aRect) const
{
// Clear the graphics context.
CWindowGc& gc = SystemGc();
gc.Clear();
// Descriptors to be displayed. Use resource architecture to obtain localized strings.
TBuf<KTextMaxLength> text1;
StringLoader::Load(text1, R_SHAPES_DISPLAY_SHAPES);
TBuf<KTextMaxLength> text2;
StringLoader::Load(text2, R_SHAPES_DISPLAY_INSTRUCTIONS);
TBuf<KTextMaxLength> text3;
StringLoader::Load(text3, R_SHAPES_DISPLAY_INSTRUCTIONS2);
// Set background color
TRgb colorGray = AKN_LAF_COLOR(KColorGray);
gc.SetPenStyle(CGraphicsContext::ENullPen);
gc.SetBrushColor(colorGray);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(aRect);
// Draw text.
gc.SetPenStyle(CGraphicsContext::ESolidPen);
const CFont* font = iEikonEnv->TitleFont();
gc.UseFont(font);
gc.DrawText(text1, KText1Point);
gc.DrawText(text2, KText2Point);
gc.DrawText(text3, KText3Point);
gc.DiscardFont();
}
// End of File
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?