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

📄 s60uiexamplemodel.cpp

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

#include <e32std.h>
#include "S60UIExampleModel.h"

const TInt KMaxHighScores = 5;

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


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


// -----------------------------------------------------------------------------
// CS60UIExampleModel::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CS60UIExampleModel::ConstructL()
    {
    // Initialise Model
    iGameStarted = EFalse;
    }


// -----------------------------------------------------------------------------
// CS60UIExampleModel::~CS60UIExampleModel
// Destructor.
// -----------------------------------------------------------------------------
//
CS60UIExampleModel::~CS60UIExampleModel()
    {
    iHighScores.Close();    
    }

    
// -----------------------------------------------------------------------------
// CS60UIExampleModel::InsertInHighScoresL
// Inserts a name and score into highscores.
// Ordered by score
// Rejected if not in top set (KmaxHighScores)
// -----------------------------------------------------------------------------
//
void CS60UIExampleModel::InsertInHighScoresL(TDesC& aName, TInt aScore)
    {
    THighScore highScore;
    highScore.iScore = aScore;
    highScore.iName = aName.Left(20);
    iHighScores.InsertInSignedKeyOrderAllowRepeatsL(highScore);
    if (iHighScores.Count() > KMaxHighScores)
        {
        iHighScores.Remove(0);
        }

    }


// End of File

⌨️ 快捷键说明

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