📄 dataquerycontainer.cpp
字号:
/**
*
* @brief Definition of CDataQueryContainer
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
// INCLUDE FILES
// Class include
#include "DataQueryContainer.h"
// System includes
#include <aknquerydialog.h> // CAknQueryDialog
#include <dataquery.rsg> // resources
#include <stringloader.h> // StringLoader
// User includes
#include "dataquery.hrh" // constants
// CONSTANTS
// ================= 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 CDataQueryContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
SetRect(aRect);
ActivateL();
}
/**
* Symbian OS 2 phase constructor.
* Constructs the CDataQueryContainer 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 CDataQueryContainer
*/
CDataQueryContainer* CDataQueryContainer::NewL(const TRect& aRect)
{
CDataQueryContainer* self = CDataQueryContainer::NewLC(aRect);
CleanupStack::Pop(self);
return self;
}
/**
* Symbian OS 2 phase constructor.
* Constructs the CDataQueryContainer 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 CDataQueryContainer
*/
CDataQueryContainer* CDataQueryContainer::NewLC(const TRect& aRect)
{
CDataQueryContainer* self = new (ELeave) CDataQueryContainer;
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 CDataQueryContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.Clear(aRect);
}
/**
* Called by the AppUi when Exit is selected from the Options menu.
* Queries whether to save the game. If yes, then queries the name for the
* saved game and saves the game to file.
*/
void CDataQueryContainer::SaveGameL() const
{
CAknQueryDialog* saveGameQuery = CAknQueryDialog::NewL();
if (saveGameQuery->ExecuteLD(R_DATAQUERY_CONFIRMATION_QUERY))
{
TBuf<KMaxGameNameLength> gameName;
CAknTextQueryDialog* gameNameQuery = CAknTextQueryDialog::NewL(gameName);
CleanupStack::PushL(gameNameQuery);
HBufC* prompt;
prompt = StringLoader::LoadLC(R_DATA_QUERY_PROMPT); // Pushes prompt onto the Cleanup Stack.
gameNameQuery->SetPromptL(*prompt);
CleanupStack::PopAndDestroy(prompt);
CleanupStack::Pop(gameNameQuery);
if (gameNameQuery->ExecuteLD(R_DATAQUERY_DATA_QUERY))
{
SaveGameToFileL(gameName);
}
}
}
//End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -