⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userinterface.cpp

📁 SYMBIAN GPS NMEA协议实现
💻 CPP
字号:

#include <AvKon.hrh>
#include <EikEnv.h>
#include <EikMenuP.h>

#include <BluetoothGPS.hrh>
#include <BluetoothGPS.rsg>

#include "ui/UserInterface.h"

#include "views/GpsInfo.h"
#include "views/GpsTest.h"



CUserInterface::CUserInterface( ) {

}



CUserInterface::~CUserInterface( ) {

	RemoveCurrentView( );

	delete( iView ); iView = NULL;
	delete( iDeletedView ); iDeletedView = NULL;

	iRealView = NULL;

}



void CUserInterface::ConstructL( ) {

	BaseConstructL( );

	iView = CGpsInfo::NewL( ClientRect( ) );
	AddToStackL( iView );

}



TDisplayMode CUserInterface::DisplayMode( ) {

	return( CEikonEnv::Static( )->ScreenDevice( )->DisplayMode( ) );

}



void CUserInterface::InfoWindow( const TDesC & aMessage ) {

	CUserInterface * self = ( CUserInterface * ) CEikonEnv::Static( )->AppUi( );
	self->InfoWindowInternal( aMessage );

}



void CUserInterface::AlertWindow( const TDesC & aMessage ) {

	CUserInterface * self = ( CUserInterface * ) CEikonEnv::Static( )->AppUi( );
	self->AlertWindowInternal( aMessage );

}



void CUserInterface::SwitchToViewL( CViewBase * aNewView ) {

	RemoveCurrentView( );

	AddToStackL( aNewView );

	iView = aNewView;

	// Das ist zB fuer die MapView wichtig damit sie initial gezeichnet
	// wird, falls sie nicht im GPS Modus ist.
	iView->DrawDeferred( );

}



void CUserInterface::SetActiveViewL( CViewBase * aRealView ) {

	iRealView = aRealView;

}



void CUserInterface::UnsetActiveViewL( CViewBase * aRealView ) {

	if ( iRealView == aRealView )
		iRealView = NULL;

}



void CUserInterface::HandleCommandL( TInt aCommand ) {

	switch( aCommand ) {

		/* Main Views */

		case ECmdGpsInfo:
			SwitchToViewL( CGpsInfo::NewL( ClientRect( ) ) );
			break;

		case ECmdGpsTest:
			SwitchToViewL( CGpsTest::NewL( ClientRect( ) ) );
			break;


		/* Special keys */

		case EAknSoftkeyClose:
		case EAknSoftkeyExit:
			Exit( );
			break;


		/* Unknown commands */

		case ECmdUnknown:
			AlertWindowInternal( _L( "Not yet implemented" ) );
			break;


		/* Command forwarding */

		default:
			iView->HandleCommandL( aCommand );
			break;
	}

	delete( iDeletedView ); iDeletedView = NULL;

}



void CUserInterface::DynInitMenuBarL( TInt aResourceId, CEikMenuBar * aMenuBar ) {

	if ( iView )
		iView->DynInitMenuBarL( aResourceId, aMenuBar );

}



void CUserInterface::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane * aMenuPane ) {

	if ( iView )
		iView->DynInitMenuPaneL( aResourceId, aMenuPane );

}



void CUserInterface::RemoveCurrentView( ) {

	if ( iView ) {

		iView->RemovingNow( );

		RemoveFromStack( iView );

		delete( iDeletedView ); iDeletedView = iView;
		iView = NULL;
    }

}



void CUserInterface::InfoWindowInternal( const TDesC & aMessage ) {

	iEikonEnv->InfoMsg( aMessage );

}



void CUserInterface::AlertWindowInternal( const TDesC & aMessage ) {

	iEikonEnv->AlertWin( aMessage );

}

⌨️ 快捷键说明

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