?? basicsoundcontainer.cpp
字號:
/*
* ============================================================================
* Name : CBasicSoundContainer from BasicSoundContainer.h
* Part of : BasicSound
* Created : 2006-2-7 by
* Implementation notes:
* Initial content was generated by Series 60 AppWizard.
* Version :
* Copyright:
* ============================================================================
*/
// INCLUDE FILES
#include "BasicSoundContainer.h"
#include <stringloader.h>
#include "basicsound.rsg"
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CBasicSoundContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CBasicSoundContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
SetRect(aRect);
iLabel=new(ELeave)CEikLabel();
iLabel->SetContainerWindowL(*this);
iLabel->SetRect(Rect());
iLabel->SetMopParent(this);
iLabel->SetAlignment(EHCenterVCenter);
iLabel->SetTextL(_L("No sound!"));
ActivateL();
iSound=CMyToneClass::NewL(*this);
}
// Destructor
CBasicSoundContainer::~CBasicSoundContainer()
{
delete iSound;
delete iLabel;
}
// ---------------------------------------------------------
// CBasicSoundContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CBasicSoundContainer::SizeChanged()
{
// TODO: Add here control resize code etc.
}
// ---------------------------------------------------------
// CBasicSoundContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CBasicSoundContainer::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CBasicSoundContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CBasicSoundContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iLabel;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CBasicSoundContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CBasicSoundContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
// TODO: Add your drawing code here
// example code...
gc.SetPenStyle( CGraphicsContext::ENullPen );
gc.SetBrushColor( KRgbGray );
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
gc.DrawRect( aRect );
}
void CBasicSoundContainer::DynInitMenuPaneL(TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
{
}
void CBasicSoundContainer::PlayL()
{
HBufC* textPlaying=StringLoader::LoadLC(R_TEXT_SOUND_PLAYING);
iLabel->SetTextL(*textPlaying);
iLabel->DrawDeferred();
CleanupStack::PopAndDestroy(textPlaying);
iSound->PlayToneL();
}
void CBasicSoundContainer::StopL()
{
iSound->StopL();
}
void CBasicSoundContainer::PlayClipL()
{
iSound->PlayClipL();
}
void CBasicSoundContainer::playStreamL()
{
iSound->PlayStreamL();
}
void CBasicSoundContainer::HandelPlayStopL()
{
HBufC* LabelTextStop;
LabelTextStop=StringLoader::LoadLC(R_TEXT_SOUND_STOP);
iLabel->SetTextL(*LabelTextStop);
iLabel->DrawDeferred();
CleanupStack::PopAndDestroy(LabelTextStop);
}
// End of File
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -