opponentformappui.cpp

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

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

// INCLUDE FILES

// Class include
#include "OpponentFormAppUi.h"

// System includes
#include <eikmenup.h> // CEikMenuPane
#include <OpponentForm.rsg>

// User includes
#include "OpponentFormContainer.h" // COpponentFormContainer
#include "OpponentForm.hrh" // commands


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

/**
* Symbian OS 2nd phase constructor.  Constructs the application's container, 
* setting itself as the container's MOP parent, and adds it to the control 
* stack.
*/		
void COpponentFormAppUi::ConstructL()
	{
	BaseConstructL();
	iAppContainer = COpponentFormContainer::NewL(ClientRect());
	iAppContainer->SetMopParent(this);
	AddToStackL(iAppContainer);
	}

/**
* Destructor.
* Removes the application's container from the stack and deletes it.
*/	
COpponentFormAppUi::~COpponentFormAppUi()
	{
	if (iAppContainer)
		{
		RemoveFromStack(iAppContainer);
		delete iAppContainer;
		}
	}

/**
* From CEikAppUi, takes care of command handling.
*
* @param aCommand command to be handled
*/
void COpponentFormAppUi::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
	case EOpponentFormCmdNew:
		{
		iAppContainer->NewOpponentL();
		break;
		}
	case EOpponentFormCmdOpen:
		{
		iAppContainer->OpenOpponentL();
		break;
		}
	case EOpponentFormCmdDelete:
		{
		iAppContainer->DeleteOpponentL();
		break;
		}
		case EAknSoftkeyBack:
		case EEikCmdExit:
			{
			Exit();
			break;
			}
		default:
			break;		
		}
	}


void COpponentFormAppUi::DynInitMenuPaneL (TInt aResourceId, CEikMenuPane* aMenuPane)
	{
	if (aResourceId == R_OPPONENTFORM_MENU_PANE)
		{
		TBool dimOpenAndDelete = (iAppContainer->NumberOfOpponents() <= 0);
		
		aMenuPane->SetItemDimmed(EOpponentFormCmdOpen, dimOpenAndDelete);
		aMenuPane->SetItemDimmed(EOpponentFormCmdDelete, dimOpenAndDelete);
		}
	}


// End of File	

⌨️ 快捷键说明

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