svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTProgressBarTimer.cpp
changeset 0 632761c941a7
equal deleted inserted replaced
-1:000000000000 0:632761c941a7
       
     1 /*
       
     2 * Copyright (c) 2004,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:  This file implements the timer functionality required for the
       
    15 *                progress time functionality in the dialog.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // User Includes
       
    21 #include "SVGTProgressBarTimer.h"
       
    22 
       
    23 // ============================ MEMBER FUNCTIONS ===============================
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CSVGTProgressBarTimer::CSVGTProgressBarTimer
       
    27 // Default Constructor. Initialises Timer State Variables.
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 CSVGTProgressBarTimer::CSVGTProgressBarTimer(MSVGTProgressBarListener* 
       
    31             aListener , TBool aResetInactivityTime ) : 
       
    32     CTimer( CActive::EPriorityHigh ), iListener( aListener ), 
       
    33     iUseInactivityTime( aResetInactivityTime )
       
    34     {
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CSVGTProgressBarTimer::ConstructL
       
    39 // Second Phase Constructor for CSVGTProgressBarTimer. Adds this object to the 
       
    40 // applications active scheduler.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 void CSVGTProgressBarTimer::ConstructL()
       
    44     {
       
    45     // Call the base class ConstructL
       
    46     CTimer::ConstructL();
       
    47     // Add to active scheduler
       
    48     CActiveScheduler::Add( this );
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CSVGTProgressBarTimer::NewLC
       
    53 // Factory function for creating CSVGTProgressBarTimer objects.It also pushes the
       
    54 // created dialog object onto the cleanup stack.
       
    55 // Returns: CSVGTProgressBarTimer* ; Pointer to the created object.
       
    56 //          Leaves if error occurs during creation.
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 CSVGTProgressBarTimer* CSVGTProgressBarTimer::NewLC( MSVGTProgressBarListener* 
       
    60             aListener , 
       
    61             TBool aResetInactivityTime ) // Listener for timer tick event
       
    62     {
       
    63     CSVGTProgressBarTimer* self = new ( ELeave ) CSVGTProgressBarTimer( 
       
    64         aListener , aResetInactivityTime );
       
    65     CleanupStack::PushL( self );
       
    66     self->ConstructL();
       
    67     return self;
       
    68     }
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CSVGTProgressBarTimer::NewL
       
    72 // Factory function for creating CSVGTProgressBarTimer objects.
       
    73 // Returns: CSVGTProgressBarTimer* ; Pointer to the created object.
       
    74 //          Leaves if error occurs during creation.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CSVGTProgressBarTimer* CSVGTProgressBarTimer::NewL( MSVGTProgressBarListener* 
       
    78             aListener , 
       
    79             TBool aResetInactivityTime ) // Listener for timer tick event
       
    80     {
       
    81     CSVGTProgressBarTimer* self = NewLC( aListener , aResetInactivityTime );
       
    82     CleanupStack::Pop( self );
       
    83     return self;
       
    84     }
       
    85 
       
    86 
       
    87 // Destructor
       
    88 CSVGTProgressBarTimer::~CSVGTProgressBarTimer()
       
    89     {
       
    90     // Reset the listener
       
    91     iListener = NULL;
       
    92     // Cancel any pending timer events if any.
       
    93     Cancel();
       
    94     }
       
    95     
       
    96 // -----------------------------------------------------------------------------
       
    97 // CSVGTProgressBarTimer::DoCancel
       
    98 // Reimplements CActive::DoCancel. 
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 void CSVGTProgressBarTimer::DoCancel()
       
   102     {
       
   103     CTimer::DoCancel();
       
   104     }
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // CSVGTProgressBarTimer::RunL
       
   108 // Reimplements CActive::RunL. This function updates the media time.
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 void CSVGTProgressBarTimer::RunL()
       
   112     {
       
   113     if ( iUseInactivityTime )
       
   114         {
       
   115         User::ResetInactivityTime();        
       
   116         }
       
   117             
       
   118     // CallBack listener
       
   119     if ( iListener )
       
   120         {
       
   121         iListener->UpdateProgressBar();
       
   122         }
       
   123     }
       
   124 
       
   125 // End of File