📄 textimagesoundcontainer2.cpp
字号:
/*
* ============================================================================
* Name : CTextImageSoundContainer2 from TextImageSoundContainer2.cpp
* Part of : TextImageSound
* Created : 2006-4-22 by LiuLiping
* Implementation notes:
* Initial content was generated by Series 60 AppWizard.
* Version :
* Copyright:
* ============================================================================
*/
// INCLUDE FILES
#include "TextImageSoundContainer2.h"
#include <textimagesound.mbg>
#include <aknutils.h>
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CTextImageSoundContainer2::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CTextImageSoundContainer2::ConstructL(const TRect& aRect)
{
CreateWindowL();
LoadBitmap();
SetRect(aRect);
ActivateL();
iSound=Tone::NewL(*this);
}
// Destructor
CTextImageSoundContainer2::~CTextImageSoundContainer2()
{
delete iBitmap;
delete iSound;
}
// ---------------------------------------------------------
// CTextImageSoundContainer2::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CTextImageSoundContainer2::SizeChanged()
{
// TODO: Add here control resize code etc.
}
// ---------------------------------------------------------
// CTextImageSoundContainer2::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CTextImageSoundContainer2::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
// TODO: Add your drawing code here
// example code...
gc.Clear(aRect);
TPoint topLeft(0,0); // create TPoint object for top left of bitmap
gc.BitBlt(topLeft, iBitmap);
}
// ---------------------------------------------------------
// CTextImageSoundContainer2::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CTextImageSoundContainer2::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
// TODO: Add your control event handler code here
}
void CTextImageSoundContainer2::LoadBitmap()
{
iBitmap=new(ELeave)CFbsBitmap();
_LIT(KMBMFILE,"\\system\\apps\\textimagesound\\textimagesound.mbm");
TFileName file(KMBMFILE);
User::LeaveIfError (CompleteWithAppPath (file));
User::LeaveIfError(iBitmap->Load(file,EMbmTextimagesoundNomusic));
}
void CTextImageSoundContainer2::HandelPlayStopL()
{
if(iBitmap)
{
delete iBitmap;
iBitmap = NULL;
}
iBitmap=new(ELeave)CFbsBitmap();
CleanupStack::PushL(iBitmap);
_LIT(KMBMFILE,"\\system\\apps\\textimagesound\\textimagesound.mbm");
TFileName file(KMBMFILE);
User::LeaveIfError (CompleteWithAppPath (file));
User::LeaveIfError(iBitmap->Load(file,EMbmTextimagesoundMusicstop));
CleanupStack::Pop(iBitmap);
DrawNow();
}
void CTextImageSoundContainer2::Play()
{
if(iBitmap)
{
delete iBitmap;
iBitmap = NULL;
}
iBitmap=new(ELeave)CFbsBitmap();
CleanupStack::PushL(iBitmap);
_LIT(KMBMFILE,"\\system\\apps\\textimagesound\\textimagesound.mbm");
TFileName file(KMBMFILE);
User::LeaveIfError (CompleteWithAppPath (file));
User::LeaveIfError(iBitmap->Load(file,EMbmTextimagesoundMusicstart));
CleanupStack::Pop(iBitmap);
DrawNow();
iSound->PlayL();
}
void CTextImageSoundContainer2::Stop()
{
iSound->StopL();
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -