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

📄 progressbarexamappview.cpp

📁 国内著名嵌入式培训机构内部资料,内含一些实例代码,包括技术专题书籍
💻 CPP
字号:
/*
 ============================================================================
 Name		: ProgressBarExamAppView.cpp
 Author	  : Hou maoqing
 Copyright   : Copyright (c) Hou maoqing 2008
 Description : Application view implementation
 ============================================================================
 */

// INCLUDE FILES
#include <coemain.h>
#include "ProgressBarExamAppView.h"

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

// -----------------------------------------------------------------------------
// CProgressBarExamAppView::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CProgressBarExamAppView* CProgressBarExamAppView::NewL(const TRect& aRect)
	{
	CProgressBarExamAppView* self = CProgressBarExamAppView::NewLC(aRect);
	CleanupStack::Pop(self);
	return self;
	}

// -----------------------------------------------------------------------------
// CProgressBarExamAppView::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CProgressBarExamAppView* CProgressBarExamAppView::NewLC(const TRect& aRect)
	{
	CProgressBarExamAppView* self = new ( ELeave ) CProgressBarExamAppView;
	CleanupStack::PushL(self);
	self->ConstructL(aRect);
	return self;
	}

// -----------------------------------------------------------------------------
// CProgressBarExamAppView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CProgressBarExamAppView::ConstructL(const TRect& aRect)
	{
	// Create a window for this application view
	CreateWindowL();

	// Set the windows size
	SetRect(aRect);
	
	TRect rectProgress(Rect());
	rectProgress.iTl.iX+=5;
	rectProgress.iTl.iY+=rectProgress.Height()*2/5;
	rectProgress.iBr.iX-=5;
	rectProgress.iBr.iY=rectProgress.iTl.iY+rectProgress.Height()/5;
	
	m_pProgressBar=new (ELeave) CProgressBarCtrl;
	m_pProgressBar->ConstructL(this,rectProgress);
	m_pProgressBar->SetContainerWindowL(*this);
	m_pProgressBar->SetRect(rectProgress);
	m_pProgressBar->SetTotalProgress(100);
	
	// Activate the window, which makes it ready to be drawn
	ActivateL();
	}

// -----------------------------------------------------------------------------
// CProgressBarExamAppView::CProgressBarExamAppView()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CProgressBarExamAppView::CProgressBarExamAppView()
	{
	m_pProgressBar=NULL;
	}

// -----------------------------------------------------------------------------
// CProgressBarExamAppView::~CProgressBarExamAppView()
// Destructor.
// -----------------------------------------------------------------------------
//
CProgressBarExamAppView::~CProgressBarExamAppView()
	{
	if(m_pProgressBar)
		{
		delete m_pProgressBar;
		m_pProgressBar=NULL;
		}
	}

// -----------------------------------------------------------------------------
// CProgressBarExamAppView::Draw()
// Draws the display.
// -----------------------------------------------------------------------------
//
void CProgressBarExamAppView::Draw(const TRect& /*aRect*/) const
	{
	// Get the standard graphics context
	CWindowGc& gc = SystemGc();

	// Gets the control's extent
	TRect drawRect(Rect());

	// Clears the screen
	gc.Clear(drawRect);

	}

// -----------------------------------------------------------------------------
// CProgressBarExamAppView::SizeChanged()
// Called by framework when the view size is changed.
// -----------------------------------------------------------------------------
//
void CProgressBarExamAppView::SizeChanged()
	{
	DrawNow();
	}

TInt CProgressBarExamAppView::CountComponentControls() const
{
	return 1;
}

CCoeControl* CProgressBarExamAppView::ComponentControl(TInt aIndex) const
{
	if(aIndex==0)
		return this->m_pProgressBar;
	else
		return NULL;
}

TKeyResponse CProgressBarExamAppView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
	{
	return m_pProgressBar->OfferKeyEventL(aKeyEvent,aType);
	}

// End of File

⌨️ 快捷键说明

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