svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTProgressBarTimer.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:29:59 +0100
branchRCL_3
changeset 14 20b99a6d6175
parent 0 632761c941a7
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201019 Kit: 201035

/*
* Copyright (c) 2004,2005 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  This file implements the timer functionality required for the
*                progress time functionality in the dialog.
*
*/


// User Includes
#include "SVGTProgressBarTimer.h"

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

// -----------------------------------------------------------------------------
// CSVGTProgressBarTimer::CSVGTProgressBarTimer
// Default Constructor. Initialises Timer State Variables.
// -----------------------------------------------------------------------------
//
CSVGTProgressBarTimer::CSVGTProgressBarTimer(MSVGTProgressBarListener* 
            aListener , TBool aResetInactivityTime ) : 
    CTimer( CActive::EPriorityHigh ), iListener( aListener ), 
    iUseInactivityTime( aResetInactivityTime )
    {
    }

// -----------------------------------------------------------------------------
// CSVGTProgressBarTimer::ConstructL
// Second Phase Constructor for CSVGTProgressBarTimer. Adds this object to the 
// applications active scheduler.
// -----------------------------------------------------------------------------
//
void CSVGTProgressBarTimer::ConstructL()
    {
    // Call the base class ConstructL
    CTimer::ConstructL();
    // Add to active scheduler
    CActiveScheduler::Add( this );
    }

// -----------------------------------------------------------------------------
// CSVGTProgressBarTimer::NewLC
// Factory function for creating CSVGTProgressBarTimer objects.It also pushes the
// created dialog object onto the cleanup stack.
// Returns: CSVGTProgressBarTimer* ; Pointer to the created object.
//          Leaves if error occurs during creation.
// -----------------------------------------------------------------------------
//
CSVGTProgressBarTimer* CSVGTProgressBarTimer::NewLC( MSVGTProgressBarListener* 
            aListener , 
            TBool aResetInactivityTime ) // Listener for timer tick event
    {
    CSVGTProgressBarTimer* self = new ( ELeave ) CSVGTProgressBarTimer( 
        aListener , aResetInactivityTime );
    CleanupStack::PushL( self );
    self->ConstructL();
    return self;
    }

// -----------------------------------------------------------------------------
// CSVGTProgressBarTimer::NewL
// Factory function for creating CSVGTProgressBarTimer objects.
// Returns: CSVGTProgressBarTimer* ; Pointer to the created object.
//          Leaves if error occurs during creation.
// -----------------------------------------------------------------------------
//
CSVGTProgressBarTimer* CSVGTProgressBarTimer::NewL( MSVGTProgressBarListener* 
            aListener , 
            TBool aResetInactivityTime ) // Listener for timer tick event
    {
    CSVGTProgressBarTimer* self = NewLC( aListener , aResetInactivityTime );
    CleanupStack::Pop( self );
    return self;
    }


// Destructor
CSVGTProgressBarTimer::~CSVGTProgressBarTimer()
    {
    // Reset the listener
    iListener = NULL;
    // Cancel any pending timer events if any.
    Cancel();
    }
    
// -----------------------------------------------------------------------------
// CSVGTProgressBarTimer::DoCancel
// Reimplements CActive::DoCancel. 
// -----------------------------------------------------------------------------
//
void CSVGTProgressBarTimer::DoCancel()
    {
    CTimer::DoCancel();
    }

// -----------------------------------------------------------------------------
// CSVGTProgressBarTimer::RunL
// Reimplements CActive::RunL. This function updates the media time.
// -----------------------------------------------------------------------------
//
void CSVGTProgressBarTimer::RunL()
    {
    if ( iUseInactivityTime )
        {
        User::ResetInactivityTime();        
        }
            
    // CallBack listener
    if ( iListener )
        {
        iListener->UpdateProgressBar();
        }
    }

// End of File