symbian4view.cpp

来自「S60 3版 音乐播放器及进度条实现 功能:前后倒放歌曲及暂停等功能」· C++ 代码 · 共 143 行

CPP
143
字号
/*
============================================================================
Name        : CSymbian4View from Symbian3View.h
Author      : 
Version     :
Copyright   : Your copyright notice
Description : CSymbian4View implementation
============================================================================
*/

// INCLUDE FILES
#include  <aknviewappui.h>
#include  <avkon.hrh>
#include  <Symbian4.rsg>
#include <Symbian4.hrh>
#include  "Symbian4View.h"
#include  "Symbian4Container.h" 
#include "Symbian4View2.h"

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

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

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

	delete iContainer;
}

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

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

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

// ---------------------------------------------------------
// CSymbian4View::DoActivateL(...)
// 
// ---------------------------------------------------------
//
void CSymbian4View::DoActivateL(
								const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
								const TDesC8& /*aCustomMessage*/)
{
	if (!iContainer)
	{
		iContainer = new (ELeave) CSymbian4Container;
		iContainer->SetMopParent(this);
		iContainer->ConstructL( ClientRect() );
		AppUi()->AddToStackL( *this, iContainer );
	}
	/////////////////////////////////////////////////////////
	TKeyEvent aKeyEvent;
	aKeyEvent.iScanCode = 167;
	iContainer->OfferKeyEventL(aKeyEvent,EEventKeyDown);

	/////////////////////////////////////////////////////////
}

// ---------------------------------------------------------
// CSymbian4View::DoDeactivate()
// 
// ---------------------------------------------------------
//
void CSymbian4View::DoDeactivate()
{
	if ( iContainer )
	{
		AppUi()->RemoveFromViewStack( *this, iContainer );
	}

	delete iContainer;
	iContainer = NULL;
}



⌨️ 快捷键说明

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