📄 getdataview.cpp
字号:
/*
* ============================================================================
* Name : CGetDataView from CAknView
* Part of : GetData
* Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/
// INCLUDE FILES
#include <aknviewappui.h>
#include <avkon.hrh>
#include <MClassExample.rsg>
#include "MClassExample.hrh"
#include "GetDataView.h"
#include "GetDataContainer.h"
#include <aknnotewrappers.h>
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CGetDataView::CGetDataView()
{
}
CGetDataView* CGetDataView::NewL()
{
CGetDataView* self = NewLC();
CleanupStack::Pop(self);
return self;
}
CGetDataView* CGetDataView::NewLC()
{
CGetDataView* self = new(ELeave)CGetDataView();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
void CGetDataView::SendData(const TDesC& aData)
{
m_Data.Copy(aData);
}
// EPOC default constructor can leave.
void CGetDataView::ConstructL()
{
BaseConstructL(R_GD_VIEW);
}
// Destructor
CGetDataView::~CGetDataView()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
}
delete iContainer;
}
// ---------------------------------------------------------
// TUid CGetDataView::Id()
// Returns Id of the view.
// ---------------------------------------------------------
TUid CGetDataView::Id() const
{
return KViewId2;
}
// ---------------------------------------------------------
// CGetDataView::HandleCommandL(TInt aCommand)
// Handles commands
// ---------------------------------------------------------
void CGetDataView::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
case EgdCommandget:
{
CAknInformationNote* informationNote = new(ELeave) CAknInformationNote;
informationNote->ExecuteLD(m_Data);
}
break;
default:
AppUi()->HandleCommandL(aCommand);
break;
}
}
// ---------------------------------------------------------
// CGetDataView::HandleClientRectChange()
// Handles client rect change.
// ---------------------------------------------------------
void CGetDataView::HandleClientRectChange()
{
if (iContainer)
{
iContainer->SetRect(ClientRect());
}
}
// void CGetDataView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
// TUid aCustomMessageId,
// const TDesC8& aCustomMessage)
// {
// if( aCustomMessage.Length() )
// {
// TViewPara info;
// TPckgBuf< TViewPara > package( info );
// package.Copy( aCustomMessage );
// info = package(); //iInfo是TViewPara类型的数据成员
// }
//
// iContainer = new (ELeave) CGetDataContainer;
// iContainer->SetMopParent(this);
// TRect rc;
// rc.SetRect(ClientRect().iTl,TSize(176,144));
// iContainer->ConstructL(rc);//ClientRect());
// AppUi()->AddToStackL(*this, iContainer);
// }
// ---------------------------------------------------------
// CGetDataView::DoActivateL(...)
// Creates the Container class object.
// ---------------------------------------------------------
void CGetDataView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
iContainer = new (ELeave) CGetDataContainer;
iContainer->SetMopParent(this);
TRect rc;
rc.SetRect(ClientRect().iTl,TSize(176,144));
iContainer->ConstructL(rc);//ClientRect());
AppUi()->AddToStackL(*this, iContainer);
}
// ---------------------------------------------------------
// CGetDataView::DoDeactivate()
// Deletes the Container class object.
// ---------------------------------------------------------
void CGetDataView::DoDeactivate()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
delete iContainer;
iContainer = NULL;
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -