📄 bookstoreappview.cpp
字号:
/*
* ============================================================================
* Name : BookstoreAppView from BookstoreAppView.cpp
* Part of : Bookstore
* Created : 8.12.2003 by Forum Nokia
* Version : 1.0
* Copyright: Nokia Corporation
* ============================================================================
*/
#include <eikenv.h>
#include <gdi.h>
#include "BookstoreAppView.h"
// ---------------------------------------------------------------------------
// CBookstoreAppUi::NewL()
//
// Create instance of this view.
// ---------------------------------------------------------------------------
CBookstoreAppView* CBookstoreAppView::NewL(const TRect& aRect)
{
CBookstoreAppView* self = new (ELeave) CBookstoreAppView;
CleanupStack::PushL(self);
self->ConstructL(aRect);
CleanupStack::Pop(self);
return self;
}
// ---------------------------------------------------------------------------
// CBookstoreAppUi::ConstructL()
//
// Perform the second phase construction.
// ---------------------------------------------------------------------------
void CBookstoreAppView::ConstructL(const TRect& aRect)
{
// Create a window for this application view
CreateWindowL();
// Set the windows size
SetRect(aRect);
ActivateL();
}
// ---------------------------------------------------------------------------
// CBookstoreAppUi::CBookstoreAppView()
//
// Constructor
// ---------------------------------------------------------------------------
CBookstoreAppView::CBookstoreAppView()
{
// No implementation required
}
// ---------------------------------------------------------------------------
// CBookstoreAppUi::~CBookstoreAppView()
//
// Desctructor
// ---------------------------------------------------------------------------
CBookstoreAppView::~CBookstoreAppView()
{
}
// ---------------------------------------------------------------------------
// CBookstoreAppUi::Draw()
//
// Draw the view. Show simple "Bookstore" text in the center of the view.
// This is called by the framework, when necessary.
// ---------------------------------------------------------------------------
void CBookstoreAppView::Draw(const TRect& /*aRect*/) const
{
_LIT(KText,"Bookstore");
CWindowGc& gc = SystemGc(); // Window graphics context
TRect drawRect = Rect(); // Area in which we shall draw
const CFont* fontUsed = iEikonEnv->TitleFont();
gc.Clear(); // Start with a clear screen
// Draw an outline rectangle slightly smaller than the drawing area.
drawRect.Shrink(10,10);
gc.DrawRect(drawRect);
gc.UseFont(fontUsed);
// Draw the text in the middle of the rectangle.
TInt baselineOffset=(drawRect.Height() - fontUsed->HeightInPixels())/2;
gc.DrawText(KText, drawRect, baselineOffset, CGraphicsContext::ECenter, 0);
// Finished using the font
gc.DiscardFont();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -