📄 helloview.cpp
字号:
/*
* ============================================================================
* Name : CHelloView from CAknView
* Part of : Hello
* Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/
// INCLUDE FILES
#include <aknviewappui.h>
#include <avkon.hrh>
#include <Ldcno17song.rsg>
#include "Ldcno17song.hrh"
#include "HelloView.h"
#include "HelloContainer.h"
#include "Ldcno17songAppUi.h"
#include "Ldcno17songDocument.h"
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CHelloView* CHelloView::NewL()
{
CHelloView* self = NewLC();
CleanupStack::Pop(self);
return self;
}
CHelloView* CHelloView::NewLC()
{
CHelloView* self = new (ELeave) CHelloView;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CHelloView::CHelloView()
{
}
// EPOC default constructor can leave.
void CHelloView::ConstructL()
{
//BaseConstructL(R_HELLO_VIEW);
BaseConstructL();
}
// Destructor
CHelloView::~CHelloView()
{
}
// ---------------------------------------------------------
// TUid CHelloView::Id()
// Returns Id of the view.
// ---------------------------------------------------------
TUid CHelloView::Id() const
{
return KViewId1;
}
// ---------------------------------------------------------
// CHelloView::HandleCommandL(TInt aCommand)
// Handles commands
// ---------------------------------------------------------
void CHelloView::HandleCommandL(TInt aCommand)
{
switch(aCommand)
{
// case EMyHelloCmdLogon:
// {
// // AppUi()->ActivateLocalViewL(KViewId2);
// break;
// }
default:
{
AppUi()->HandleCommandL(aCommand);
break;
}
}
}
// ---------------------------------------------------------
// CHelloView::HandleClientRectChange()
// Handles client rect change.
// ---------------------------------------------------------
void CHelloView::HandleClientRectChange()
{
if (iContainer)
{
iContainer->SetRect(ClientRect());
}
}
// ---------------------------------------------------------
// CHelloView::DoActivateL(...)
// Creates the Container class object.
// ---------------------------------------------------------
void CHelloView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
m_pDoc = static_cast<CLdcno17songDocument*>(AppUi()->Document());// 得到文档指针
iContainer = new (ELeave) CHelloContainer;
iContainer->SetMopParent(this);
iContainer->Model(m_pDoc); // 增加!!
TRect rc;
rc.SetRect(ClientRect().iTl, TSize(176, 144));
iContainer->ConstructL(rc);
AppUi()->AddToStackL(*this, iContainer);
}
// ---------------------------------------------------------
// CHelloView::DoDeactivate()
// Deletes the Container class object.
// ---------------------------------------------------------
void CHelloView::DoDeactivate()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
delete iContainer;
iContainer = NULL;
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -