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

📄 audiostreamview.cpp

📁 S60_Platform_Audio_Streaming_Example 60平台下
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CAudioStreamView from AudioStreamView.h
*  Part of  : AudioStream
*  Created  : April 28, 2006 by Forum Nokia
*  Implementation notes:
*
*     Initial content was generated by S60 AppWizard.
*  Version  : 2.0
*  Copyright: Nokia Corporation
* ============================================================================
*/

// INCLUDE FILES
#include <aknutils.h> 		// Fonts
#include <w32std.h>			// key codes and events

#include "AudioStreamView.h"


CAudioStreamView* CAudioStreamView::NewL(const TRect & aRect, 
										 CAudioStreamEngine* aEngine)
	{
	CAudioStreamView* self = NewLC(aRect, aEngine);
	CleanupStack::Pop(self);
	return self;
	}

CAudioStreamView* CAudioStreamView::NewLC(const TRect & aRect, 
										  CAudioStreamEngine* aEngine)
	{
	CAudioStreamView* self = new (ELeave) CAudioStreamView();
	CleanupStack::PushL(self);
	self->ConstructL(aRect, aEngine);
	return self;
	}

// ----------------------------------------------------------------------------
// CAudioStreamView::ConstructL(const TRect& aRect, 
//								  CAudioStreamEngine* aEngine)
//
// Standard EPOC 2nd phase constructor
// ----------------------------------------------------------------------------
void CAudioStreamView::ConstructL(const TRect& aRect, 
								  CAudioStreamEngine* aEngine)
	{
	iEngine = aEngine;
	// create new window,
    CreateWindowL();
	// create label to display status to user
    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL( *this );
	#ifndef __SERIES60_3X__
		// The default font is too big in 2nd Edition devices
	    iLabel->SetFont( LatinBold12() );      
	#endif
    // set window size
    SetRect(aRect);

	_LIT(KInfo, "Audio streaming example\n");
    iLabel->SetTextL( KInfo );

    // activate window
    ActivateL();    
	}

// ----------------------------------------------------------------------------
// CAudioStreamView::CAudioStreamView()
//
// constructor
// ----------------------------------------------------------------------------
CAudioStreamView::CAudioStreamView():
    iLabel(NULL)
	{
	}

// ----------------------------------------------------------------------------
// CAudioStreamView::~CAudioStreamView()
//
// destructor
// ----------------------------------------------------------------------------
CAudioStreamView::~CAudioStreamView()
	{
    delete iLabel;
    iLabel=NULL;
	}

// ----------------------------------------------------------------------------
// CAudioStreamView::SizeChanged()
//
// called by framework when the view size is changed
// ----------------------------------------------------------------------------
void CAudioStreamView::SizeChanged()
	{
    iLabel->SetRect( Rect() );
	}

// ---------------------------------------------------------
// CAudioStreamView::HandleResourceChange()
// Called by framework when resource is changed.
// ---------------------------------------------------------
//
void CAudioStreamView::HandleResourceChange(TInt aType)
    {
    CCoeControl::HandleResourceChange(aType);

    // ADDED FOR SCALABLE UI SUPPORT
    // *****************************
    if ( aType==KEikDynamicLayoutVariantSwitch )
        {
        TRect rect;
        AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
        SetRect(rect);
        }
    }


// ----------------------------------------------------------------------------
// CAudioStreamView::CountComponentControls() const
// ----------------------------------------------------------------------------
TInt CAudioStreamView::CountComponentControls() const
	{
    return 1;	// return number of controls inside this container
	}

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


// ----------------------------------------------------------------------------
// CAudioStreamView::Draw(const TRect& aRect) const
// ----------------------------------------------------------------------------
void CAudioStreamView::Draw( const TRect& aRect ) const
	{
    CWindowGc& gc = SystemGc();   
    gc.SetPenStyle( CGraphicsContext::ENullPen );
    gc.SetBrushColor( KRgbWhite );
    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
    gc.DrawRect( aRect );
	}


// ----------------------------------------------------------------------------
// CAudioStreamView::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// ----------------------------------------------------------------------------
void CAudioStreamView::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
	{
	}


// ----------------------------------------------------------------------------
// CAudioStreamView::ShowMessageL(const TDesC& aMsg)
//
// displays status messages to user
// ----------------------------------------------------------------------------
void CAudioStreamView::ShowMessageL(const TDesC& aMsg)
	{
	iLabel->SetTextL(aMsg);
	DrawNow();
	}


// End of File  


⌨️ 快捷键说明

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