alarmorganisersecondview.cpp

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

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

// INCLUDES

//  Class include
#include "AlarmOrganiserSecondView.h"

// System includes
#include <aknviewappui.h>						// CAknViewAppUi
#include <AlarmOrganiser.rsg>					// R_ALARMORGANISER_SECOND_VIEW
#include <eikmenup.h>							// CEikMenuPane

// User includes
#include "AlarmOrganiser.hrh"					// TAlarmOrganiserViewNumber
#include "AlarmOrganiserSecondContainer.h"		// CAlarmOrganiserSecondContainer
#include "AlarmOrganiserSecondEngine.h"			// CAlarmOrganiserSecondEngine

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

/** 
* Destructor.  Frees up memory.
*/
CAlarmOrganiserSecondView::~CAlarmOrganiserSecondView()
	{
	delete iContainer;
	}

/**
* Symbian OS 2 phase constructor.
* Constructs the CAlarmOrganiserSecondView using the NewLC method, popping
* the constructed object from the CleanupStack before returning it.
* 
* @return The newly constructed CAlarmOrganiserSecondView
*/
CAlarmOrganiserSecondView* CAlarmOrganiserSecondView::NewL()
	{
	CAlarmOrganiserSecondView* self = CAlarmOrganiserSecondView::NewLC();
	CleanupStack::Pop(self);
	return self;
	}

/**
* Symbian OS 2 phase constructor.
* Constructs the CAlarmOrganiserSecondView using the constructor and ConstructL 
* method, leaving the constructed object on the CleanupStack before returning it.
* 
* @return The newly constructed CAlarmOrganiserSecondView
*/
CAlarmOrganiserSecondView* CAlarmOrganiserSecondView::NewLC()
	{
	CAlarmOrganiserSecondView* self = new (ELeave) CAlarmOrganiserSecondView();
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}

/**
* Symbian OS 2nd phase constructor.  
* Uses the superclass constructor to construct the view using the 
* R_ALARMORGANISER_SECOND_VIEW resource.
*/ 
void CAlarmOrganiserSecondView::ConstructL()
	{
	BaseConstructL(R_ALARMORGANISER_SECOND_VIEW);
	}

/**
* Called by the framework
* @return The Uid for this view
*/
TUid CAlarmOrganiserSecondView::Id() const
	{
	return TUid::Uid(EAlarmOrganiserSecondViewId);
	}

/**
* Called by the framework when the view is activated.  Constructs the 
* container if necessary, setting this view as its MOP parent, and 
* adding it to the control stack.
*/
void CAlarmOrganiserSecondView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, 
											TUid /*aCustomMessageId*/, 
											const TDesC8& /*aCustomMessage*/)
	{
	if (!iContainer)
		{
		iContainer = CAlarmOrganiserSecondContainer::NewL(ClientRect());
		iContainer->SetMopParent(this);
		AppUi()->AddToStackL(*this, iContainer);
		}	  
	}

/**
* Called by the framework when the view is deactivated.  
* Removes the container from the control stack and deletes it.
*/
void CAlarmOrganiserSecondView::DoDeactivate()
	{
	if (iContainer)
		{
		AppUi()->RemoveFromStack(iContainer);
		delete iContainer;
		iContainer = NULL;
		}
	}

/**
* From CEikAppUi, takes care of command handling for this view.
*
* @param aCommand command to be handled
*/
void CAlarmOrganiserSecondView::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
		case EAknSoftkeyExit:
			{
			AppUi()->HandleCommandL(EEikCmdExit);
			break;
			}
		case EAlarmOrganiserAddAlarm:
			{
			iContainer->AddAlarmL();
			}
		default:
			{
			AppUi()->HandleCommandL(aCommand);
			}
		}
	}

/**
* Updates menu items, dims menu option if there are no entries. Called by the framework
* DynInitMenuPaneL. 
*
* @param aResourceId   resource id of the menu pane 
* @param aMenuPane     menu pane 
*/
void CAlarmOrganiserSecondView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
	{
	if (iContainer->ListBoxEmpty())
		{
		if (aResourceId == R_ALARMORGANISER_SECOND_MENU_PANE)
			{
			aMenuPane->SetItemDimmed(EAlarmOrganiserAddAlarm, ETrue);
			}
		}
	}

// End of File

⌨️ 快捷键说明

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