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

📄 simplecontrol.cpp

📁 s60源码
💻 CPP
字号:
/**
* 
* @brief Definition of CSimpleControl
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

// INCLUDES

//  Class include
#include "SimpleControl.h"

// System includes

// CONSTANTS


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

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

/**
* Symbian OS 2 phase constructor.
* Constructs the CSimpleControl 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 CSimpleControl
*/
CSimpleControl* CSimpleControl::NewLC(const TRect& aRect, const CCoeControl* aParent)
	{
	CSimpleControl* self = new (ELeave) CSimpleControl;
	CleanupStack::PushL(self);
	self->ConstructL(aRect, aParent);
	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 CSimpleControl::ConstructL(const TRect& aRect, const CCoeControl* aParent)
	{
    if (aParent == NULL)
        {
        // No parent control, so create as window-owning
        CreateWindowL();
        }
    else
        {
        // Part of a compound control, so just share
        // the parent's window
        SetContainerWindowL(*aParent);
        }

	SetRect(aRect);
	ActivateL();
	}

/**
*
* Called by framework when the view size is changed.  Resizes the
* iLabel accordingly.
*
*/
void CSimpleControl::SizeChanged()
	{
	}

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

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

    // Set GC pen & brush styles
    gc.SetPenStyle(CGraphicsContext::ESolidPen);
    gc.SetPenColor(KRgbBlack);
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    gc.SetBrushColor(KRgbRed);

    gc.DrawEllipse(Rect());
	}

// End of File

⌨️ 快捷键说明

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