svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/SvgRenderFrameTimer.cpp
branchRCL_3
changeset 20 5fd161fa28b6
parent 0 632761c941a7
equal deleted inserted replaced
17:e52958d06c29 20:5fd161fa28b6
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  ECOM Implementation Array.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "SvgRenderFrameTimer.h"
       
    20 #include "SvgRenderFrameControl.h"
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 // -----------------------------------------------------------------------------
       
    25 // CSvgRenderFrameTimer::CSvgRenderFrameTimer
       
    26 // Default Constructor. Initialises Timer State Variables.
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 CSvgRenderFrameTimer::CSvgRenderFrameTimer( MSvgRenderFrameTimerListener* 
       
    30         aListener) : // Listener for the pointer inactivity
       
    31     CTimer( CActive::EPriorityStandard ), iListener( aListener )
       
    32     {
       
    33     }
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CSvgRenderFrameTimer::ConstructL
       
    37 // Second Phase Constructor for CSvgRenderFrameTimer. Adds this object to the 
       
    38 // applications active scheduler.
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 void CSvgRenderFrameTimer::ConstructL()
       
    42     {
       
    43     // Call the base class ConstructL
       
    44     CTimer::ConstructL();
       
    45     // Add to active scheduler
       
    46     CActiveScheduler::Add( this );
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CSvgRenderFrameTimer::NewLC
       
    51 // Factory function for creating CSvgRenderFrameTimer objects. It also 
       
    52 // pushes the created dialog object onto the cleanup stack.
       
    53 // Returns: CSvgRenderFrameTimer* ; Pointer to the created object.
       
    54 //          Leaves if error occurs during creation.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 CSvgRenderFrameTimer* CSvgRenderFrameTimer::NewLC(
       
    58     MSvgRenderFrameTimerListener* aListener ) // Listener for inactivity event
       
    59     {
       
    60     CSvgRenderFrameTimer* self = new ( ELeave ) CSvgRenderFrameTimer( 
       
    61             aListener );
       
    62     CleanupStack::PushL( self );
       
    63     self->ConstructL();
       
    64     return self;
       
    65     }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CSvgRenderFrameTimer::NewL
       
    69 // Factory function for creating CSvgRenderFrameTimer objects.
       
    70 // Returns: CSvgRenderFrameTimer* ; Pointer to the created object.
       
    71 //          Leaves if error occurs during creation.
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 CSvgRenderFrameTimer* CSvgRenderFrameTimer::NewL( 
       
    75     MSvgRenderFrameTimerListener* aListener ) // Listener for inactivity event
       
    76     {
       
    77     CSvgRenderFrameTimer* self = NewLC( aListener );
       
    78     CleanupStack::Pop( self );
       
    79     return self;
       
    80     }
       
    81 
       
    82 
       
    83 // Destructor
       
    84 CSvgRenderFrameTimer::~CSvgRenderFrameTimer()
       
    85     {
       
    86     // Cancel any pending timer events 
       
    87     Cancel();
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CSvgRenderFrameTimer::DoCancel
       
    92 // Reimplements CActive::DoCancel. 
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void CSvgRenderFrameTimer::DoCancel()
       
    96     {
       
    97     CTimer::DoCancel();
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CSvgRenderFrameTimer::RunL
       
   102 // Reimplements CActive::RunL. This function resets the inactivity timer 
       
   103 // so that the control is triggered to hide the pointer when no 
       
   104 // activity occurs for a specified time period
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 void CSvgRenderFrameTimer::RunL()
       
   108     {
       
   109     // Callback 
       
   110     if ( iListener )
       
   111         {
       
   112         iListener->AnimationTimeOut();
       
   113         }
       
   114     }
       
   115 
       
   116 void CSvgRenderFrameTimer::SetTimeOut( 
       
   117     const TTimeIntervalMicroSeconds32& anInterval )
       
   118     {
       
   119     if (!IsActive())
       
   120         {
       
   121         After( anInterval );
       
   122         }
       
   123     }
       
   124 
       
   125 // End of File
       
   126