inc/alf/alfimagevisualattributesetter.h
changeset 17 3eca7e70b1b8
parent 3 4526337fb576
equal deleted inserted replaced
3:4526337fb576 17:3eca7e70b1b8
     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:   Image visual attribute setter Header.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ALFIMAGEVISUALATTRIBUTESETTER_H
       
    20 #define ALFIMAGEVISUALATTRIBUTESETTER_H
       
    21 
       
    22 #include <osn/osndefines.h>
       
    23 #include "alf/alfcommonvisualattributesetter.h"
       
    24 
       
    25 class CAlfImageVisual;
       
    26 
       
    27 namespace Alf
       
    28     {
       
    29 class AlfImageVisualAttributeSetterImpl;
       
    30 class IAlfVariantType;
       
    31 class ResourcePool;
       
    32 
       
    33 /**
       
    34  *  @class AlfImageVisualAttributeSetter alfimagevisualattributesetter.h "alf/alfimagevisualattributesetter.h"
       
    35  *  The implementation of the attribute setter for setting image visual attributes.
       
    36  *  @see IAlfAttributeSetter
       
    37  *
       
    38  *  @lib alfwidgetmodel.lib
       
    39  *  @since S60 ?S60_version
       
    40  *  @status Draft
       
    41  *  @interfaces IAlfAttributeSetter
       
    42  */
       
    43 class AlfImageVisualAttributeSetter : public AlfCommonVisualAttributeSetter
       
    44     {
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Constructor.
       
    49      *
       
    50      * @param aType Type of the attribute setter.
       
    51      */
       
    52     OSN_IMPORT AlfImageVisualAttributeSetter();
       
    53 
       
    54     /**
       
    55      * Destructor.
       
    56      */
       
    57     OSN_IMPORT virtual ~AlfImageVisualAttributeSetter();
       
    58 
       
    59     /**
       
    60      * Sets the attribute values to the target visual.
       
    61      * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aVisual 
       
    62      *                                        is not an image visual.
       
    63      * @exception osncore::AlfDataException   Thrown with error code osncore::EInvalidAttribute if the data field  
       
    64      *                                        for data attributes is 0.
       
    65      * @exception osncore::AlfDataException   Thrown with error code osncore::EInvalidVariantDataType if aData  
       
    66      *                                        for data attributes is 0.
       
    67      * @exception osncore::AlfDataException   Thrown with error code osncore::EIncompleteAttributeValues if an  
       
    68      *                                        attempt is made to set a color attribute with insufficient data. 
       
    69      *                                        See language specification on how to create this attribute.
       
    70      * @exception osncore::AlfDataException   Thrown with error code osncore::EInvalidAttribute if an  
       
    71      *                                        attempt is made to set a color attribute with incompatible data types. 
       
    72      *                                        See language specification on how to create this attribute.
       
    73      * @exception osncore::AlfDataException   Thrown with error code osncore::EInvalidAttribute if an  
       
    74      *                                        attempt is made to set a drop shadow attribute with incompatible data. 
       
    75      *                                        See language specification on how to create this attribute.
       
    76      * @exception osncore::AlfDataException   Thrown with Symbian error code if the skin animation ID cannot be retreived 
       
    77      *                                        while setting an animated skin image.
       
    78      * @exception osncore::AlfDataException   Thrown with Symbian error code if the skin frame ID cannot be retreived 
       
    79      *                                        while setting an skin frame image.
       
    80      * @exception osncore::ThemeException     Thrown when skinid is not found.
       
    81      *
       
    82      * @since S60 ?S60_version
       
    83      * @param aVisual The target visual. Doesn't take ownership.
       
    84      * @param aContainer The container holding the value of the attributes.
       
    85      *        Ownership of the object is not transferred.
       
    86      * @param aData Used with data attributes to fetch the data.
       
    87      */
       
    88     OSN_IMPORT virtual void setAttributeValue (
       
    89         CAlfVisual &aVisual,
       
    90         AlfAttributeContainer* aContainer,
       
    91         IAlfMap* aData );
       
    92 
       
    93     /**
       
    94      * Creates a command to change the value of an attribute in the target visual gradually with a transition.
       
    95      *
       
    96      * @param aVisual The target visual. Doesn't take ownership
       
    97      * @param aContainer The container holding the new value of the attribute. Ownership of the object is not transferred.
       
    98      * @param aData Not used currently.
       
    99      * @param aTransitionTime Time used for the transition.
       
   100      * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding
       
   101      * the value specific by aContainer to the corresponding attribute value in the reference visual.
       
   102      * @ret The command to gradually change the attribute in the target visual.
       
   103      */
       
   104     OSN_IMPORT virtual TAlfCommand* createCommand(
       
   105         CAlfVisual& aVisual,
       
   106         AlfAttributeContainer* aContainer,
       
   107         IAlfMap* aData,
       
   108         int aTransitionTime = 0,
       
   109         CAlfVisual* aRefVisual = NULL );
       
   110 
       
   111     /**
       
   112      * Creates commands to change the given attribute values in the target visual gradually with a transition.
       
   113      * Then sends the commands via the ALF environment.
       
   114      *
       
   115      * @param aVisual The target visual. Doesn't take ownership
       
   116      * @param aContainer The attribute container holding the attribute value(s)
       
   117      * used by the attribute setter. Ownership is not transferred. The container
       
   118      * can hold new values for multiple different attributes, in which case several
       
   119      * commands are executed.
       
   120      * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding
       
   121      * the value specific by aContainer to the corresponding attribute value in the reference visual.
       
   122      */
       
   123     OSN_IMPORT virtual void createAndSendCommands(
       
   124         CAlfVisual& aVisual,
       
   125         AlfAttributeContainer* aContainer,
       
   126         CAlfVisual* aRefVisual = NULL );
       
   127 
       
   128 protected:
       
   129 
       
   130     /**
       
   131      * From AlfCommonVisualAttributeSetter
       
   132      * Sets an value of a static attribute to target visual immediately without a transition.
       
   133      *
       
   134      * @param aVisual The target visual. Doesn't take ownership
       
   135      * @param aAttr The attribute to process. Doesn't take ownership
       
   136      * @param aContainer The container holding attributes. Ownership of the object is not transferred.
       
   137      * @param aData Contains data.Ownership of the object is not transferred.
       
   138      */
       
   139     virtual void handleStaticAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer);
       
   140 
       
   141     /**
       
   142      * From AlfCommonVisualAttributeSetter
       
   143      * Sets an dynamic attribute value in the target visual using transitions defined in attributes
       
   144      *
       
   145      * @param aVisual The target visual. Doesn't take ownership
       
   146      * @param aAttr The attribute to process. Doesn't take ownership
       
   147      * @param aContainer The container holding attributes. Ownership of the object is not transferred.
       
   148      * @param aData Contains data.Ownership of the object is not transferred.
       
   149      */
       
   150     virtual void handleDynamicAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer);
       
   151 
       
   152     /**
       
   153      * From AlfCommonVisualAttributeSetter
       
   154      * Sets an value for static attribute in the target visual immediately without a transition using data in map.
       
   155      *
       
   156      * @param aVisual The target visual. Doesn't take ownership
       
   157      * @param aAttr The attribute to process. Doesn't take ownership
       
   158      * @param aContainer The container holding attributes. Ownership of the object is not transferred.
       
   159      * @param aData Contains data.Ownership of the object is not transferred.
       
   160      */
       
   161     virtual void handleStaticDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData);
       
   162 
       
   163     /**
       
   164      * From AlfCommonVisualAttributeSetter
       
   165      * Sets an value for dynamic attribute value in the target visual using transitions and data in map.
       
   166      *
       
   167      * @param aVisual The target visual. Doesn't take ownership
       
   168      * @param aAttr The attribute to process. Doesn't take ownership
       
   169      * @param aContainer The container holding attributes. Ownership of the object is not transferred.
       
   170      * @param aData Contains data.Ownership of the object is not transferred.
       
   171      */
       
   172     virtual void handleDynamicDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData);
       
   173 
       
   174 private:
       
   175     /**
       
   176      * Sets FrameImage for aVisual using the frame skin id stored in aAttr
       
   177      *
       
   178      * @param aVisual The target visual. Doesn't take ownership
       
   179      * @param aSkinFrameImage LogicalName for the frame image. Ownership of the object is not transferred
       
   180 	 * @param aContainer The container holding attributes. Ownership of the object is not transferred.
       
   181 	 * @param aData datamap used in staticdata case. Ownership of the object is not transferred.
       
   182 	 *
       
   183 	 * @exception osncore::ThemeException  Thrown when SkinId is not found. 
       
   184      */
       
   185     void setFrameImage(CAlfVisual& aVisual,const Utf8* aSkinFrameID, const AlfAttributeContainer& aContainer,IAlfMap* aData=NULL);
       
   186     /**
       
   187      * Gets the attribute value based on whether attribute type is static or staticdata.
       
   188 	 *
       
   189      * @param aAttr The attribute to process. Doesn't take ownership.
       
   190      * @param aData datamap used in staticdata case. Doesn't take ownership
       
   191      *
       
   192      * @return returns the attributeValue.. 	 
       
   193      */ 
       
   194     int getValueFromAttribute(const AlfAttribute& aAttr,IAlfMap* aData) const;
       
   195 
       
   196     void HandleImagePathAttribute(
       
   197         const TPtrC8& aStringValue,
       
   198         CAlfImageVisual* aImageVisual,
       
   199         bool aPrimary );
       
   200 
       
   201 private: // data
       
   202     auto_ptr<AlfImageVisualAttributeSetterImpl> mImpl;
       
   203     };
       
   204 
       
   205     } // namespace Alf
       
   206 
       
   207 #endif // ALFIMAGEVISUALATTRIBUTESETTER_H
       
   208