mpx/tsrc/public/basic/common/testviewframework/src/scrollertimer.cpp
changeset 62 b276843a15ba
equal deleted inserted replaced
58:c76ea6caa649 62:b276843a15ba
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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:  CScrollerTimer class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include "scrollertimer.h"
       
    19 #include "consolemain.h"
       
    20 
       
    21 // CONSTANTS
       
    22 const TInt KScrollPeriod = 300000;		   // Scrolling speed
       
    23 
       
    24 /*
       
    25 -------------------------------------------------------------------------------
       
    26 
       
    27     Class: CScrollerTimer
       
    28 
       
    29     Method: ConstructL
       
    30 
       
    31     Description: Second level constructor
       
    32 
       
    33     Parameters: CConsoleMain*             :in:      Pointer to main console
       
    34 
       
    35     Return Values: None
       
    36 
       
    37     Errors/Exceptions: None
       
    38 
       
    39     Status: Draft
       
    40 
       
    41 -------------------------------------------------------------------------------
       
    42 */
       
    43 void CScrollerTimer::ConstructL( CConsoleMain* aMain )
       
    44     {
       
    45 
       
    46     // Store module information
       
    47     iMain = aMain;
       
    48 	iTimer.CreateLocal();
       
    49 
       
    50 	CActiveScheduler::Add ( this );
       
    51 
       
    52     }
       
    53 
       
    54 /*
       
    55 -------------------------------------------------------------------------------
       
    56 
       
    57     Class: CScrollerTimer
       
    58 
       
    59     Method: CScrollerTimer
       
    60 
       
    61     Description: Constructor.
       
    62 
       
    63     Parameters: None
       
    64 
       
    65     Return Values: None
       
    66 
       
    67     Errors/Exceptions: None
       
    68 
       
    69     Status: Draft
       
    70     
       
    71 -------------------------------------------------------------------------------
       
    72 */
       
    73 CScrollerTimer::CScrollerTimer() : CActive (CActive::EPriorityStandard)
       
    74     {
       
    75 
       
    76     }
       
    77 
       
    78 /*
       
    79 -------------------------------------------------------------------------------
       
    80 
       
    81     Class: CScrollerTimer
       
    82 
       
    83     Method: ~CScrollerTimer
       
    84 
       
    85     Description: None
       
    86 
       
    87     Parameters: None
       
    88 
       
    89     Return Values: None
       
    90 
       
    91     Errors/Exceptions: None
       
    92 
       
    93     Status: Draft
       
    94     
       
    95 -------------------------------------------------------------------------------
       
    96 */
       
    97 CScrollerTimer::~CScrollerTimer( )
       
    98     {
       
    99 
       
   100 	Cancel();
       
   101 	iTimer.Close();
       
   102 
       
   103     }
       
   104 
       
   105 /*
       
   106 -------------------------------------------------------------------------------
       
   107 
       
   108     Class: CScrollerTimer
       
   109 
       
   110     Method: DoCancel
       
   111 
       
   112     Description: None
       
   113 
       
   114     Parameters: None
       
   115 
       
   116     Return Values: None
       
   117 
       
   118     Errors/Exceptions: None
       
   119 
       
   120     Status: Draft
       
   121     
       
   122 -------------------------------------------------------------------------------
       
   123 */
       
   124 void CScrollerTimer::DoCancel( )
       
   125     {
       
   126 
       
   127 	iTimer.Cancel();
       
   128 
       
   129     }
       
   130 
       
   131 /*
       
   132 -------------------------------------------------------------------------------
       
   133 
       
   134     Class: CScrollerTimer
       
   135 
       
   136     Method: NewL
       
   137 
       
   138     Description: Construct a new CScrollerTimer object
       
   139 
       
   140     Parameters: CConsoleMain*             :in:      Pointer to main console               
       
   141 
       
   142     Return Values: CScrollerTimer*                         New CScrollerTimer object
       
   143 
       
   144     Errors/Exceptions: Leaves if memory allocation or ConstructL leaves
       
   145 
       
   146     Status: Draft
       
   147 
       
   148 -------------------------------------------------------------------------------
       
   149 */
       
   150 CScrollerTimer* CScrollerTimer::NewL( CConsoleMain* aMain )
       
   151     {
       
   152 
       
   153     CScrollerTimer* self = new ( ELeave ) CScrollerTimer();
       
   154     CleanupStack::PushL( self );
       
   155     self->ConstructL( aMain );
       
   156     CleanupStack::Pop( self );
       
   157     return self;
       
   158 
       
   159     }
       
   160 
       
   161 /*
       
   162 -------------------------------------------------------------------------------
       
   163 
       
   164     Class: CScrollerTimer
       
   165 
       
   166     Method: RunError
       
   167 
       
   168     Description: None
       
   169 
       
   170     Parameters: None
       
   171 
       
   172     Return Values: None
       
   173 
       
   174     Errors/Exceptions: None
       
   175 
       
   176     Status: Draft
       
   177     
       
   178 -------------------------------------------------------------------------------
       
   179 */
       
   180 TInt CScrollerTimer::RunError( TInt aError)
       
   181     {
       
   182 
       
   183 	return aError;
       
   184 
       
   185     }    
       
   186 
       
   187 /*
       
   188 -------------------------------------------------------------------------------
       
   189 
       
   190     Class: CScrollerTimer
       
   191 
       
   192     Method: RunL
       
   193 
       
   194     Description: None
       
   195 
       
   196     Parameters: None
       
   197 
       
   198     Return Values: None
       
   199 
       
   200     Errors/Exceptions: None
       
   201 
       
   202     Status: Draft
       
   203     
       
   204 -------------------------------------------------------------------------------
       
   205 */
       
   206 void CScrollerTimer::RunL( )
       
   207     {
       
   208 
       
   209 	iMain->TimerUpdate();
       
   210 
       
   211 	// Restart request
       
   212 	SetActive();
       
   213 	iTimer.After ( iStatus, KScrollPeriod );
       
   214 
       
   215     }
       
   216 
       
   217 /*
       
   218 -------------------------------------------------------------------------------
       
   219 
       
   220     Class: CScrollerTimer
       
   221 
       
   222     Method: StartL
       
   223 
       
   224     Description: None
       
   225 
       
   226     Parameters: None
       
   227 
       
   228     Return Values: None
       
   229 
       
   230     Errors/Exceptions: None
       
   231 
       
   232     Status: Draft
       
   233     
       
   234 -------------------------------------------------------------------------------
       
   235 */
       
   236 void CScrollerTimer::Start( )
       
   237     {
       
   238 
       
   239 	SetActive();
       
   240 	iTimer.After ( iStatus, KScrollPeriod );	
       
   241 
       
   242     }