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

📄 statuspaneview1.cpp

📁 状态栏示例
💻 CPP
字号:
/**
* 
* @brief Definition of CStatusPaneView1
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

// INCLUDES

//  Class include
#include "StatusPaneView1.h"

// System includes
#include <aknviewappui.h>	// CAknViewAppUi
#include <StatusPane.rsg>	// R_StatusPane_VIEW1

// User includes
#include "StatusPaneContainer1.h"	// CStatusPaneContainer1
#include "StatusPane.hrh"	// TStatusPaneViewNumber

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

/** 
* Destructor.  Frees up memory for the iLabel.
*/

CStatusPaneView1::~CStatusPaneView1()
	{
	delete iContainer;
	}

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

/**
* Symbian OS 2 phase constructor.
* Constructs the CStatusPaneView1 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 CStatusPaneView1
*/
CStatusPaneView1* CStatusPaneView1::NewLC()
	{
	CStatusPaneView1* self = new (ELeave) CStatusPaneView1();
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}

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

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

/**
* 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 CStatusPaneView1::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
										 TUid /*aCustomMessageId*/,
										 const TDesC8& /*aCustomMessage*/)
	{
	if (!iContainer)
		{
		iContainer = CStatusPaneContainer1::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 CStatusPaneView1::DoDeactivate()
	{
	if (iContainer)
		{
		AppUi()->RemoveFromStack(iContainer);
		delete iContainer;
		iContainer = NULL;
		}
	}

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


/**
* From CAknView, makes the container redraw when the status pane's size has 
* been changed, e.g. by changing its visibility
*
*/
void CStatusPaneView1::HandleStatusPaneSizeChange()
	{
	iContainer->SetRect (ClientRect());
	}

// End of File

⌨️ 快捷键说明

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