demonsymview2.cpp

来自「symbian下的一个例子」· C++ 代码 · 共 127 行

CPP
127
字号
/*
============================================================================
 Name        : CDemonsymView2 from DemonsymView2.h
 Author      : huhao
 Version     :
 Copyright   : baidu
 Description : CDemonsymView2 implementation
============================================================================
*/

// INCLUDE FILES
#include  <aknviewappui.h>
#include  <avkon.hrh>
#include  <Demonsym.rsg>
#include  "DemonsymView2.h"
#include  "DemonsymContainer2.h" 

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CDemonsymView2::ConstructL(const TRect& aRect)
// EPOC two-phased constructor
// ---------------------------------------------------------
//
void CDemonsymView2::ConstructL()
	{
	BaseConstructL( R_DEMONSYM_VIEW2 );
	}

// ---------------------------------------------------------
// CDemonsymView2::~CDemonsymView2()
// destructor
// ---------------------------------------------------------
//
CDemonsymView2::~CDemonsymView2()
	{
	if ( iContainer )
		{
		AppUi()->RemoveFromViewStack( *this, iContainer );
		}

	delete iContainer;
	}

// ---------------------------------------------------------
// TUid CDemonsymView2::Id()
// 
// ---------------------------------------------------------
//
TUid CDemonsymView2::Id() const
	{
	return KView2Id;
	}

// ---------------------------------------------------------
// CDemonsymView2::HandleCommandL(TInt aCommand)
// takes care of view command handling
// ---------------------------------------------------------
//
void CDemonsymView2::HandleCommandL(TInt aCommand)
	{
	switch ( aCommand )
		{
		case EAknSoftkeyOk:
			{
			iEikonEnv->InfoMsg( _L("view2 ok") );
			break;
			}
		case EAknSoftkeyBack:
			{
			AppUi()->HandleCommandL(EEikCmdExit);
			break;
			}
		default:
			{
			AppUi()->HandleCommandL( aCommand );
			break;
			}
		}
	}

// ---------------------------------------------------------
// CDemonsymView2::HandleClientRectChange()
// ---------------------------------------------------------
//
void CDemonsymView2::HandleClientRectChange()
	{
	if ( iContainer )
		{
		iContainer->SetRect( ClientRect() );
		}
	}

// ---------------------------------------------------------
// CDemonsymView2::DoActivateL(...)
// 
// ---------------------------------------------------------
//
void CDemonsymView2::DoActivateL(
   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
   const TDesC8& /*aCustomMessage*/)
	{
	if (!iContainer)
		{
		iContainer = new (ELeave) CDemonsymContainer2;
		iContainer->SetMopParent(this);
		iContainer->ConstructL( ClientRect() );
		AppUi()->AddToStackL( *this, iContainer );
		}
   }

// ---------------------------------------------------------
// CDemonsymView2::DoDeactivate()
// 
// ---------------------------------------------------------
//
void CDemonsymView2::DoDeactivate()
	{
	if ( iContainer )
		{
		AppUi()->RemoveFromViewStack( *this, iContainer );
		}
	
	delete iContainer;
	iContainer = NULL;
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?