s60uiexamplehighscoreview.cpp

来自「symbianOS第三版开发与实用教程部分源码和部分试验」· C++ 代码 · 共 127 行

CPP
127
字号
// Copyright (c) 2006 Nokia Corporation.

#include "S60UIExampleHighScoreContainer.h"
#include "S60UIExampleHighScoreView.h"
#include "S60UIExample.hrh"
#include <S60UIExample.rsg>
#include <aknviewappui.h>

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

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

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

// -----------------------------------------------------------------------------
// CS60UIExampleSettingsView::~CS60UIExampleSettingsView()
// Destructor.
// -----------------------------------------------------------------------------
//
CS60UIExampleHighScoreView::~CS60UIExampleHighScoreView()
    {
    delete iContainer;
    }

// -----------------------------------------------------------------------------
// TUid CS60UIExampleHighScoreView::Id()
// Returns the View Id.
// -----------------------------------------------------------------------------
//
TUid CS60UIExampleHighScoreView::Id() const
    {
    return TUid::Uid (ES60UIExampleHighScoreViewId);
    }

// -----------------------------------------------------------------------------
// CS60UIExampleHighScoreView::HandleCommandL()
// Handles the commands.
// -----------------------------------------------------------------------------
//
void CS60UIExampleHighScoreView::HandleCommandL (TInt aCommand)
    {
    switch (aCommand)
        {
        case EAknSoftkeyOk:
            {
            AppUi()->ActivateLocalViewL (TUid::Uid (ES60UIExampleInitialViewId));
            break;
            }

        case EAknSoftkeyCancel:
            {
            AppUi()->ActivateLocalViewL (TUid::Uid (ES60UIExampleInitialViewId));
            break;
            }

        default:
            AppUi()->HandleCommandL (aCommand);	
        } 
    }

// -----------------------------------------------------------------------------
// CS60UIExampleHighScoreView::DoActivateL()
// Creates the Container class object.
// -----------------------------------------------------------------------------
//
void CS60UIExampleHighScoreView::DoActivateL (
                                      const TVwsViewId& /*aPrevViewId*/,
                                      TUid /*aCustomMessageId*/, 
                                      const TDesC8& /*aCustomMessage*/)
    {
    if (!iContainer)
        {
        iContainer = 
                 CS60UIExampleHighScoreContainer::NewL(ClientRect(), iModel);
        iContainer->SetMopParent(this);
        AppUi()->AddToStackL(*this, iContainer);
        }
    }

// -----------------------------------------------------------------------------
// CS60UIExampleHighScoreView::DoDeactivate()
// Deletes the Container class object.
// -----------------------------------------------------------------------------
//
void CS60UIExampleHighScoreView::DoDeactivate()
    {
    if (iContainer)
        {
        // Remove HighScoreView's container from control Stack
        AppUi()->RemoveFromStack(iContainer);
        delete iContainer;
        iContainer = NULL;
        }
    }

// End of File

⌨️ 快捷键说明

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