?? clocationexampleview.cpp
字號:
/*
* ============================================================================
* Name : clocationexampleview.cpp
* Part of : Location Example
* Created : 21.05.2007 by Forum Nokia
* Description:
* Version : 1.0
* Copyright: Nokia Corporation
* ============================================================================
*/
// INCLUDE FILES
#include <aknviewappui.h>
#include <aknconsts.h>
#include <aknutils.h>
#include <locationexample.rsg>
#include "clocationexampleengine.h"
#include "clocationexampleview.h"
#include "clocationexamplecontainer.h"
#include "locationexample.hrh"
// ========================= MEMBER FUNCTIONS ==================================
// -----------------------------------------------------------------------------
// CLocationExampleView::CLocationExampleView()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CLocationExampleView::CLocationExampleView(CLocationExampleAppUi* aParent) : iContainer(NULL), iParent(aParent)
{
}
// -----------------------------------------------------------------------------
// CLocationExampleView::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CLocationExampleView* CLocationExampleView::NewL(CLocationExampleAppUi* aParent)
{
CLocationExampleView* self = CLocationExampleView::NewLC(aParent);
CleanupStack::Pop( self );
return self;
}
// -----------------------------------------------------------------------------
// CLocationExampleView::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CLocationExampleView* CLocationExampleView::NewLC(CLocationExampleAppUi* aParent)
{
CLocationExampleView* self = new ( ELeave ) CLocationExampleView(aParent);
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
// -----------------------------------------------------------------------------
// CLocationExampleView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CLocationExampleView::ConstructL()
{
BaseConstructL(R_LOCATIONEXAMPLE_VIEW1);
}
// -----------------------------------------------------------------------------
// CLocationExampleView::~CLocationExampleView()
// Destructor.
// -----------------------------------------------------------------------------
//
CLocationExampleView::~CLocationExampleView()
{
}
// -----------------------------------------------------------------------------
// CLocationExampleView::Id()
// Returns View's ID.
// -----------------------------------------------------------------------------
//
TUid CLocationExampleView::Id() const
{
return TUid::Uid( ELocationExampleView1Id );
}
// -----------------------------------------------------------------------------
// CLocationExampleView::DoActivateL()
// Activate an MultiView1
// -----------------------------------------------------------------------------
//
void CLocationExampleView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
if (!iContainer)
{
iContainer = new (ELeave) CLocationExampleContainer(this);
iContainer->ConstructL(ClientRect());
}
AppUi()->AddToStackL(iContainer);
}
// -----------------------------------------------------------------------------
// CLocationExampleView::DoDeactivate()
// DeActivate an MultiView1
// -----------------------------------------------------------------------------
//
void CLocationExampleView::DoDeactivate()
{
if ( iContainer )
{
// Remove View1's container form controllStack
AppUi()->RemoveFromStack( iContainer );
delete iContainer;
iContainer = NULL;
}
}
// -----------------------------------------------------------------------------
// CLocationExampleView::DynInitMenuPaneL()
//
// -----------------------------------------------------------------------------
//
void CLocationExampleView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
{
if (aResourceId == R_LOCATIONEXAMPLE_SUBMENU)
{
DoMainMenuL(aMenuPane);
}
}
// -----------------------------------------------------------------------------
// CLocationExampleView::DoMainMenuL()
// -----------------------------------------------------------------------------
//
void CLocationExampleView::DoMainMenuL(CEikMenuPane* aMenuPane)
{
if (!Engine())
return;
switch (Engine()->GetEngineState())
{
case EIdle:
{
//aMenuPane->SetItemDimmed(ELocationExampleGpsStart,ETrue);
aMenuPane->SetItemDimmed(ELocationExampleGpsStop,ETrue);
aMenuPane->SetItemDimmed(ELocationExampleSendLocation,ETrue);
aMenuPane->SetItemDimmed(ELocationExampleGetLocation,ETrue);
break;
}
case EScanningGps:
{
aMenuPane->SetItemDimmed(ELocationExampleGpsStart,ETrue);
//aMenuPane->SetItemDimmed(ELocationExampleGpsStop,ETrue);
//aMenuPane->SetItemDimmed(ELocationExampleSendLocation,ETrue);
//aMenuPane->SetItemDimmed(ELocationExampleGetLocation,ETrue);
break;
}
default:
{
aMenuPane->SetItemDimmed(ELocationExampleGpsStart,ETrue);
aMenuPane->SetItemDimmed(ELocationExampleGpsStop,ETrue);
aMenuPane->SetItemDimmed(ELocationExampleSendLocation,ETrue);
aMenuPane->SetItemDimmed(ELocationExampleGetLocation,ETrue);
break;
}
}
}
// -----------------------------------------------------------------------------
// CLocationExampleView::HandleCommandL()
// Takes care of Command handling.
// -----------------------------------------------------------------------------
//
void CLocationExampleView::HandleCommandL( TInt aCommand )
{
switch (aCommand)
{
case ELocationExampleGpsStop:
{
if ( iContainer )
{
iContainer->ResetListBoxL();
}
AppUi()->HandleCommandL( aCommand );
break;
}
default:
{
AppUi()->HandleCommandL( aCommand );
break;
}
};
}
// -----------------------------------------------------------------------------
// CLocationExampleView::HandleSizeChange()
// Called by HandleResourceChangeL() from CLocationExampleAppUi when layout is
// changed.
// -----------------------------------------------------------------------------
//
void CLocationExampleView::HandleSizeChange( TInt aType )
{
if( iContainer )
{
iContainer->HandleResourceChange( aType );
if ( aType==KEikDynamicLayoutVariantSwitch )
{
TRect rect;
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
iContainer->SetRect(rect);
}
}
}
// -----------------------------------------------------------------------------
// CLocationExampleView::PositionInfoUpdatedL()
// -----------------------------------------------------------------------------
//
void CLocationExampleView::PositionUpdatedL(TPositionInfoBase& aPosInfo)
{
if (iContainer)
{
iContainer->PositionUpdatedL(aPosInfo);
}
}
// -----------------------------------------------------------------------------
// CLocationExampleView::FriendPositionUpdatedL()
// -----------------------------------------------------------------------------
//
void CLocationExampleView::FriendPositionUpdatedL(const TDesC& aInfo, const TCoordinate& aCoordinate)
{
if (iContainer)
{
iContainer->FriendPositionUpdatedL(aInfo,aCoordinate);
}
}
// -----------------------------------------------------------------------------
// CLocationExampleView::ShowErrorL()
// -----------------------------------------------------------------------------
//
void CLocationExampleView::ErrorL(const TDesC& aErrorString)
{
if (iContainer)
{
iContainer->ErrorL(aErrorString);
}
}
// -----------------------------------------------------------------------------
// CLocationExampleView::ShowMessageL()
// -----------------------------------------------------------------------------
//
void CLocationExampleView::MessageL(const TDesC& aMessage)
{
if (iContainer)
{
iContainer->MessageL(aMessage);
}
}
// End of File
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -