settingslistsettingitemlist.cpp

来自「最新官方例子,图形,描述副,基本控件,通讯协议,等等,」· C++ 代码 · 共 89 行

CPP
89
字号
/**
* 
* @brief Definition of CSettingsListSettingItemList
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

// INCLUDE FILES

// Class include
#include "SettingsListSettingItemList.h"

// User include
#include "SettingsListSettings.h"

// ================= MEMBER FUNCTIONS =======================

/**
* Constructor.	Takes a copy of the reference to aDifficultyLevel
* @param aDifficultyLevel the level of difficulty which will be set
*/	
CSettingsListSettingItemList::CSettingsListSettingItemList (TSettingsListSettings& aSettings)
: iSettings (aSettings)
	{
	}

/**
*	
* Called by framework when the view size is changed.  Resizes the
* setting list accordingly.
*
*/
void CSettingsListSettingItemList::SizeChanged()
	{
	if (ListBox()) 
		{
		ListBox()->SetRect(Rect());
		}
	}


/**
*	
* Creates the actual setting items for the list, passing
* ownership of them to the calling class.  Each setting
* item has a piece of member data which it sets values in.
*/
CAknSettingItem* CSettingsListSettingItemList::CreateSettingItemL(TInt aIdentifier)
	{
	CAknSettingItem* settingItem = NULL;
	
	switch (aIdentifier)
		{
		case ESettingsListDifficultySettingItem:
			settingItem = new (ELeave) CAknSliderSettingItem(aIdentifier, iSettings.DifficultyLevel());
			break;
		case ESettingsListPlayerNameSettingItem:
			settingItem = new (ELeave) CAknTextSettingItem(aIdentifier, iSettings.PlayerName());
			break;
		case ESettingsListHintsSettingItem:
			settingItem = new (ELeave) CAknBinaryPopupSettingItem (aIdentifier, iSettings.HintsEnabled());
			break;

		}
	return settingItem; // passing ownership
	}

/**
* Causes the edit page for the currently selected setting
* item to be displayed
*/
void CSettingsListSettingItemList::ChangeSelectedItemL()
	{
	EditItemL(ListBox()->CurrentItemIndex(), ETrue);
	}

/**
* Called by the framework whenever an item is selected. 
* Causes the edit page for the currently selected setting item to be displayed and stores
* any changes made.
*/
void CSettingsListSettingItemList::EditItemL (TInt aIndex, TBool aCalledFromMenu)
	{
	CAknSettingItemList::EditItemL(aIndex, aCalledFromMenu);
	(*SettingItemArray())[aIndex]->StoreL();

	}

⌨️ 快捷键说明

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