vibraview.cpp

来自「symbian 2rd下手机振动的控制和应用」· C++ 代码 · 共 127 行

CPP
127
字号
/*
============================================================================
 Name        : CVibraView from VibraView.h
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : CVibraView implementation
============================================================================
*/

// INCLUDE FILES
#include  <aknviewappui.h>
#include  <avkon.hrh>
#include  <Vibra.rsg>
#include  "VibraView.h"
#include  "VibraContainer.h" 

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

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

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

	delete iContainer;
	}

// ---------------------------------------------------------
// TUid CVibraView::Id()
//
// ---------------------------------------------------------
//
TUid CVibraView::Id() const
	{
	return KViewId;
	}

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

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

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

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

⌨️ 快捷键说明

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