uiacceltk/hitchcock/Client/src/alfdropshadow.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 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:   Drop shadow parameter handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "alf/alfdropshadow.h"
       
    21 #include "alf/alfgencomponent.h"
       
    22 #include "alf/alfconstants.h"
       
    23 
       
    24 // ======== LOCAL FUNCTIONS ========
       
    25 
       
    26 NONSHARABLE_STRUCT( CAlfDropShadow::TAlfDropShadowData )
       
    27     {
       
    28     TAlfDropShadowData(): iComms(NULL) {}
       
    29     
       
    30     CAlfGenComponent* iComms; // not own
       
    31     };
       
    32 
       
    33 // ======== MEMBER FUNCTIONS ========
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // 2-phased constructor
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 CAlfDropShadow* CAlfDropShadow::NewL(CAlfGenComponent& aComms)
       
    40     {
       
    41     CAlfDropShadow* self = new (ELeave) CAlfDropShadow;
       
    42     CleanupStack::PushL( self );
       
    43     self->ConstructL( aComms );
       
    44     CleanupStack::Pop( self );
       
    45     return self;
       
    46     }
       
    47 
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // First phase constructor
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CAlfDropShadow::CAlfDropShadow()
       
    54     {
       
    55     }
       
    56 
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // Sencond phase constructor
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 void CAlfDropShadow::ConstructL(CAlfGenComponent& aComms)
       
    63     {
       
    64     iData = new (ELeave) TAlfDropShadowData;
       
    65 
       
    66     iData->iComms = &aComms;
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // Destructor
       
    71 // --------------------------------------------------------------------------
       
    72 //
       
    73 CAlfDropShadow::~CAlfDropShadow()
       
    74     {
       
    75     delete iData;
       
    76     }
       
    77    
       
    78 // ---------------------------------------------------------------------------
       
    79 // Sets offset in polar coordinates.
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 EXPORT_C void CAlfDropShadow::SetOffset( 
       
    83     TReal32 aAngle, 
       
    84     TAlfMetric aDistance, 
       
    85     TInt aTransitionTime ) __SOFTFP
       
    86     {
       
    87     TAlfDropShadowOffsetPolarParams params;
       
    88     params.iAngle = aAngle;
       
    89     params.iDistance = aDistance;
       
    90     params.iTransitionTime = aTransitionTime;
       
    91     
       
    92     TPckgC<TAlfDropShadowOffsetPolarParams> inBuf( params );
       
    93     
       
    94     iData->iComms->DoCmdNoReply(EAlfDropShadowSetOffsetInPolar, inBuf );
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // Sets RGB color
       
    99 // ---------------------------------------------------------------------------
       
   100 //        
       
   101 EXPORT_C void CAlfDropShadow::SetColor(
       
   102     const TRgb& aColor, 
       
   103     TInt aTransitionTime)
       
   104     {
       
   105     TAlfDropShadowColorRgbParams params;
       
   106     params.iColor = aColor;
       
   107     params.iTransitionTime = aTransitionTime;
       
   108     
       
   109     TPckgC<TAlfDropShadowColorRgbParams> inBuf( params );
       
   110     
       
   111     iData->iComms->DoCmdNoReply(EAlfDropShadowSetColorRgb, inBuf );
       
   112     }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // Sets skinned color
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 EXPORT_C void CAlfDropShadow::SetColor(
       
   119     const TAknsItemID& aID,
       
   120     const TInt aIndex, 
       
   121     TInt aTransitionTime )
       
   122     {
       
   123     TAlfDropShadowColorSkinParams params;
       
   124     params.iID = aID;
       
   125     params.iIndex = aIndex;
       
   126     params.iTransitionTime = aTransitionTime;
       
   127     
       
   128     TPckgC<TAlfDropShadowColorSkinParams> inBuf( params );
       
   129     
       
   130     iData->iComms->DoCmdNoReply(EAlfDropShadowSetColorSkin, inBuf );
       
   131     }
       
   132 
       
   133 // ---------------------------------------------------------------------------
       
   134 // Sets opacity
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 EXPORT_C void CAlfDropShadow::SetOpacity( const TAlfTimedValue& aOpacity )
       
   138     {
       
   139     TPckgC<TAlfTimedValue> inBuf(aOpacity);
       
   140     iData->iComms->DoCmdNoReply(EAlfDropShadowSetOpacity, inBuf );
       
   141     }
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // Sets offset in cartesian coordinates
       
   145 // ---------------------------------------------------------------------------
       
   146 //    
       
   147 EXPORT_C void CAlfDropShadow::SetOffset( const TAlfTimedPoint& aOffset, TInt aOffsetUnit )
       
   148     {
       
   149     TAlfDropShadowOffsetXYParams params;
       
   150     params.iOffset = aOffset;
       
   151     params.iOffsetUnit = aOffsetUnit;
       
   152 
       
   153     TPckgC<TAlfDropShadowOffsetXYParams> inBuf( params );
       
   154     
       
   155     iData->iComms->DoCmdNoReply(EAlfDropShadowSetOffsetInXY, inBuf );
       
   156     }
       
   157 
       
   158 // ---------------------------------------------------------------------------
       
   159 // Sets blur radius
       
   160 // ---------------------------------------------------------------------------
       
   161 //    
       
   162 EXPORT_C void CAlfDropShadow::SetRadius( const TAlfTimedValue& aRadius )
       
   163     {
       
   164     TPckgC<TAlfTimedValue> inBuf(aRadius);
       
   165     iData->iComms->DoCmdNoReply(EAlfDropShadowSetBlurRadius, inBuf );
       
   166     }
       
   167     
       
   168 
       
   169 // ---------------------------------------------------------------------------
       
   170 // Sets scale factor
       
   171 // ---------------------------------------------------------------------------
       
   172 //    
       
   173 EXPORT_C void CAlfDropShadow::SetScale( const TAlfTimedValue& aScale )
       
   174     {
       
   175     TPckgC<TAlfTimedValue> inBuf(aScale);
       
   176     iData->iComms->DoCmdNoReply(EAlfDropShadowSetScale, inBuf );
       
   177     }