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

📄 s60uiexampleplayview.cpp

📁 《Symbian S60第3版手机程序开发与实用教程》光盘源代码
💻 CPP
字号:
// Copyright (c) 2006 Nokia Corporation.

#include "S60UIExamplePlayView.h"
#include "S60UIExamplePlayContainer.h"
#include "S60UIExampleModel.h"
#include "S60UIExample.hrh"
#include <aknviewappui.h>
#include <S60UIExample.rsg>
#include <stringloader.h>    

// -----------------------------------------------------------------------------
// CS60UIExamplePlayView::CS60UIExamplePlayView()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CS60UIExamplePlayView::CS60UIExamplePlayView(CS60UIExampleModel& aModel)
    :iModel(aModel)
    {
    // No implementation required
    }


// -----------------------------------------------------------------------------
// CS60UIExamplePlayView::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CS60UIExamplePlayView* CS60UIExamplePlayView::NewL(CS60UIExampleModel& aModel)
    {
    CS60UIExamplePlayView* self = CS60UIExamplePlayView::NewLC(aModel);
    CleanupStack::Pop(self);
    return self;
    }


// -----------------------------------------------------------------------------
// CS60UIExamplePlayView::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CS60UIExamplePlayView* CS60UIExamplePlayView::NewLC(CS60UIExampleModel& aModel)
    {
    CS60UIExamplePlayView* self = new (ELeave) CS60UIExamplePlayView(aModel);
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
    }


// -----------------------------------------------------------------------------
// CS60UIExamplePlayView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CS60UIExamplePlayView::ConstructL()
    {
    BaseConstructL(R_S60UIEXAMPLE_PLAYVIEW);
    }


// -----------------------------------------------------------------------------
// CS60UIExamplePlayView::~CS60UIExamplePlayView()
// Destructor.
// -----------------------------------------------------------------------------
//
CS60UIExamplePlayView::~CS60UIExamplePlayView()
    {
    // No implementation required
    }


// -----------------------------------------------------------------------------
// CS60UIExamplePlayView::Id()
// Returns View's ID.
// -----------------------------------------------------------------------------
//
TUid CS60UIExamplePlayView::Id() const
    {
    return TUid::Uid(ES60UIExamplePlayViewId);
    }


// -----------------------------------------------------------------------------
// CS60UIExamplePlayView::DoActivateL()
// Activate the View
// -----------------------------------------------------------------------------
//
void CS60UIExamplePlayView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
                                        TUid /*aCustomMessageId*/,
                                        const TDesC8& /*aCustomMessage*/)
    {
    iContainer = CS60UIExamplePlayContainer::NewL(ClientRect(), iModel);
    AppUi()->AddToViewStackL(*this, iContainer);
    }


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


// -----------------------------------------------------------------------------
// CS60UIExamplePlayView::HandleCommandL()
// Takes care of Command handling.
// -----------------------------------------------------------------------------
//
void CS60UIExamplePlayView::HandleCommandL(TInt aCommand)
    {
    switch (aCommand)
        {
        case ES60UIExampleStopGame:
            {
            iModel.GameStop();
            // Switch back to initial view
            AppUi()->ActivateLocalViewL(TUid::Uid(ES60UIExampleInitialViewId));
            break;
            }
            
        case ES60UIExampleStartGame:
            {
            iModel.GameStart();
            // Get reset scores to navi pane
            iContainer->UpdateNaviPaneL();
            // Draw game image (without paused text)
            iContainer->DrawNow();
            break;
            }
            
        case ES60UIExampleContinueGame:
            iModel.GameContinue();
            // Draw game image (without paused text)
            iContainer->DrawNow();
            break;
            
        case ES60UIExamplePauseGame:
            iModel.GamePause();
            // Draw game image (with paused text)
            iContainer->DrawNow();
            break;
            
        default:
            // pass anything else to the AppUi
            AppUi()->HandleCommandL(aCommand);
        }

    }

// End of File

⌨️ 快捷键说明

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