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

📄 systemagentappui.cpp

📁 最新官方例子,图形,描述副,基本控件,通讯协议,等等,
💻 CPP
字号:
/**
* 
* @brief Definition of CSystemAgentAppUi
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

// INCLUDE FILES

// Class include
#include "SystemAgentAppUi.h"
#include "SystemAgent.hrh"

// System includes
#include <SystemAgent.rsg>	// R_SYSTEMAGENT_DIALOG

// User includes
#include "SystemAgentDialog.h"	// CSystemAgentDialog
#include "StateVarObserver.h"
#include "SystemAgentDocument.h"

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

/**
* Symbian OS 2nd phase constructor.  Constructs and executes the application's dialog.
* Creates observers of the state variables which inform the dialog of a change in 
* a state.
*/	
void CSystemAgentAppUi::ConstructL()
	{
	BaseConstructL();

	// Create and initialise the dialog
	iAppDialog = new (ELeave) CSystemAgentDialog;
	iAppDialog->SetMopParent(this);
	iAppDialog->ExecuteLD(R_SYSTEMAGENT_DIALOG);
	AddToStackL(iAppDialog);

	// Create observers of state variables
	iSystemAgentVarObserver = CStateVarObserver::NewL(KUidSystemAgentStateVariable, *iAppDialog);
	iInboxVarObserver = CStateVarObserver::NewL(KUidInboxStatus, *iAppDialog);
	iChargerVarObserver = CStateVarObserver::NewL(KUidChargerStatus, *iAppDialog);
	iNetworkStrengthVarObserver = CStateVarObserver::NewL(KUidNetworkStrength, *iAppDialog);

	// Process the initial values of the state variables
	iSystemAgentVarObserver->ProcessCurrentStateL();
	iInboxVarObserver->ProcessCurrentStateL();
	iChargerVarObserver->ProcessCurrentStateL();
	iNetworkStrengthVarObserver->ProcessCurrentStateL();

	// Start monitoring the state variables for changes
	iSystemAgentVarObserver->StartL();
	iInboxVarObserver->StartL();
	iChargerVarObserver->StartL();
	iNetworkStrengthVarObserver->StartL();
	}

/**
* Destructor.
* Deletes the state variable observer objects.
* Removes the application's dialog from the stack and deletes it.
*/	
CSystemAgentAppUi::~CSystemAgentAppUi()
	{
	delete iSystemAgentVarObserver;
	delete iInboxVarObserver;
	delete iChargerVarObserver;
	delete iNetworkStrengthVarObserver;

	if (iAppDialog)
		{
		RemoveFromStack(iAppDialog);
		delete iAppDialog;
		}
	}



/**
* From CAknAppUi, takes care of command handling.
* Handles requests to change our state variable and requests to exit
*
* @param aCommand command to be handled
*/
void CSystemAgentAppUi::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
		case ESystemAgentChangeSystemAgentState:
			{
			CSystemAgentDocument* doc = static_cast<CSystemAgentDocument*>(Document());
			doc->ChangeSystemAgentStateVarL();
			break;
			}
		case EEikCmdExit:
			{
			Exit();
			break;
			}
		default:
			break;
		}
	}

// End of File	

⌨️ 快捷键说明

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