📄 singlelistview.cpp
字号:
/*
* ============================================================================
* Name : CSingleListView from CAknView
* Part of : Hello
* Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/
// INCLUDE FILES
#include <aknviewappui.h>
#include <akntitle.h>
#include <avkon.hrh>
#include <HelloLdci.rsg>
#include <HelloLdci.mbg> //for mbm file
#include "HelloLdci.hrh"
#include "SingleListView.h"
#include "SingleListContainer.h"
#include "HelloLdciAppUi.h" //for CMyHelloAppUi
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CSingleListView* CSingleListView::NewL()
{
CSingleListView* self = NewLC();
CleanupStack::Pop(self);
return self;
}
CSingleListView* CSingleListView::NewLC()
{
CSingleListView* self = new (ELeave) CSingleListView;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CSingleListView::CSingleListView()
{
m_nNumber = 0;
}
// EPOC default constructor can leave.
void CSingleListView::ConstructL()
{
BaseConstructL(R_HL_SINGLELIST_VIEW);
}
// Destructor
CSingleListView::~CSingleListView()
{
}
// ---------------------------------------------------------
// TUid CSingleListView::Id()
// Returns Id of the view.
// ---------------------------------------------------------
TUid CSingleListView::Id() const
{
return TUid::Uid(ESingleListViewID);
}
// ---------------------------------------------------------
// CSingleListView::HandleCommandL(TInt aCommand)
// Handles commands
// ---------------------------------------------------------
void CSingleListView::HandleCommandL(TInt aCommand)
{
switch(aCommand)
{
case EHLSingListAdd:
for (m_nNumber = 0;m_nNumber<5;m_nNumber++)
{
iContainer->AddInfoToList(m_nNumber,_L("single list content"));
}
break;
case EHLSingListDel:
iContainer->DelInfoFromList();
break;
default:
{
AppUi()->HandleCommandL(aCommand);
break;
}
}
}
// ---------------------------------------------------------
// CSingleListView::HandleClientRectChange()
// Handles client rect change.
// ---------------------------------------------------------
void CSingleListView::HandleClientRectChange()
{
if (iContainer)
{
iContainer->SetRect(ClientRect());
}
}
// ---------------------------------------------------------
// CSingleListView::DoActivateL(...)
// Creates the Container class object.
// ---------------------------------------------------------
void CSingleListView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
iContainer = new (ELeave) CSingleListContainer;
iContainer->SetMopParent(this);
TRect rc;
rc.SetRect(ClientRect().iTl, TSize(176, 144));
iContainer->ConstructL(rc);
AppUi()->AddToStackL(*this, iContainer);
//修改标题
CEikStatusPane* sp=StatusPane();
CAknTitlePane* titlePane = (CAknTitlePane*) sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
titlePane->SetTextL(_L("SingleListView"));
}
// ---------------------------------------------------------
// CSingleListView::DoDeactivate()
// Deletes the Container class object.
// ---------------------------------------------------------
void CSingleListView::DoDeactivate()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
delete iContainer;
iContainer = NULL;
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -