uiacceltk/hitchcock/Client/src/alfshadowborderbrush.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 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:   Shadow border brush
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "alf/alfshadowborderbrush.h"
       
    21 #include "alf/alfgencomponent.h"
       
    22 #include "alf/alfconstants.h"
       
    23 #include "alflogger.h"
       
    24 
       
    25 #include <uiacceltk/HuiUtil.h>
       
    26 
       
    27 struct CAlfShadowBorderBrush::TShadowBorderPrivateData
       
    28     {
       
    29     TAlfTimedValue iWidth;
       
    30     TAlfMetric iMetricWidth;
       
    31     };
       
    32 
       
    33 // ======== MEMBER FUNCTIONS ========
       
    34 
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // ?description_if_needed
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 CAlfShadowBorderBrush::CAlfShadowBorderBrush()
       
    41     {
       
    42     }
       
    43     
       
    44 void CAlfShadowBorderBrush::ConstructL( CAlfEnv& aEnv, TInt aWidth )
       
    45     {
       
    46     TPckgC<TInt> paramsPckg( aWidth );
       
    47     
       
    48     CAlfBrush::ConstructL(
       
    49         aEnv,
       
    50         EAlfShadowBorderBrushCreate,
       
    51         0,
       
    52         paramsPckg
       
    53         );
       
    54         
       
    55     iShadowBorderData = new (ELeave) TShadowBorderPrivateData;
       
    56     iShadowBorderData->iWidth.SetValueNow( aWidth );
       
    57     }
       
    58     
       
    59 EXPORT_C CAlfShadowBorderBrush* CAlfShadowBorderBrush::NewL(
       
    60         CAlfEnv& aEnv,
       
    61         TInt aWidth )
       
    62     {
       
    63     CAlfShadowBorderBrush* self = NewLC( aEnv, aWidth );
       
    64     CleanupStack::Pop( self );
       
    65     return self;
       
    66     }
       
    67     
       
    68 EXPORT_C CAlfShadowBorderBrush* CAlfShadowBorderBrush::NewLC(
       
    69         CAlfEnv& aEnv,
       
    70         TInt aWidth )
       
    71     {
       
    72     CAlfShadowBorderBrush* self = new (ELeave) CAlfShadowBorderBrush;
       
    73     CleanupStack::PushL( self );
       
    74     self->ConstructL( aEnv, aWidth );
       
    75     return self;
       
    76     }
       
    77 
       
    78 void CAlfShadowBorderBrush::ConstructL( CAlfEnv& aEnv, const TAlfMetric& aWidth )
       
    79     {
       
    80     TPckgC<TAlfMetric> paramsPckg( aWidth );
       
    81     
       
    82     CAlfBrush::ConstructL(
       
    83         aEnv,
       
    84         EAlfShadowBorderBrushCreateMetric,
       
    85         0,
       
    86         paramsPckg
       
    87         );
       
    88         
       
    89     iShadowBorderData = new (ELeave) TShadowBorderPrivateData;
       
    90     iShadowBorderData->iWidth.SetValueNow( 0 ); // Not used, just set to zero.
       
    91     iShadowBorderData->iMetricWidth = TAlfMetric(aWidth);
       
    92     }
       
    93     
       
    94 EXPORT_C CAlfShadowBorderBrush* CAlfShadowBorderBrush::NewL(
       
    95         CAlfEnv& aEnv,
       
    96         const TAlfMetric& aWidth )
       
    97     {
       
    98     CAlfShadowBorderBrush* self = NewLC( aEnv, aWidth );
       
    99     CleanupStack::Pop( self );
       
   100     return self;
       
   101     }
       
   102     
       
   103 EXPORT_C CAlfShadowBorderBrush* CAlfShadowBorderBrush::NewLC(
       
   104         CAlfEnv& aEnv,
       
   105         const TAlfMetric& aWidth )
       
   106     {
       
   107     CAlfShadowBorderBrush* self = new (ELeave) CAlfShadowBorderBrush;
       
   108     CleanupStack::PushL( self );
       
   109     self->ConstructL( aEnv, aWidth );
       
   110     return self;
       
   111     }
       
   112 
       
   113     
       
   114 CAlfShadowBorderBrush::~CAlfShadowBorderBrush()
       
   115     {
       
   116     delete iShadowBorderData;
       
   117     }
       
   118     
       
   119 EXPORT_C const TAlfTimedValue& CAlfShadowBorderBrush::Width() const
       
   120     {
       
   121     TPckg<TAlfTimedValue> buf(iShadowBorderData->iWidth);
       
   122     TInt err = Comms()->DoSynchronousCmd( EAlfShadowBorderBrushGetWidth, buf, buf);
       
   123 
       
   124     if ( err != KErrNone )
       
   125         {
       
   126         __ALFLOGSTRING1( "CAlfShadowBorderBrush::Width panic error %d", err )
       
   127         USER_INVARIANT();
       
   128         }
       
   129     
       
   130     return iShadowBorderData->iWidth;
       
   131     }
       
   132     
       
   133 EXPORT_C void CAlfShadowBorderBrush::SetWidth( const TAlfTimedValue& aWidth )
       
   134     {
       
   135     TPckgC<TAlfTimedValue> buf(aWidth);
       
   136 
       
   137     TInt err = Comms()->DoCmdNoReply( EAlfShadowBorderBrushSetWidth, buf );
       
   138 
       
   139     if ( err == KErrNone )
       
   140         {
       
   141         iShadowBorderData->iWidth = aWidth;
       
   142         }
       
   143     else
       
   144         {
       
   145         __ALFLOGSTRING1( "CAlfShadowBorderBrush::SetWidth panic error %d", err )
       
   146         USER_INVARIANT();
       
   147         }
       
   148     }
       
   149     
       
   150 EXPORT_C void CAlfShadowBorderBrush::SetWidth( const TAlfMetric& aWidth )
       
   151     {
       
   152     TPckgC<TAlfMetric> buf(aWidth);
       
   153 
       
   154     TInt err = Comms()->DoCmdNoReply( EAlfShadowBorderBrushSetWidthMetric, buf);
       
   155 
       
   156     if ( err == KErrNone )
       
   157         {
       
   158         iShadowBorderData->iMetricWidth = aWidth;
       
   159         }
       
   160     else
       
   161         {
       
   162         __ALFLOGSTRING1( "CAlfShadowBorderBrush::SetWidth (TAlfMetric) panic error %d", err )
       
   163         USER_INVARIANT();
       
   164         }
       
   165     }
       
   166 
       
   167     
       
   168