navigationpaneview1.cpp

来自「symbian 下浏览器调用实现的完整源码。可以用了封装自己浏览器。」· C++ 代码 · 共 148 行

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

// INCLUDES

//  Class include
#include "NavigationPaneView1.h"

// System includes
#include <aknviewappui.h>	// CAknViewAppUi
#include <NavigationPane.rsg>	// R_NavigationPane_VIEW1

// User includes
#include "NavigationPaneContainer1.h"	// CNavigationPaneContainer1
#include "NavigationPane.hrh"	// TNavigationPaneViewNumber

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

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

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

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

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

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

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

/**
* 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 CNavigationPaneView1::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
										 TUid /*aCustomMessageId*/,
										 const TDesC8& /*aCustomMessage*/)
	{
	if (!iContainer)
		{
		iContainer = CNavigationPaneContainer1::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 CNavigationPaneView1::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 CNavigationPaneView1::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 CNavigationPaneView1::HandleStatusPaneSizeChange()
	{
	iContainer->SetRect (ClientRect());
	}

// End of File

⌨️ 快捷键说明

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