globalquerycontainer.cpp

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

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

// INCLUDE FILES

// Class include
#include "GlobalQueryContainer.h"

// System includes
#include <aknglobalmsgquery.h> // CAknGlobalMsgQuery
#include <globalquery.rsg> // resources
#include <StringLoader.h> // StringLoader

// User includes
#include "GlobalQueryQueryHandlerAO.h" // CGlobalQueryQueryHandlerAO

// CONSTANTS


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

/**
* Symbian OS 2nd phase constructor.  Creates and activates the container. 
* Constructs a query handler active object, and executes a global message query
* which the active object will handle.
* @param aRect The rectangle for this window
*/		
void CGlobalQueryContainer::ConstructL(const TRect& aRect)
	{
	CreateWindowL();
	SetRect(aRect);
	ActivateL();

	// construct and start the query handler
    iQueryHandlerAO = CGlobalQueryQueryHandlerAO::NewL(*this);
	iQueryHandlerAO->Start();

	// construct the global message query
	iGlobalMsgQuery = CAknGlobalMsgQuery::NewL();
	HBufC* header = StringLoader::LoadLC(R_GLOBALQUERY_HEADER_TEXT);
	HBufC* message = StringLoader::LoadLC(R_GLOBALQUERY_MESSAGE_TEXT);

	// execute the global message query 
	iGlobalMsgQuery->ShowMsgQueryL(iQueryHandlerAO->iStatus,
									*message, 
									R_AVKON_SOFTKEYS_OK_CANCEL,
									*header,
									KNullDesC);
	CleanupStack::PopAndDestroy(message);
	CleanupStack::PopAndDestroy(header);
	}

/**
* Symbian OS 2 phase constructor.
* Constructs the CGlobalQueryContainer 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 CGlobalQueryContainer
*/
CGlobalQueryContainer* CGlobalQueryContainer::NewL(const TRect& aRect)
	{
	CGlobalQueryContainer* self = CGlobalQueryContainer::NewLC(aRect);
	CleanupStack::Pop(self);
	return self;
	}

/**
* Symbian OS 2 phase constructor.
* Constructs the CGlobalQueryContainer 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 CGlobalQueryContainer
*/
CGlobalQueryContainer* CGlobalQueryContainer::NewLC(const TRect& aRect)
	{
	CGlobalQueryContainer* self = new (ELeave) CGlobalQueryContainer;
	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 CGlobalQueryContainer::Draw(const TRect& aRect) const
	{
	CWindowGc& gc = SystemGc();
	gc.Clear(aRect);
	}

/**
* Called by the query handler active object when the global message query is dismissed.
* This is a dummy method which shows where handling code could appear.
*/
void CGlobalQueryContainer::CloseGameL()
	{

	}

/** 
* Destructor.  Frees up memory.
*/
CGlobalQueryContainer::~CGlobalQueryContainer()
	{
	delete iQueryHandlerAO;
	delete iGlobalMsgQuery;
	}

//End of File	

⌨️ 快捷键说明

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