📄 listviews_appview.cpp
字号:
/*****************************************************************************
COPYRIGHT All rights reserved Sony Ericsson Mobile Communications AB 2005.
The software is the copyrighted work of Sony Ericsson Mobile Communications AB.
The use of the software is subject to the terms of the end-user license
agreement which accompanies or is included with the software. The software is
provided "as is" and Sony Ericsson specifically disclaim any warranty or
condition whatsoever regarding merchantability or fitness for a specific
purpose, title or non-infringement. No warranty of any kind is made in
relation to the condition, suitability, availability, accuracy, reliability,
merchantability and/or non-infringement of the software provided herein.
*****************************************************************************/
// ListViews_AppView.cpp
//
//
#include "ListViews.h"
#include "ListViews_Application.h" // KUidListViews
#include "ListViews_AppView.h"
#include <eikmenub.h> // CEikMenuBar
#include <w32std.h> // RWindow
CListViewsAppView* CListViewsAppView::NewL(const TRect& aRect)
{
CListViewsAppView * self = new(ELeave) CListViewsAppView;
CleanupStack::PushL(self);
self->ConstructL(aRect);
CleanupStack::Pop();
return self;
}
CListViewsAppView::~CListViewsAppView()
{
delete iHelloText;
}
void CListViewsAppView::ConstructL(const TRect& aRect)
{
iViewId.iViewUid = TUid::Uid(EListViewsCmdAppView);
iViewId.iAppUid = KUidListViews;
CreateWindowL();
SetRect(aRect);
// Fetch the text from the resource file.
iHelloText = iEikonEnv->AllocReadResourceL(R_LISTVIEWS_TEXT_HELLO);
}
TVwsViewId CListViewsAppView::ViewId() const
{
return iViewId;
}
void CListViewsAppView::Draw(const TRect& /*aRect*/) const
{
// Window graphics context
CWindowGc& gc = SystemGc();
// Start with a clear screen
gc.Clear();
TRect rect = Rect();
rect.Shrink(10,10);
gc.DrawRect(rect);
rect.Shrink(1,1);
const CFont* font = iEikonEnv->TitleFont();
gc.UseFont(font);
TInt baseline = rect.Height()/2 - font->AscentInPixels()/2;
gc.DrawText(*iHelloText, rect, baseline, CGraphicsContext::ECenter);
gc.DiscardFont();
}
void CListViewsAppView::ViewActivatedL( const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/ )
{
ActivateL();
MEikAppUiFactory* factory = iEikonEnv->AppUiFactory();
factory->MenuBar()->ChangeMenuBarL(0, R_LISTVIEWS_MENUBAR, ETrue);
Window().SetOrdinalPosition(0);
MakeVisible(ETrue);
}
void CListViewsAppView::ViewDeactivated()
{
MakeVisible(EFalse);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -