uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDropShadowBrush.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006-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:   ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __HUIDROPSHADOWBRUSH_H__
       
    21 #define __HUIDROPSHADOWBRUSH_H__
       
    22 
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <uiacceltk/HuiBrush.h>
       
    26 #include <uiacceltk/HuiSkin.h>
       
    27 #include <uiacceltk/HuiGc.h>
       
    28 #include <uiacceltk/HuiTimedValue.h>
       
    29 #include <uiacceltk/huimetric.h>
       
    30 
       
    31 
       
    32 /**
       
    33  * Drop shadow is drawn behind the visual, outside of its edges.
       
    34  *
       
    35  */
       
    36 NONSHARABLE_CLASS(CHuiDropShadowBrush) : public CHuiBrush
       
    37     {
       
    38 public:
       
    39    
       
    40     /* Constructors and destructor. */
       
    41 
       
    42     /**
       
    43      * Constructor.
       
    44      * @param aDepth Shadow depth in metric units.
       
    45      */
       
    46     IMPORT_C static CHuiDropShadowBrush* NewL(const THuiMetric& aDepth);
       
    47     
       
    48     /**
       
    49      * Constructor. The new brush is left on the cleanup stack.
       
    50      * @param aDepth Shadow depth in metric units.
       
    51      */
       
    52     IMPORT_C static CHuiDropShadowBrush* NewLC(const THuiMetric& aDepth);
       
    53 
       
    54     /**
       
    55      * Constructor.
       
    56      * @deprecated
       
    57      * @param aDepth Shadow depth in pixels.
       
    58      */
       
    59     IMPORT_C static CHuiDropShadowBrush* NewL(TInt aDepth);
       
    60     
       
    61     /**
       
    62      * Constructor. The new brush is left on the cleanup stack.
       
    63      * @deprecated
       
    64      * @param aDepth Shadow depth in pixels.
       
    65      */
       
    66     IMPORT_C static CHuiDropShadowBrush* NewLC(TInt aDepth);
       
    67 
       
    68     /**
       
    69      * Sets shadow depth.
       
    70      * @param aDepth Shadow depth in metric units.
       
    71      */
       
    72     IMPORT_C void SetDepth(const THuiMetric& aDepth);
       
    73 
       
    74     /**
       
    75      * Sets minimum width of soft edges.
       
    76      * @param aDepth Shadow depth in metric units.
       
    77      */
       
    78     IMPORT_C void SetSoftness(const THuiMetric& aSoftness);
       
    79 
       
    80     /**
       
    81      * Sets shadow color.
       
    82      * @param aColor Shadow color.
       
    83      */
       
    84     IMPORT_C void SetColor(const TRgb& aColor);
       
    85 
       
    86     /**
       
    87      * Destructor.
       
    88      */
       
    89     ~CHuiDropShadowBrush();
       
    90 
       
    91 
       
    92     /* Methods. */
       
    93     
       
    94     /**
       
    95      * From CHuiBrush.
       
    96      * @see CHuiBrush::Changed()
       
    97      */
       
    98     TBool Changed() const;
       
    99     
       
   100     /**
       
   101      * From CHuiBrush.
       
   102      * @see CHuiBrush::ClearChanged()
       
   103      */
       
   104     void ClearChanged();
       
   105         
       
   106     /**
       
   107      * Draw the brush.
       
   108      */
       
   109     void Draw(CHuiGc& aGc, const MHuiBrushGuide& aGuide) const;
       
   110     
       
   111     void ExpandVisualRect(TRect& aRect) const;
       
   112                       
       
   113 
       
   114 protected:
       
   115 
       
   116     /* Constructors. */
       
   117 
       
   118     /**
       
   119      * Constructor.
       
   120      */
       
   121     CHuiDropShadowBrush(TInt aDepth);
       
   122 
       
   123     /**
       
   124      * Constructor.
       
   125      */
       
   126     CHuiDropShadowBrush(const THuiMetric& aDepth);
       
   127 
       
   128 
       
   129 private:
       
   130 
       
   131     /* Private methods */
       
   132     TReal32 DepthInPixels(const CHuiVisual* aVisual) const;
       
   133     TReal32 SoftnessInPixels(const CHuiVisual* aVisual) const;
       
   134     TReal32 ValueInPixels(const CHuiVisual* aVisual, const THuiTimedValue& aValue) const;
       
   135 
       
   136 public:
       
   137 
       
   138     /* Public properties. */
       
   139 
       
   140     /** Minimum width of soft edges. */
       
   141     THuiTimedValue iSoftness;
       
   142 
       
   143     /** Depth of the shadow. */
       
   144     THuiTimedValue iDepth;
       
   145 
       
   146 private:
       
   147 
       
   148     /** Metric for depth of the shadow. */
       
   149     THuiMetric iDepthMetric;
       
   150 
       
   151     /** Metric for the shadow softness */
       
   152     THuiMetric iSoftnessMetric;
       
   153     
       
   154     /** Color for depth of the shadow. */
       
   155     TRgb iColor;
       
   156     };
       
   157 
       
   158 #endif  // __HUIDROPSHADOWBRUSH_H__