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

📄 camdecodecontainer.cpp

📁 Symbian 调用摄像头的简单程序。实现了最基本的功能。
💻 CPP
字号:
/*
============================================================================
 Name        : CCamDecodeContainer from CamDecodeContainer.h
 Author      : Augusta
 Version     :
 Copyright   : All Right Reserved
 Description : Container control implementation
============================================================================
*/

// INCLUDE FILES
#include "CamDecodeContainer.h"
#include "CamEngine.h"
//#include <eiklabel.h>  // for example label control

#include<ECam.h>
#include <aknnotewrappers.h>

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

// ---------------------------------------------------------
// CCamDecodeContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CCamDecodeContainer::ConstructL(const TRect& aRect)
	{
	iCamStart=EFalse;
	CreateWindowL();


/*	iLabel = new (ELeave) CEikLabel;
	iLabel->SetContainerWindowL( *this );
	iLabel->SetTextL( _L("                                   ") );*/

    test = CCamEngine::NewL(*this);

	test->Reserve();
/*	iToDoLabel = new (ELeave) CEikLabel;
	iToDoLabel->SetContainerWindowL( *this );
	iToDoLabel->SetTextL( _L("Add Your controls\n here") );*/

	SetRect(aRect);
	ActivateL();
	}

// Destructor
CCamDecodeContainer::~CCamDecodeContainer()
	{
//	delete iLabel;
//	delete iToDoLabel;
		delete test;
	}

// ---------------------------------------------------------
// CCamDecodeContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CCamDecodeContainer::SizeChanged()
	{
	// TODO: Add here control resize code etc.
//	iLabel->SetExtent( TPoint(10,10), iLabel->MinimumSize() );
//	iToDoLabel->SetExtent( TPoint(10,100), iToDoLabel->MinimumSize() );
	}

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

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

// ---------------------------------------------------------
// CCamDecodeContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CCamDecodeContainer::Draw(const TRect& aRect) const
	{
	CWindowGc& gc = SystemGc();
	// TODO: Add your drawing code here
	// example code...
		//CAknWarningNote* warningNote = new ( ELeave ) CAknWarningNote;
		//warningNote->ExecuteLD(_L("in Draw func "));
		if(!iCamStart)
		{
			gc.SetPenStyle( CGraphicsContext::ENullPen );
			gc.SetBrushColor( KRgbGray );
			gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
			gc.DrawRect( aRect );
		}
		else
		{
			//gc.clear();
			gc.BitBlt(TPoint(0,0),iBitmap,TRect(0,0,176,208));
		}
	}

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

void CCamDecodeContainer::ShowMessage(TInt aSum)
    {
		TBuf<20> buf;
		_LIT(aMsg,"the sum is :%d");
		buf.Format(aMsg,aSum);
//		iLabel->SetTextL(buf);
    }
void CCamDecodeContainer::CloseCam()
   {
		test->Exit();
		iCamStart=EFalse;
   }

void CCamDecodeContainer::DrawImageNow(CFbsBitmap* aBitmap)
  {
	  iBitmap=aBitmap;
	  DrawNow();
  }

⌨️ 快捷键说明

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