clocationexampleappui.cpp

来自「这是一个关于s60基于c++的关于手机地图和定位的代码」· C++ 代码 · 共 111 行

CPP
111
字号
/*
* ============================================================================
*  Name     : clocationexampleappui.cpp
*  Part of  : Location Example
*  Created  : 21.05.2007 by Forum Nokia
*  Description:
*  Version  : 1.0
*  Copyright: Nokia Corporation
* ============================================================================
*/

#include <e32std.h>
#include <locationexample.rsg>
#include "locationexample.pan"
#include "clocationexampleappui.h"
#include "clocationexampleview.h"
#include "clocationexampleengine.h"
#include "locationexample.hrh"


// -----------------------------------------------------------------------------
// CLocationExampleAppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CLocationExampleAppUi::ConstructL()
    {
    // Initialise app UI
    BaseConstructL(EAknEnableSkin);

    // Initialise Views
    iAppView1 = CLocationExampleView::NewL(this);

    // Initialise Engine
    iEngine = CLocationExampleEngine::NewL(iAppView1);

    AddViewL( iAppView1 );
    SetDefaultViewL( *iAppView1 );
    }


CLocationExampleAppUi::~CLocationExampleAppUi()
    {
    delete iEngine;
    }

// -----------------------------------------------------------------------------
// CLocationExampleAppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CLocationExampleAppUi::HandleCommandL( TInt aCommand )
    {
    switch ( aCommand )
        {
        case EEikCmdExit:
        case EAknSoftkeyExit:
            Exit();
            break;

        case ELocationExampleGpsStart:
            {
            iEngine->ActivateGpsL();
            break;
            }
        case ELocationExampleGpsStop:
            {
            iEngine->DeactivateGpsL();
            break;
            }
        case ELocationExampleSendLocation:
            {
            TInt err = iEngine->NumberQueryL();
            if (!err)
                {
                TRAP_IGNORE(iEngine->DoMessageAndSendL(EPositionResponse));
                }
            break;
            }
        case ELocationExampleGetLocation:
            {
            TInt err = iEngine->NumberQueryL();
            if (!err)
                {
                TRAP_IGNORE(iEngine->DoMessageAndSendL(EPositionRequest));
                }
            break;
            }
        default:
            Panic( ELocationExampleViewsBasicUi );
            break;
        }
    }

// -----------------------------------------------------------------------------
// CLocationExampleAppUi::HandleResourceChangeL()
// Called by framework when layout is changed.
// -----------------------------------------------------------------------------
//
void CLocationExampleAppUi::HandleResourceChangeL( TInt aType )
    {
    CAknAppUi::HandleResourceChangeL( aType );
       
    if ( aType==KEikDynamicLayoutVariantSwitch )
        {
        iAppView1->HandleSizeChange(aType);
        }           
    }
    
// End of File

⌨️ 快捷键说明

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