📄 worldview.cpp
字号:
/*
* ============================================================================
* Name : CWorldView from CAknView
* Part of : World
* Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/
// INCLUDE FILES
#include <aknviewappui.h>
#include <avkon.hrh>
#include <Ldcno17song.rsg>
#include "Ldcno17song.hrh"
#include "WorldView.h"
#include "WorldContainer.h"
#include "Ldcno17song.mbg"
#include "akncontext.h"
#include "akntitle.h"
#include "Ldcno17songappui.h"
#include <aknnotewrappers.h>
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CWorldView* CWorldView::NewL()
{
CWorldView* self = NewLC();
CleanupStack::Pop(self);
return self;
}
CWorldView* CWorldView::NewLC()
{
CWorldView* self = new (ELeave) CWorldView;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CWorldView::CWorldView()
{
}
// EPOC default constructor can leave.
void CWorldView::ConstructL()
{
BaseConstructL();
}
// Destructor
CWorldView::~CWorldView()
{
}
// ---------------------------------------------------------
// TUid CWorldView::Id()
// Returns Id of the view.
// ---------------------------------------------------------
TUid CWorldView::Id() const
{
return KViewId2;
}
// ---------------------------------------------------------
// CWorldView::HandleCommandL(TInt aCommand)
// Handles commands
// ---------------------------------------------------------
void CWorldView::HandleCommandL(TInt aCommand)
{
}
// ---------------------------------------------------------
// CWorldView::HandleClientRectChange()
// Handles client rect change.
// ---------------------------------------------------------
void CWorldView::HandleClientRectChange()
{
if (iContainer)
{
iContainer->SetRect(ClientRect());
}
}
// ---------------------------------------------------------
// CWorldView::DoActivateL(...)
// Creates the Container class object.
// ---------------------------------------------------------
void CWorldView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
iContainer = new (ELeave) CWorldContainer;
iContainer->SetMopParent(this);
iContainer->ConstructL(ClientRect());
AppUi()->AddToStackL(*this, iContainer);
TBuf<KMaxPath> pathMbm;
#ifdef __WINS__
pathMbm.Copy(_L("z:\\system\\apps\\Ldcno17song\\Ldcno17song.mbm"));
#else
CLdcno17songAppUi* pApp = (CLdcno17songAppUi*)CEikonEnv::Static()->AppUi();
pApp->GetAppPath(pathMbm);
pathMbm.Append(_L("Ldcno17song.mbm"));
#endif
CEikStatusPane* statusPane = StatusPane(); // 得到一个面板,定义一个指向控制区域的指针;
//set icon // 定义图标;// 定义一个图标指针指向面板;
CAknContextPane* contextPane = (CAknContextPane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidContext));
CFbsBitmap* bitmap = iEikonEnv->CreateBitmapL(pathMbm, EMbmLdcno17songSnoopy_1_icon); // 图标;
CFbsBitmap* bitmapMask = iEikonEnv->CreateBitmapL(pathMbm, EMbmLdcno17songSnoopy_1_mask);
//contextPane->SetPicture(bitmap);
contextPane->SetPicture(bitmap, bitmapMask);
//set title // 定义标题;
// CAknTitlePane* titlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
// titlePane->SetTextL(_L("Hello view!"));
//load chinese words // 定义中文标题;
TBuf<32> sTmpTitle; // 标题;
CEikonEnv::Static()->ReadResource(sTmpTitle, R_QTN_MH_HELLO_TITLE); // 宏;
CAknTitlePane* titlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
titlePane->SetTextL(sTmpTitle);
//show // 显示函数,疑问是否是系统自带?
// CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
// informationNote->ExecuteLD(sTmpTitle);
}
// ---------------------------------------------------------
// CWorldView::DoDeactivate()
// Deletes the Container class object.
// ---------------------------------------------------------
void CWorldView::DoDeactivate()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
delete iContainer;
iContainer = NULL;
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -