photosgallery/slideshow/engine/effectsrc/shwtimedvalue.inl
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2007-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:    Wrapper on top of THuiTimedValue to enable pause / resume
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // -----------------------------------------------------------------------------
       
    22 // TShwTimedValue
       
    23 // -----------------------------------------------------------------------------
       
    24 inline TShwTimedValue::TShwTimedValue() : 
       
    25 	iTimedValue( 0 ),
       
    26 	iPaused( EFalse ),
       
    27 	iTargetValue( 0 ),
       
    28 	iRemainingTime( 0 )
       
    29 	{
       
    30 	}
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // SetStyle
       
    34 // -----------------------------------------------------------------------------
       
    35 inline void TShwTimedValue::SetStyle( TAlfInterpolationStyle aStyle )
       
    36 	{
       
    37 	iTimedValue.SetStyle( aStyle );
       
    38 	}
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // Set
       
    42 // -----------------------------------------------------------------------------
       
    43 inline void TShwTimedValue::Set( TReal32 /*aValue */)
       
    44 	{
       
    45 	// this version set sets the value always, even in pause
       
    46 //	iTimedValue.Set( aValue );
       
    47 	}
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // Set
       
    51 // -----------------------------------------------------------------------------
       
    52 inline void TShwTimedValue::Set( TReal32 /*aValue*/, TInt /*aTime*/ )
       
    53 	{
       
    54 	// we dont set the value in pause unless aTime is zero
       
    55 	// as while paused we dont animate.
       
    56 	//if( ( !iPaused ) || ( 0 == aTime ) )
       
    57 	//	{
       
    58 		//iTimedValue.Set( aValue, aTime );
       
    59 	//	}
       
    60 	}
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // Now
       
    64 // -----------------------------------------------------------------------------
       
    65 inline TReal32 TShwTimedValue::Now()
       
    66 	{
       
    67 	return iTimedValue.ValueNow();
       
    68 	}
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // Target
       
    72 // -----------------------------------------------------------------------------
       
    73 inline TReal32 TShwTimedValue::Target()
       
    74 	{
       
    75 	return iTimedValue.Target();
       
    76 	}
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // Changed
       
    80 // -----------------------------------------------------------------------------
       
    81 inline TBool TShwTimedValue::Changed() const
       
    82 	{
       
    83 	//return iTimedValue.Changed();
       
    84 	//!Hack to supress compiler warnings
       
    85 	//function no longer used
       
    86 	//needs to be refactored/removed
       
    87 	return ETrue;
       
    88 	}
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // ClearChanged
       
    92 // -----------------------------------------------------------------------------
       
    93 inline void TShwTimedValue::ClearChanged()
       
    94 	{
       
    95 //	iTimedValue.ClearChanged();
       
    96 	}
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // Pause
       
   100 // -----------------------------------------------------------------------------
       
   101 inline void TShwTimedValue::Pause()
       
   102 	{
       
   103 	if ( !iPaused )
       
   104 		{
       
   105 		iPaused = ETrue;
       
   106 		// remember the target
       
   107 		iTargetValue = iTimedValue.Target();
       
   108 		// remember the remaining time
       
   109 		//iRemainingTime = iTimedValue.RemainingTime();
       
   110 		// stop the timed value by setting its value to current
       
   111 		//iTimedValue.Set( iTimedValue.Now() );
       
   112 		}
       
   113 	}
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // Resume
       
   117 // -----------------------------------------------------------------------------
       
   118 inline void TShwTimedValue::Resume()
       
   119 	{
       
   120 	if ( iPaused )
       
   121 		{
       
   122 		iPaused = EFalse;
       
   123 		// resume the timed value
       
   124 		// set the target to be the original target
       
   125 //		iTimedValue.Set( iTargetValue, iRemainingTime );
       
   126 		}
       
   127 	}
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // TShwTimedSize
       
   131 // -----------------------------------------------------------------------------
       
   132 inline TShwTimedSize::TShwTimedSize()
       
   133 	{
       
   134 	// TShwTimedValue objects reset themselves
       
   135 	}
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // SetStyle
       
   139 // -----------------------------------------------------------------------------
       
   140 inline void TShwTimedSize::SetStyle( TAlfInterpolationStyle aStyle )
       
   141 	{
       
   142 	iWidth.SetStyle( aStyle );
       
   143 	iHeight.SetStyle( aStyle );
       
   144 	}
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // Set
       
   148 // -----------------------------------------------------------------------------
       
   149 inline void TShwTimedSize::Set( TAlfRealSize aValue )
       
   150 	{
       
   151 	iWidth.Set( aValue.iWidth );
       
   152 	iHeight.Set( aValue.iHeight );
       
   153 	}
       
   154 
       
   155 // -----------------------------------------------------------------------------
       
   156 // Set
       
   157 // -----------------------------------------------------------------------------
       
   158 inline void TShwTimedSize::Set( TAlfRealSize aValue, TInt aTime )
       
   159 	{
       
   160 	iWidth.Set( aValue.iWidth, aTime );
       
   161 	iHeight.Set( aValue.iHeight, aTime );
       
   162 	}
       
   163 
       
   164 // -----------------------------------------------------------------------------
       
   165 // Now
       
   166 // -----------------------------------------------------------------------------
       
   167 inline TAlfRealSize TShwTimedSize::Now()
       
   168 	{
       
   169 	return TAlfRealSize( iWidth.Now(), iHeight.Now() );
       
   170 	}
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // Changed
       
   174 // -----------------------------------------------------------------------------
       
   175 inline TBool TShwTimedSize::Changed() const
       
   176 	{
       
   177 	return iWidth.Changed() || iHeight.Changed();
       
   178 	}
       
   179 
       
   180 // -----------------------------------------------------------------------------
       
   181 // ClearChanged
       
   182 // -----------------------------------------------------------------------------
       
   183 inline void TShwTimedSize::ClearChanged()
       
   184 	{
       
   185 	iWidth.ClearChanged();
       
   186 	iHeight.ClearChanged();
       
   187 	}
       
   188 
       
   189 // -----------------------------------------------------------------------------
       
   190 // Pause
       
   191 // -----------------------------------------------------------------------------
       
   192 inline void TShwTimedSize::Pause()
       
   193 	{
       
   194 	iWidth.Pause();
       
   195 	iHeight.Pause();
       
   196 	}
       
   197 
       
   198 // -----------------------------------------------------------------------------
       
   199 // Resume
       
   200 // -----------------------------------------------------------------------------
       
   201 inline void TShwTimedSize::Resume()
       
   202 	{
       
   203 	iWidth.Resume();
       
   204 	iHeight.Resume();
       
   205 	}