personinfoview.cpp
来自「symbian 3nd 实现短信息收发」· C++ 代码 · 共 163 行
CPP
163 行
/*
* ============================================================================
* Name : CPersonInfoView from CAknView
* Part of : PersonInfo
* Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/
// INCLUDE FILES
#include <aknviewappui.h>
#include <avkon.hrh>
#include <FrMes.rsg>
#include <akntitle.h>
#include "FrMes.hrh"
#include "PersonInfoView.h"
#include "PersonInfoContainer.h"
#include "FRMESAppUi.h"
#include "FrMesDB.h"
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CPersonInfoView* CPersonInfoView::NewL()
{
CPersonInfoView* self = NewLC();
CleanupStack::Pop(self);
return self;
}
CPersonInfoView* CPersonInfoView::NewLC()
{
CPersonInfoView* self = new (ELeave) CPersonInfoView;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CPersonInfoView::CPersonInfoView()
{
}
// EPOC default constructor can leave.
void CPersonInfoView::ConstructL()
{
BaseConstructL(R_PERSONINFO_VIEW);
}
// Destructor
CPersonInfoView::~CPersonInfoView()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
}
delete iContainer;
}
// ---------------------------------------------------------
// TUid CPersonInfoView::Id()
// Returns Id of the view.
// ---------------------------------------------------------
TUid CPersonInfoView::Id() const
{
return KPersonInfoViewId;
}
// ---------------------------------------------------------
// CPersonInfoView::HandleCommandL(TInt aCommand)
// Handles commands
// ---------------------------------------------------------
void CPersonInfoView::HandleCommandL(TInt aCommand)
{
switch(aCommand)
{
case EFrMesCmdPersonInfoMenu1:
{
CFrMesAppUi* pApp = (CFrMesAppUi*)CEikonEnv::Static()->AppUi();
TInt ntem = pApp->m_pDB->iArray->Count();
if(ntem != 0)
{
pApp->m_pDB->m_CurrentIndex = iContainer->GetCurrentItemIndex();
AppUi()->HandleCommandL(aCommand);
}
}
break;
case EFrMesCmdPersonInfoMenu2:
{
AppUi()->HandleCommandL(aCommand);
}
break;
case EFrMesCmdPersonInfoMenu3:
{
iContainer->DeleteInfo();
iContainer->DisplayList();
}
break;
default:
AppUi()->HandleCommandL(aCommand);
break;
}
}
// ---------------------------------------------------------
// CPersonInfoView::HandleClientRectChange()
// Handles client rect change.
// ---------------------------------------------------------
void CPersonInfoView::HandleClientRectChange()
{
if (iContainer)
{
iContainer->SetRect(ClientRect());
}
}
// ---------------------------------------------------------
// CPersonInfoView::DoActivateL(...)
// Creates the Container class object.
// ---------------------------------------------------------
void CPersonInfoView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
iContainer = new (ELeave) CPersonInfoContainer;
iContainer->SetMopParent(this);
//===============================modify cba by wzg===============
TRect rc;
rc.SetRect(ClientRect().iTl, TSize(176, 144));
iContainer->ConstructL(rc);
AppUi()->AddToStackL(*this, iContainer);
//modify title by wzg
TBuf<32> sTmpTitle;
CEikStatusPane* statusPane = StatusPane();
CEikonEnv::Static()->ReadResource(sTmpTitle,R_FRMES_VIEW_TITLE_PERSONINFO);
CAknTitlePane* titlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
titlePane->SetTextL(sTmpTitle);
iContainer->DisplayList();
}
// ---------------------------------------------------------
// CPersonInfoView::DoDeactivate()
// Deletes the Container class object.
// ---------------------------------------------------------
void CPersonInfoView::DoDeactivate()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
}
delete iContainer;
iContainer = NULL;
}
// End of File
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?