imageeditor/plugins/DrawPlugin/src/AnimationAO.cpp
changeset 8 18b321db4884
equal deleted inserted replaced
1:edfc90759b9f 8:18b321db4884
       
     1 /*
       
     2  ============================================================================
       
     3  Name		: AnimationAO.cpp
       
     4  Author	  : 
       
     5  Version	 : 1.0
       
     6  Copyright   : Your copyright notice
       
     7  Description : CAnimationAO implementation
       
     8  ============================================================================
       
     9  */
       
    10 
       
    11 #include "AnimationAO.h"
       
    12 // ---------------------------------------------------------------------------
       
    13 // CAnimationAO()
       
    14 // ---------------------------------------------------------------------------
       
    15 //
       
    16 CAnimationAO::CAnimationAO() :
       
    17 	CActive(EPriorityStandard) // Standard priority
       
    18 	{
       
    19 	}
       
    20 // ---------------------------------------------------------------------------
       
    21 // NewLC()
       
    22 // ---------------------------------------------------------------------------
       
    23 //
       
    24 CAnimationAO* CAnimationAO::NewLC()
       
    25 	{
       
    26 	CAnimationAO* self = new (ELeave) CAnimationAO();
       
    27 	CleanupStack::PushL(self);
       
    28 	self->ConstructL();
       
    29 	return self;
       
    30 	}
       
    31 // ---------------------------------------------------------------------------
       
    32 // NewL()
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 CAnimationAO* CAnimationAO::NewL()
       
    36 	{
       
    37 	CAnimationAO* self = CAnimationAO::NewLC();
       
    38 	CleanupStack::Pop(); // self;
       
    39 	return self;
       
    40 	}
       
    41 // ---------------------------------------------------------------------------
       
    42 // ConstructL()
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 void CAnimationAO::ConstructL()
       
    46 	{
       
    47 	User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer
       
    48 	CActiveScheduler::Add(this); // Add to scheduler
       
    49 	}
       
    50 // ---------------------------------------------------------------------------
       
    51 // CAnimationAO()
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 CAnimationAO::~CAnimationAO()
       
    55 	{
       
    56 	Cancel(); // Cancel any request, if outstanding
       
    57 	iTimer.Close(); // Destroy the RTimer object
       
    58 	}
       
    59 // ---------------------------------------------------------------------------
       
    60 // DoCancel()
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 void CAnimationAO::DoCancel()
       
    64 	{
       
    65 	iTimer.Cancel();
       
    66 	}
       
    67 // ---------------------------------------------------------------------------
       
    68 // StartL()
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 void CAnimationAO::StartL(TTimeIntervalMicroSeconds32 aDelay)
       
    72 	{
       
    73 	Cancel(); // Cancel any request, just to be sure
       
    74 	iTimer.After(iStatus, aDelay); // Set for later
       
    75 	SetActive(); // Tell scheduler a request is active
       
    76 	}
       
    77 // ---------------------------------------------------------------------------
       
    78 // RunL()
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 void CAnimationAO::RunL()
       
    82 	{
       
    83 	iTimer.After(iStatus, 33333); // Set for 1 sec later
       
    84 	SetActive(); 
       
    85 	iObserver->Notify();
       
    86 	}
       
    87 // ---------------------------------------------------------------------------
       
    88 // RunError()
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 TInt CAnimationAO::RunError(TInt aError)
       
    92 	{
       
    93 	return aError;
       
    94 	}
       
    95 // ---------------------------------------------------------------------------
       
    96 // SetObserver()
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 void CAnimationAO::SetObserver(MAnimationObserver *aObserver)
       
   100 	{
       
   101 	iObserver = aObserver;
       
   102 	}