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

📄 statuspanecontainer1.cpp

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

// INCLUDES

//  Class include
#include "StatusPaneContainer1.h"

// System includes
#include <eiklabel.h>	// CEikLabel
#include <StatusPane.rsg>	// R_LABEL1_TEXT
#include <stringloader.h>	// StringLoader

// CONSTANTS

// N.B. #define'd as DLL cannot contain writeable static data
#define KLabelPosition TPoint(10,10) 

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

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

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

/**
* Symbian OS 2nd phase constructor.  Creates a Window for the controls, which it contains.
* Constructs a label and adds it to the window, which it then activates.
* @param aRect The rectangle for this window
*/ 
void CStatusPaneContainer1::ConstructL(const TRect& aRect)
	{
	CreateWindowL();
	iLabel = new (ELeave) CEikLabel;
	iLabel->SetContainerWindowL(*this);
	
	HBufC* labelText;
	labelText = StringLoader::LoadLC(R_LABEL1_TEXT);	// Pushes labelText onto the Cleanup Stack.
	iLabel->SetTextL(*labelText);
	CleanupStack::PopAndDestroy(labelText);
	
	SetRect(aRect);
	ActivateL();
	}

/**
*
* Called by framework when the view size is changed.  Resizes the
* iLabel accordingly.
*
*/
void CStatusPaneContainer1::SizeChanged()
	{
	iLabel->SetExtent(KLabelPosition, iLabel->MinimumSize());
	}

/**
* Called by the framework in compound controls	
* @return The number of controls in this CStatusPaneContainer1
*/
TInt CStatusPaneContainer1::CountComponentControls() const
	{
	return 1;
	}

/**
* Called by the framework in compound controls	
* @param The index of the control to return
* @return The control for aIndex
*/
CCoeControl* CStatusPaneContainer1::ComponentControl(TInt aIndex) const
	{
	switch (aIndex)
		{
		case 0:
			return iLabel;
		default:
			return NULL;
		}
	}

/** 
* Destructor.  Frees up memory for the iLabel.
*/
CStatusPaneContainer1::~CStatusPaneContainer1()
	{
	delete iLabel;
	}

/**
* Called by the framework to draw this control.  Clears the area in 
* aRect.
* @param aRect in which to draw
*/
void CStatusPaneContainer1::Draw(const TRect& aRect) const
	{
	CWindowGc& gc = SystemGc();
	gc.Clear(aRect);
	}

// End of File

⌨️ 快捷键说明

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