📄 imagesviewercontainer2.cpp
字号:
/*
============================================================================
Name : CImagesViewerContainer2 from ImagesViewerContainer2.cpp
Author :
Version :
Copyright : Your copyright notice
Description : Container control implementation
============================================================================
*/
// INCLUDE FILES
#include "ImagesViewerContainer2.h"
#include <EIKENV.H>
_LIT(KGifFileName, "c:\\Nokia\\Images\\Pictures\\test.gif");
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CImagesViewerContainer2::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CImagesViewerContainer2::ConstructL(const TRect& aRect)
{
CreateWindowL();
iGifImage = CPAlbImageViewerBasic::NewL(this, aRect);
//iGifImage->SetImageNameAndDisplaymodeL(KGifFileName ,CEikonEnv::Static()->DefaultDisplayMode());
iGifImage->SetAnimationObserver(this, ETrue);
iGifImage->SetContainerWindowL(*this);
TInt err = iGifImage->LoadImageL(KGifFileName, CEikonEnv::Static()->DefaultDisplayMode());
iGifImage->ScaleOptimumL();
SetRect(aRect);
ActivateL();
if(iGifImage->IsAnimation())
iGifImage->PlayAnimationL(); // support image and animation
//iGifImage->PlayAnimationL();
//DrawNow();
}
// Destructor
CImagesViewerContainer2::~CImagesViewerContainer2()
{
delete iGifImage;
}
// ---------------------------------------------------------
// CImagesViewerContainer2::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CImagesViewerContainer2::SizeChanged()
{
// TODO: Add here control resize code etc.
iGifImage->SetExtent(TPoint(Rect().iTl.iX + ((Rect().Width() - iGifImage->MinimumSize().iWidth)>>1),Rect().iTl.iY + ((Rect().Height() - iGifImage->MinimumSize().iHeight)>>1)),iGifImage->MinimumSize());
}
// ---------------------------------------------------------
// CImagesViewerContainer2::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CImagesViewerContainer2::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CImagesViewerContainer2::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CImagesViewerContainer2::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iGifImage;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CImagesViewerContainer2::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CImagesViewerContainer2::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 );*/
}
// ---------------------------------------------------------
// CImagesViewerContainer2::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CImagesViewerContainer2::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
// TODO: Add your control event handler code here
}
void CImagesViewerContainer2::Notify(TAnimationEvent aEvent)
{
/*if (aEvent == EAnimationStarted)
{
if(iGifImage->IsAnimation())
{
iGifImage->PlayAnimationL();
}
}*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -