hellocontainer.cpp

来自「symbian中讲述的一个有关设置title和icon的例子」· C++ 代码 · 共 124 行

CPP
124
字号
/*
* ============================================================================
*  Name     : CHelloContainer from CCoeControl, MCoeControlObserver
*  Part of  : Hello
*  Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/

// INCLUDE FILES


#include <MyHello.rsg>
#include "MyHello.hrh"
#include "HelloContainer.h"


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

// C++ default constructor can NOT contain any code, that
// might leave.
//
CHelloContainer::CHelloContainer()
    {
    }

// EPOC default constructor can leave.
void CHelloContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    SetRect(aRect);
    ActivateL();
    }

// Destructor
CHelloContainer::~CHelloContainer()
    {
    }

// ---------------------------------------------------------
// CHelloContainer::FocusTo(TInt aCommand)
// Change foccused control.
// (other items were commented in a header).
// ---------------------------------------------------------
//

void CHelloContainer::FocusTo(TInt aCommand)
    {
    }

// ---------------------------------------------------------
// CHelloContainer::SizeChanged()
// Called by framework when the view size is changed
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CHelloContainer::SizeChanged()
    {
    }

// ---------------------------------------------------------
// CHelloContainer::CountComponentControls() const
// (other items were commented in a header).
// ---------------------------------------------------------
//
TInt CHelloContainer::CountComponentControls() const
    {
		return 0; // return nbr of controls inside this container
    }

// ---------------------------------------------------------
// CHelloContainer::ComponentControl(TInt aIndex) const
// (other items were commented in a header).
// ---------------------------------------------------------
//
CCoeControl* CHelloContainer::ComponentControl(TInt aIndex) const
    {
		return NULL;
    }

// ---------------------------------------------------------
// CHelloContainer::Draw(const TRect& aRect) const
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CHelloContainer::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    //gc.SetPenStyle(CGraphicsContext::ENullPen);
    gc.SetBrushColor(KRgbBlue);
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    gc.DrawRect(aRect);

	gc.SetPenStyle(CGraphicsContext::ESolidPen);
	gc.SetPenColor(KRgbRed);
	gc.DrawLine(TPoint(50,50), TPoint(100,90));
    }

// ---------------------------------------------------------
// CHelloContainer::OfferKeyEventL(...)
// Notify key events to editors.
// (other items were commented in a header).
// ---------------------------------------------------------
//
TKeyResponse CHelloContainer::OfferKeyEventL(
    const TKeyEvent& aKeyEvent, TEventCode aType)
	{
		return EKeyWasNotConsumed;
	}


// ---------------------------------------------------------
// CHelloContainer::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CHelloContainer::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
    {
    }

// End of File  

⌨️ 快捷键说明

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