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

📄 lustrationcontainer.cpp

📁 一个简单的电子驱蚊器程序,通过调用频率发出声音.
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CLustrationContainer from LustrationContainer.h
*  Part of  : Lustration
*  Created  : 2006-03-16 by 
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: 
* ============================================================================
*/

// INCLUDE FILES
#include "LustrationContainer.h"
#include <eikenv.h>
#include <StringLoader.h>
#include <fbs.h>
#include <gdi.h>
#include <Lustration.rsg>
#include <Lustration.mbg>
#include <aknnotewrappers.h> 


// CONSTANTS
const TInt KHorizOffset = 5;
const TInt KVertOffset = 2;
const TInt KTextMaxLength = 50;
const TInt KBaselineDivider = 2;

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

// ---------------------------------------------------------
// CLustrationContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
CLustrationContainer::CLustrationContainer()
{

}

CLustrationContainer* CLustrationContainer::NewL(const TRect& aRect)
	{
	CLustrationContainer* self = new (ELeave) CLustrationContainer();
	CleanupStack::PushL(self);
	self->ConstructL(aRect);
	CleanupStack::Pop(self);
	return self;
	}

void CLustrationContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();
    SetRect(aRect);
	/*
	iBitmap = new( ELeave ) CFbsBitmap();
	_LIT( KDrawBitmapPath, "z:\\system\\apps\\Lustration\\Lustration.mbm" );
	User::LeaveIfError( iBitmap->Load( KDrawBitmapPath, EMbmLustrationWz01 ) );
	*/
    ActivateL();
	DrawDeferred();
	
	iAdapater = CToneAdapater::NewL( *this );
    }

// Destructor
CLustrationContainer::~CLustrationContainer()
    {
		delete iBitmap;
		delete iAdapater;
    }
// ---------------------------------------------------------
// CLustrationContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CLustrationContainer::SizeChanged()
    {
    // TODO: Add here control resize code etc.

    }

// ---------------------------------------------------------
// CLustrationContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CLustrationContainer::CountComponentControls() const
    {
    return 0; // return nbr of controls inside this container
    }

// ---------------------------------------------------------
// CLustrationContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CLustrationContainer::ComponentControl(TInt aIndex) const
    {
    switch ( aIndex )
        {
		case 0:
        default:
            return NULL;
        }
    }

// ---------------------------------------------------------
// CLustrationContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CLustrationContainer::Draw(const TRect& /*aRect*/) const
    {
    CWindowGc& gc = SystemGc();
    // TODO: Add your drawing code here
	gc.Clear(Rect());

	CFont* fontUsed = (CFont*)iEikonEnv->TitleFont();
	gc.UseFont(fontUsed);
	gc.SetPenColor(KRgbBlack);
	TBuf<20> text;
	StringLoader::Load(text, R_LUSTRATION_TXT1);
	gc.DrawText(text,TPoint(10,30));
	StringLoader::Load(text, R_LUSTRATION_TXT2);
	gc.DrawText(text,TPoint(25,60));
	StringLoader::Load(text, R_LUSTRATION_TXT3);
	gc.DrawText(text,TPoint(60,90));
	gc.DiscardFont();

    }

// ---------------------------------------------------------
// CLustrationContainer::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CLustrationContainer::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
    {
    // TODO: Add your control event handler code here
    }

void CLustrationContainer::HandlePlayingStoppedL()
{

}

void CLustrationContainer::PlayToneL( TInt aA )
	{		
	TInt c = aA;
	iAdapater->PlayToneL(c);
	}

void CLustrationContainer::StopL()
	{
	iAdapater->Stop();
	}

// End of File  

⌨️ 快捷键说明

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