skins/AknSkins/alinc/AknsAlTimingModelRelative.h
changeset 0 05e9090e2422
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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:  Implements relative timing model.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef AKNSALTIMINGMODELRELATIVE_H
       
    19 #define AKNSALTIMINGMODELRELATIVE_H
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "AknsAlTimingModel.h"
       
    23 
       
    24 // CONSTANTS
       
    25 
       
    26 // Timing model UID
       
    27 const TInt KAknsAlTimingModelRelativeUID = 0x10207625;
       
    28 
       
    29 // Constants for parameter names
       
    30 _LIT( KAknsAlRelativeTimeSpan, "t" );
       
    31 _LIT( KAknsAlRelativeSlices, "s" );
       
    32 _LIT( KAknsAlRelativeWrap, "w" );
       
    33 
       
    34 // CLASS DECLARATION
       
    35 /**
       
    36 * Implements relative timing model. The timing model is relative to anchors in
       
    37 * real-time. Timespans define the location of anchors. Possible timespans are
       
    38 * hour, day, week and month. For example, when the used timespan is hour the
       
    39 * start of real-time hour is used as an anchor and relative value goes from [0,
       
    40 * 1] over this timespan.
       
    41 *
       
    42 * Timing model also supports slices and wrapping which affect how relative
       
    43 * values are generated over one timespan.
       
    44 *
       
    45 * @since 3.0
       
    46 */
       
    47 NONSHARABLE_CLASS( CAknsAlTimingModelRelative ): public MAknsAlTimingModel
       
    48     {
       
    49     public:
       
    50         enum TTimeSpan
       
    51             {
       
    52             EHour  = 0,
       
    53             EDay   = 1,
       
    54             EWeek  = 2,
       
    55             EMonth = 3
       
    56             };
       
    57 
       
    58     protected:
       
    59         CAknsAlTimingModelRelative();
       
    60 
       
    61     public:
       
    62         static CAknsAlTimingModelRelative* NewL();
       
    63         virtual ~CAknsAlTimingModelRelative();
       
    64 
       
    65      public: // Implementation of MAknsAlTimingModel
       
    66 
       
    67         /**
       
    68         * Supported named parameters are:
       
    69         * - "t", enumeration TTimeSpan, used timespan
       
    70         * - "s", integer >= 1, number of slices in timespan
       
    71         * - "w", boolean (0/1), wrapping toggle
       
    72         *
       
    73         * Timespan, "t", must be one of the values in TTimeSpan.
       
    74         *
       
    75         * Slicing defines the number of slices in the used timespan. For
       
    76         * example, using timespan hour and 4 slices will effectively divide
       
    77         * hour in 15 minute slices (results in four relative value spans over
       
    78         * hour, [0, 1][1, 0][0, 1][1, 0] with wrapping,
       
    79         * [0, 1][0, 1][0, 1][0, 1] without wrapping).
       
    80         *
       
    81         * Number of slices must be >= 1.
       
    82         *
       
    83         * If wrapping is true, every second slice is reversed (relative value
       
    84         * goes over range [1, 0] instead of [0, 1]). Wrapping affects only one
       
    85         * slice. To achieve continuous wrapping over multiple timespans an even
       
    86         * value for slices should be used. Note that wrapping is ignored when
       
    87         * slice count is 1.
       
    88         *
       
    89         * The default parameter values are:
       
    90         * - "t" = EHour
       
    91         * - "s" = 1
       
    92         * - "w" = EFalse (0)
       
    93         */
       
    94         void SetParametersL( MAknsRlParameterIterator& aParameters );
       
    95         /**
       
    96         * Updates the timing model. Provided delta time is ignored,
       
    97         * TTime::HomeTime is used as time stamp when updating the model.
       
    98         */
       
    99         void Tick( const TInt aDeltaTime );
       
   100         /**
       
   101         * Updates the timing model to the point in time defined by the provided
       
   102         * time stamp.
       
   103         */
       
   104         void Tick( const TTime& aStamp );
       
   105         TUint32 RelativeValue() const;
       
   106         TBool IsFinished() const;
       
   107         void Begin();
       
   108 
       
   109     private:
       
   110 
       
   111         /// Time span type
       
   112         TTimeSpan iTimeSpan;
       
   113         /// Number of slices in time span, >= 1
       
   114         TInt iSlices;
       
   115         /// Used wrapping mode.
       
   116         TBool iWrap;
       
   117 
       
   118         /// The current relative value, fixed point 16.16 format.
       
   119         TUint32 iRelative;
       
   120     };
       
   121 
       
   122 #endif // AKNSALTIMINGMODELRELATIVE_H
       
   123 
       
   124 // End of File
       
   125