mobilemessaging/smilui/playerinc/SmilPlayerTimeIndicatorTimer.h
branchRCL_3
changeset 27 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
26:ebe688cedc25 27:7fdbb852d323
       
     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: SmilPlayerTimeIndicatorTimer  declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef SMILPLAYERTIMEINDICATORTIMER_H
       
    21 #define SMILPLAYERTIMEINDICATORTIMER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 // CONSTANTS
       
    27 const TInt KTimeControlMaxLength = 32;
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CCoeEnv;
       
    31 class MSmilPlayerTimeObserver;
       
    32 
       
    33 // DATA TYPES
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 * Time indicator timer class. 
       
    39 *
       
    40 * @lib smilplayer.lib
       
    41 * @since 3.0
       
    42 */
       
    43 NONSHARABLE_CLASS(CSmilPlayerTimeIndicatorTimer) : public CTimer
       
    44     {
       
    45 
       
    46     public: // Constructor and Destructor
       
    47 
       
    48         /**
       
    49         * Two-phased constructor.
       
    50         *
       
    51         * @param aObserver        Time indicator timer observer.
       
    52         * @param aCoeEnv          Control environment.
       
    53         *
       
    54         * @return Pointer to created CSmilPlayerTimeIndicatorTimer object.
       
    55         */
       
    56         static CSmilPlayerTimeIndicatorTimer* NewL( MSmilPlayerTimeObserver* aObserver,
       
    57                                                     CCoeEnv* aCoeEnv );
       
    58         
       
    59         /**
       
    60         * Destructor.
       
    61         */
       
    62         virtual ~CSmilPlayerTimeIndicatorTimer();
       
    63 
       
    64     public: // New functions
       
    65     
       
    66         /**
       
    67         * Starts the timer.
       
    68         *
       
    69         * @since 3.0
       
    70         */     
       
    71         void Start();
       
    72 
       
    73         /**
       
    74         * Pauses the timer.
       
    75         *
       
    76         * @since 3.0
       
    77         */     
       
    78         void Pause();
       
    79 
       
    80         /**
       
    81         * Resumes the timer.
       
    82         *
       
    83         * @since 3.0
       
    84         */     
       
    85         void Resume();
       
    86 
       
    87         /**
       
    88         * Stops the timer.
       
    89         *
       
    90         * @since 3.0
       
    91         */
       
    92         void Stop();
       
    93 
       
    94         /**
       
    95         * Notifies timer that presentation end has been reached.
       
    96         *
       
    97         * @since 3.0
       
    98         */
       
    99         void EndReached();
       
   100     
       
   101     public: // Functions from base classes
       
   102             
       
   103         /**
       
   104         * From CTimer Called when timer is triggered.
       
   105         *
       
   106         * @since 3.0
       
   107         */
       
   108         void RunL();
       
   109         
       
   110     private:
       
   111 
       
   112         /**
       
   113         * By default Symbian 2nd phase constructor is private.
       
   114         */
       
   115         void ConstructL();
       
   116 
       
   117         /**
       
   118         * Constructor.
       
   119         *
       
   120         * @param aObserver        Time indicator timer observer.
       
   121         * @param aCoeEnv          Control environment.
       
   122         */
       
   123         CSmilPlayerTimeIndicatorTimer( MSmilPlayerTimeObserver* aObserver, 
       
   124                                        CCoeEnv* aCoeEnv );
       
   125 
       
   126         /**
       
   127         * C++ default constructor.
       
   128         */
       
   129         CSmilPlayerTimeIndicatorTimer();
       
   130         
       
   131         /**
       
   132         * Creates time string.
       
   133         */
       
   134         void CreateNewTimeStringL();
       
   135         
       
   136     private: // Data
       
   137     
       
   138         // States of the time control
       
   139         // Used for handling time value in ReportL()
       
   140         // See error EMLI-5Y9APL.
       
   141         enum TTimeControlState
       
   142             {
       
   143             // initialized state
       
   144             // set: Stop()
       
   145             EReadyForAction = 1,
       
   146             // from start to ( iDuration - 1 second)
       
   147             // set: Start(), Resume()
       
   148             ERunning,
       
   149             // paused state
       
   150             // set in Pause()
       
   151             EPaused,
       
   152             // last second before resetting to zero.
       
   153             // set internally
       
   154             EPreparingForEnd 
       
   155             };
       
   156 
       
   157         // Reference to the parent window
       
   158         MSmilPlayerTimeObserver* iTimeObserver;
       
   159         
       
   160         // Stores the current time value of the presentation
       
   161         TInt iCurrentValue;
       
   162 
       
   163         // Stores the total time of the presentation
       
   164         TInt iDurationValue;
       
   165 
       
   166         // Format string placeholder.
       
   167         // R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO is loaded to it in construction.
       
   168         TBuf< KTimeControlMaxLength > iTimeDuratMinSecWithZero;
       
   169         
       
   170         // Internal state.
       
   171         TInt iState;
       
   172         
       
   173         // Pointer to control environment.
       
   174         CCoeEnv* iCoeEnv;
       
   175     };
       
   176 
       
   177 #endif  // SMILPLAYERTIMEINDICATORTIMER_H
       
   178             
       
   179 // End of File