www.pudn.com > Audio_Streaming_Example_v1_0.zip > AudioStreamView.cpp
/* * ============================================================================ * Name : CAudioStreamView from AudioStreamView.h * Part of : AudioStream * Created : 24.11.2003 by Nokia Forum * Implementation notes: * Initial content was generated by Series 60 AppWizard. * Version : * Copyright: Nokia Corporation * ============================================================================ */ // INCLUDE FILES #include// Fonts #include // 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 ); iLabel->SetFont( LatinBold12() ); // 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::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*/) { // TODO: Add your control event handler code here } // ---------------------------------------------------------------------------- // CAudioStreamView::ShowMessageL(const TDesC& aMsg) // // displays status messages to user // ---------------------------------------------------------------------------- void CAudioStreamView::ShowMessageL(const TDesC& aMsg) { iLabel->SetTextL(aMsg); DrawNow(); } // End of File