www.pudn.com > Bluetooth_PMP_Example_v1_0.zip > BluetoothPMPExampleContainer.cpp


/* 
* ============================================================================ 
*  Name     : CBluetoothPMPExampleContainer from BluetoothPMPExampleContainer.h 
*  Part of  : BluetoothPMPExample 
*  Created  : 14.01.2004 by Forum Nokia 
*  Implementation notes: 
*     Initial content was generated by Series 60 AppWizard. 
*  Version  : 
*  Copyright: Nokia Corporation 
* ============================================================================ 
*/ 
 
// INCLUDE FILES 
#include  		// Fonts 
#include  
 
#include "BluetoothPMPExampleContainer.h" 
 
 
CBluetoothPMPExampleContainer* CBluetoothPMPExampleContainer::NewL( 
	const TRect & aRect) 
	{ 
	CBluetoothPMPExampleContainer* self =  
		NewLC(aRect); 
	CleanupStack::Pop(self); 
	return self; 
	} 
 
CBluetoothPMPExampleContainer* CBluetoothPMPExampleContainer::NewLC( 
	const TRect & aRect) 
	{ 
	CBluetoothPMPExampleContainer* self =  
		new (ELeave) CBluetoothPMPExampleContainer; 
	CleanupStack::PushL(self); 
	self->ConstructL(aRect); 
	return self; 
	} 
 
 
// ---------------------------------------------------------------------------- 
// void CBluetoothPMPExampleContainer::ConstructL(const TRect& aRect, 
//										CBluetoothPMPExampleEngine* bEngine) 
// 
// Standard EPOC 2nd phase constructor 
// ---------------------------------------------------------------------------- 
void CBluetoothPMPExampleContainer::ConstructL(const TRect& aRect) 
    { 
	// create new window, 
    CreateWindowL(); 
	// create label to display status to user 
    iLabel = new (ELeave) CEikLabel; 
    iLabel->SetContainerWindowL( *this ); 
    iLabel->SetFont( LatinBold12() );       
    // set window size 
    SetRect(aRect); 
 
	_LIT(KInfo, "Bluetooth PMP example\n"); 
    iLabel->SetTextL( KInfo ); 
 
    // activate window 
    ActivateL(); 
    } 
 
 
// ---------------------------------------------------------------------------- 
// CBluetoothPMPExampleContainer::CBluetoothPMPExampleContainer 
// 
// constructor 
// ---------------------------------------------------------------------------- 
CBluetoothPMPExampleContainer::CBluetoothPMPExampleContainer(): 
    iLabel(NULL) 
	{ 
	} 
 
 
// ---------------------------------------------------------------------------- 
// CBluetoothPMPExampleContainer::~CBluetoothPMPExampleContainer 
// 
// destructor 
// ---------------------------------------------------------------------------- 
CBluetoothPMPExampleContainer::~CBluetoothPMPExampleContainer() 
    { 
    delete iLabel; 
    iLabel=NULL; 
    } 
 
 
// ---------------------------------------------------------------------------- 
// CBluetoothPMPExampleContainer::SizeChanged() 
// 
// called by framework when the view size is changed 
// ---------------------------------------------------------------------------- 
void CBluetoothPMPExampleContainer::SizeChanged() 
    { 
    iLabel->SetRect( Rect() ); 
    } 
 
 
// ---------------------------------------------------------------------------- 
// CBluetoothPMPExampleContainer::CountComponentControls() const 
// ---------------------------------------------------------------------------- 
TInt CBluetoothPMPExampleContainer::CountComponentControls() const 
    { 
    return 1;  
    } 
 
 
// ---------------------------------------------------------------------------- 
// CBluetoothPMPExampleContainer::ComponentControl(TInt aIndex) const 
// ---------------------------------------------------------------------------- 
CCoeControl* CBluetoothPMPExampleContainer::ComponentControl(TInt aIndex) const 
    { 
    switch ( aIndex ) 
        { 
        case 0: 
            return iLabel; 
        default: 
            return NULL; 
        } 
    } 
 
 
// ---------------------------------------------------------------------------- 
// CBluetoothPMPExampleContainer::Draw(const TRect& aRect) const 
// ---------------------------------------------------------------------------- 
void CBluetoothPMPExampleContainer::Draw(const TRect& aRect) const 
    { 
    CWindowGc& gc = SystemGc(); 
    gc.SetPenStyle(CGraphicsContext::ENullPen); 
    gc.SetBrushColor(KRgbWhite); 
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush); 
    gc.DrawRect(aRect); 
    } 
 
 
// ---------------------------------------------------------------------------- 
// CBluetoothPMPExampleContainer::HandleControlEventL( 
//     CCoeControl* aControl,TCoeEvent aEventType) 
// ---------------------------------------------------------------------------- 
void CBluetoothPMPExampleContainer::HandleControlEventL( 
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) 
    { 
    // TODO: Add your control event handler code here 
    } 
 
 
// ---------------------------------------------------------------------------- 
// CBluetoothPMPExampleContainer::ShowMessageL(const TDesC& aMsg) 
// 
// displays status messages to user 
// ---------------------------------------------------------------------------- 
void CBluetoothPMPExampleContainer::ShowMessageL(const TDesC& aMsg) 
	{ 
	iLabel->SetTextL(aMsg); 
	DrawNow(); 
	} 
 
 
// End of File