📄 listdlgcontainer.cpp
字号:
/**
*
* @brief Definition of CListDlgContainer
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
// INCLUDE FILES
// Class include
#include "ListDlgContainer.h"
// System includes
#include <aknselectionlist.h> // CAknSelectionList
#include <akniconarray.h> // CAknIcon
#include <ListDlg.mbg> // icons
#include <ListDlg.rsg> // resources
#include <stringloader.h> // StringLoader
// CONSTANTS
const TInt KNumberOfIcons(2);
// ================= MEMBER FUNCTIONS =======================
/**
* Symbian OS 2nd phase constructor. Creates a Window for the controls, which it contains.
* Constructs a label and adds it to the window, which it then activates.
* @param aRect The rectangle for this window
*/
void CListDlgContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
SetRect(aRect);
ActivateL();
TInt openedItem(0);
// Get the name of the file containing the icons
HBufC* iconFileName;
iconFileName = StringLoader::LoadLC(R_ICON_FILE_NAME); // Pushes iconFileName onto the Cleanup Stack.
// Construct and prepare the dialog
CAknSelectionListDialog* dialog = CAknSelectionListDialog::NewL(openedItem, NULL, 0);
dialog->PrepareLC (R_LISTDLG_DIALOG);
// Create an array of icons, reading them from the file and set them in the dialog
CArrayPtr<CGulIcon>* icons = new(ELeave) CAknIconArray(KNumberOfIcons);
CleanupStack::PushL(icons);
icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmListdlg1player, EMbmListdlg1player_mask));
icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmListdlg2player, EMbmListdlg2player_mask));
dialog->SetIconArrayL(icons); // transferring ownership of icons
CleanupStack::Pop(icons);
// Execute the dialog
if (dialog->RunLD ())
{
PlaySelectedGame(openedItem);
}
CleanupStack::PopAndDestroy(iconFileName);
}
/**
* Symbian OS 2 phase constructor.
* Constructs the CListDlgContainer using the NewLC method, popping
* the constructed object from the CleanupStack before returning it.
*
* @param aRect The rectangle for this window
* @return The newly constructed CListDlgContainer
*/
CListDlgContainer* CListDlgContainer::NewL(const TRect& aRect)
{
CListDlgContainer* self = CListDlgContainer::NewLC(aRect);
CleanupStack::Pop(self);
return self;
}
/**
* Symbian OS 2 phase constructor.
* Constructs the CListDlgContainer using the constructor and ConstructL
* method, leaving the constructed object on the CleanupStack before returning it.
*
* @param aRect The rectangle for this window
* @return The newly constructed CListDlgContainer
*/
CListDlgContainer* CListDlgContainer::NewLC(const TRect& aRect)
{
CListDlgContainer* self = new (ELeave) CListDlgContainer;
CleanupStack::PushL(self);
self->ConstructL(aRect);
return self;
}
/**
* Called by the framework to draw this control. Clears the area in
* aRect.
* @param aRect in which to draw
*/
void CListDlgContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.Clear(aRect);
}
/**
* Plays the currently select game in the iSavedGamesListBox, if one exists.
* This is an empty implementation of this method
*/
void CListDlgContainer::PlaySelectedGame(TInt /*aOpenedItem*/)
{
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -