uiaccelerator_plat/alf_visual_api/inc/alf/alfshadowborderbrush.h
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:   Shadowed border brush
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_ALFSHADOWBORDERBRUSH_H
       
    21 #define C_ALFSHADOWBORDERBRUSH_H
       
    22 
       
    23 #include <alf/alfbrush.h>
       
    24 #include <alf/alfmetric.h>
       
    25 
       
    26 class CAlfEnv;
       
    27 
       
    28 /**
       
    29  *  Shadowed border brush
       
    30  *
       
    31  * A brush that creates a shadow border around its visual.
       
    32  * When comparing a shadow border brush to a drop shadow brush, the main difference is that 
       
    33  * the shadow border brush draws only the borders, while the drop shadow brush fills 
       
    34  * the entire shadow area.
       
    35  * 
       
    36  * The shadow border brush draws the shadow on the outside of the visual rectangle. 
       
    37  * One can conveniently combine it with a regular border brush.
       
    38  * 
       
    39  * Usage:
       
    40  * @code
       
    41  * 
       
    42  * //Create ImageVisual and set image
       
    43  * CAlfImageVisual* imagevisual = CAlfImageVisual::AddNewL( control );
       
    44  * imagevisual->SetImage(*image);
       
    45  * imagevisual->SetFlags(EAlfVisualFlagManualLayout);
       
    46  * 
       
    47  * //Manually set up an image visual to be 2/3 of the original size of the image 
       
    48  * Size texSize = image->Texture().Size();
       
    49  * imagevisual->SetRect(TRect(Point(50, 50),TSize(texSize.iWidth*2/3, texSize.iHeight*2/3)));
       
    50  * imagevisual->EnableBrushesL();
       
    51  * 
       
    52  * //Create shadow border brush
       
    53  * CAlfShadowBorderBrush* brush = CAlfShadowBorderBrush::NewL(iEnv, TAlfMetric( 0.25 ) );
       
    54  * brush->SetOpacity(0.25);
       
    55  * imagevisual->Brushes()->AppendL(brush, EAlfHasOwnership);
       
    56  *
       
    57  * @endcode
       
    58  *
       
    59  *  @lib alfclient.lib
       
    60  *  @since S60 v 3.2
       
    61  */
       
    62 NONSHARABLE_CLASS( CAlfShadowBorderBrush ): public CAlfBrush
       
    63     {
       
    64 
       
    65 public:
       
    66 
       
    67     /**
       
    68      * Constructor.
       
    69      *
       
    70      * @param aEnv Environment
       
    71      * @param aWidth Shadow border width in given metric units.
       
    72      */
       
    73     IMPORT_C static CAlfShadowBorderBrush* NewL(
       
    74         CAlfEnv& aEnv,
       
    75         const TAlfMetric& aWidth );
       
    76 
       
    77     /**
       
    78      * Constructor. The new brush is left on the cleanup stack.
       
    79      *
       
    80      * @param aEnv Environment
       
    81      * @param aWidth Shadow border width in given metric units.
       
    82      */
       
    83     IMPORT_C static CAlfShadowBorderBrush* NewLC(
       
    84         CAlfEnv& aEnv,
       
    85         const TAlfMetric& aWidth );
       
    86 
       
    87     /**
       
    88      * Constructor.
       
    89      * @deprecated migrate to using metrics instead.     
       
    90      */
       
    91     IMPORT_C static CAlfShadowBorderBrush* NewL(
       
    92         CAlfEnv& aEnv,
       
    93         TInt aWidth );
       
    94 
       
    95     /**
       
    96      * Constructor. The new brush is left on the cleanup stack.
       
    97      * @deprecated migrate to using metrics instead.     
       
    98      */
       
    99     IMPORT_C static CAlfShadowBorderBrush* NewLC(
       
   100         CAlfEnv& aEnv,
       
   101         TInt aWidth );
       
   102 
       
   103     
       
   104     /**
       
   105      * Destructor.
       
   106      */
       
   107     virtual ~CAlfShadowBorderBrush();
       
   108     
       
   109     /**
       
   110      * Gets width of the shadow border.
       
   111      * @return Width magnitude of the border in metric units.
       
   112      */
       
   113     IMPORT_C const TAlfTimedValue& Width() const;
       
   114 
       
   115     /**
       
   116      * Sets width of the shadow border.
       
   117      * @param aWidth Width magnitude of the border in metric units.
       
   118      */
       
   119     IMPORT_C void SetWidth( const TAlfTimedValue& aWidth );
       
   120 
       
   121     /**
       
   122      * Sets width of the shadow border.
       
   123      * @param aWidth Width of the border in metric units.
       
   124      */
       
   125     IMPORT_C void SetWidth( const TAlfMetric& aWidth );
       
   126 
       
   127 
       
   128 private:
       
   129 
       
   130 
       
   131     CAlfShadowBorderBrush();
       
   132 
       
   133     void ConstructL( CAlfEnv& aEnv, TInt aWidth );
       
   134 
       
   135     void ConstructL( CAlfEnv& aEnv, const TAlfMetric& aWidth );
       
   136 
       
   137 private:
       
   138 
       
   139     struct TShadowBorderPrivateData;
       
   140     TShadowBorderPrivateData* iShadowBorderData;
       
   141 
       
   142     };
       
   143 
       
   144 
       
   145 
       
   146 #endif // C_ALFSHADOWBORDERBRUSH_H