imageeditor/plugins/DrawPlugin/src/AnimationAO.cpp
author qifeima <>
Thu, 03 Jun 2010 18:57:10 +0800
changeset 8 18b321db4884
permissions -rw-r--r--
*m enhance

/*
 ============================================================================
 Name		: AnimationAO.cpp
 Author	  : 
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CAnimationAO implementation
 ============================================================================
 */

#include "AnimationAO.h"
// ---------------------------------------------------------------------------
// CAnimationAO()
// ---------------------------------------------------------------------------
//
CAnimationAO::CAnimationAO() :
	CActive(EPriorityStandard) // Standard priority
	{
	}
// ---------------------------------------------------------------------------
// NewLC()
// ---------------------------------------------------------------------------
//
CAnimationAO* CAnimationAO::NewLC()
	{
	CAnimationAO* self = new (ELeave) CAnimationAO();
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}
// ---------------------------------------------------------------------------
// NewL()
// ---------------------------------------------------------------------------
//
CAnimationAO* CAnimationAO::NewL()
	{
	CAnimationAO* self = CAnimationAO::NewLC();
	CleanupStack::Pop(); // self;
	return self;
	}
// ---------------------------------------------------------------------------
// ConstructL()
// ---------------------------------------------------------------------------
//
void CAnimationAO::ConstructL()
	{
	User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer
	CActiveScheduler::Add(this); // Add to scheduler
	}
// ---------------------------------------------------------------------------
// CAnimationAO()
// ---------------------------------------------------------------------------
//
CAnimationAO::~CAnimationAO()
	{
	Cancel(); // Cancel any request, if outstanding
	iTimer.Close(); // Destroy the RTimer object
	}
// ---------------------------------------------------------------------------
// DoCancel()
// ---------------------------------------------------------------------------
//
void CAnimationAO::DoCancel()
	{
	iTimer.Cancel();
	}
// ---------------------------------------------------------------------------
// StartL()
// ---------------------------------------------------------------------------
//
void CAnimationAO::StartL(TTimeIntervalMicroSeconds32 aDelay)
	{
	Cancel(); // Cancel any request, just to be sure
	iTimer.After(iStatus, aDelay); // Set for later
	SetActive(); // Tell scheduler a request is active
	}
// ---------------------------------------------------------------------------
// RunL()
// ---------------------------------------------------------------------------
//
void CAnimationAO::RunL()
	{
	iTimer.After(iStatus, 33333); // Set for 1 sec later
	SetActive(); 
	iObserver->Notify();
	}
// ---------------------------------------------------------------------------
// RunError()
// ---------------------------------------------------------------------------
//
TInt CAnimationAO::RunError(TInt aError)
	{
	return aError;
	}
// ---------------------------------------------------------------------------
// SetObserver()
// ---------------------------------------------------------------------------
//
void CAnimationAO::SetObserver(MAnimationObserver *aObserver)
	{
	iObserver = aObserver;
	}