svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTPointerHideTimer.cpp
branchRCL_3
changeset 17 e52958d06c29
parent 14 1882882c7f9c
child 18 20b99a6d6175
child 20 5fd161fa28b6
equal deleted inserted replaced
14:1882882c7f9c 17:e52958d06c29
     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 *                hiding of pointer in case of inactivity.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // User Includes
       
    21 #include "SVGTPointerHideTimer.h"
       
    22 
       
    23 // ============================ MEMBER FUNCTIONS ===============================
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CSVGTPointerHideTimer::CSVGTPointerHideTimer
       
    27 // Default Constructor. Initialises Timer State Variables.
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 CSVGTPointerHideTimer::CSVGTPointerHideTimer( MSVGTPointerInactivityListener* 
       
    31         aListener) : // Listener for the pointer inactivity
       
    32     CTimer( CActive::EPriorityStandard ), iInactivityListener( aListener )
       
    33     {
       
    34     }
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CSVGTPointerHideTimer::ConstructL
       
    38 // Second Phase Constructor for CSVGTPointerHideTimer. Adds this object to the 
       
    39 // applications active scheduler.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 void CSVGTPointerHideTimer::ConstructL()
       
    43     {
       
    44     // Call the base class ConstructL
       
    45     CTimer::ConstructL();
       
    46     // Add to active scheduler
       
    47     CActiveScheduler::Add( this );
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CSVGTPointerHideTimer::NewLC
       
    52 // Factory function for creating CSVGTPointerHideTimer objects. It also 
       
    53 // pushes the created dialog object onto the cleanup stack.
       
    54 // Returns: CSVGTPointerHideTimer* ; Pointer to the created object.
       
    55 //          Leaves if error occurs during creation.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CSVGTPointerHideTimer* CSVGTPointerHideTimer::NewLC(
       
    59     MSVGTPointerInactivityListener* aListener ) // Listener for inactivity event
       
    60     {
       
    61     CSVGTPointerHideTimer* self = new ( ELeave ) CSVGTPointerHideTimer( 
       
    62             aListener );
       
    63     CleanupStack::PushL( self );
       
    64     self->ConstructL();
       
    65     return self;
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CSVGTPointerHideTimer::NewL
       
    70 // Factory function for creating CSVGTPointerHideTimer objects.
       
    71 // Returns: CSVGTPointerHideTimer* ; Pointer to the created object.
       
    72 //          Leaves if error occurs during creation.
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 CSVGTPointerHideTimer* CSVGTPointerHideTimer::NewL( 
       
    76     MSVGTPointerInactivityListener* aListener ) // Listener for inactivity event
       
    77     {
       
    78     CSVGTPointerHideTimer* self = NewLC( aListener );
       
    79     CleanupStack::Pop( self );
       
    80     return self;
       
    81     }
       
    82 
       
    83 
       
    84 // Destructor
       
    85 CSVGTPointerHideTimer::~CSVGTPointerHideTimer()
       
    86     {
       
    87     // Reset the listener
       
    88     iInactivityListener = NULL;
       
    89     // Cancel any pending timer events 
       
    90     Cancel();
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CSVGTPointerHideTimer::DoCancel
       
    95 // Reimplements CActive::DoCancel. 
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 void CSVGTPointerHideTimer::DoCancel()
       
    99     {
       
   100     CTimer::DoCancel();
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CSVGTPointerHideTimer::RunL
       
   105 // Reimplements CActive::RunL. This function resets the inactivity timer 
       
   106 // so that the control is triggered to hide the pointer when no 
       
   107 // activity occurs for a specified time period
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void CSVGTPointerHideTimer::RunL()
       
   111     {
       
   112     // Callback 
       
   113     if ( iInactivityListener )
       
   114         {
       
   115         iInactivityListener->PointerInactivityTimeout();
       
   116         }
       
   117     }
       
   118 
       
   119 // End of File