s60animationcontainer.cpp

来自「symbian s60 多媒体编程实例」· C++ 代码 · 共 80 行

CPP
80
字号
/*
* ============================================================================
*  Name     : CS60AnimationContainer from S60AnimationContainer.h
*  Part of  : S60Animation
*  Created  : 31.01.2006 by ToBeReplacedByAuthor
*  Implementation notes:
*     Initial content was generated by Series 60 Application Wizard.
*  Version  :
*  Copyright: ToBeReplacedByCopyright
* ============================================================================
*/

// INCLUDE FILES
#include <barsread.h>
#include <coemain.h>
#include <aknbitmapanimation.h>
#include <S60Animation.rsg>

#include "S60AnimationContainer.h"



// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CS60AnimationContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CS60AnimationContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    StartL();

    SetRect(aRect);
    ActivateL();
    }

// Destructor
CS60AnimationContainer::~CS60AnimationContainer()
    {
    Stop();
    }

void CS60AnimationContainer::StartL()
    {
    Stop();
    iBitmapAnimation  = CAknBitmapAnimation::NewL();
    TResourceReader reader;
    iCoeEnv->CreateResourceReaderLC(reader, R_S60ANIMATION_BMPANIM_DATA);
    iBitmapAnimation->ConstructFromResourceL(reader);
    iBitmapAnimation->SetContainerWindowL(*this);
    CleanupStack::PopAndDestroy(); // reader 
    iBitmapAnimation ->StartAnimationL();
    }

void CS60AnimationContainer::Stop()
    {
    if(iBitmapAnimation!=NULL)
        {
        iBitmapAnimation->CancelAnimation();
        delete iBitmapAnimation;
        iBitmapAnimation=NULL;
        }
    }

// ---------------------------------------------------------
// CS60AnimationContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CS60AnimationContainer::Draw(const TRect&/* aRect*/) const
    {
    CWindowGc& gc = SystemGc();
    gc.SetBrushColor(KRgbGray);
    gc.Clear();
    }

// End of File  

⌨️ 快捷键说明

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