inc/alf/alfcommonattributesetter.h
branchRCL_3
changeset 26 0e9bb658ef58
parent 0 e83bab7cf002
equal deleted inserted replaced
25:4ea6f81c838a 26:0e9bb658ef58
       
     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:   attribute setter base implementation header.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ALFCOMMONATTRIBUTESETTER_H
       
    20 #define ALFCOMMONATTRIBUTESETTER_H
       
    21 
       
    22 #include "alf/ialfattributesetter.h"
       
    23 
       
    24 namespace Alf
       
    25     {
       
    26 
       
    27 /**
       
    28  *  @class AlfCommonAttributeSetter alfcommonattributesetter.h "alf/alfcommonattributesetter.h"
       
    29  *  Base implementation for attribute setters.
       
    30  *  @see IAlfAttributeSetter 
       
    31  *
       
    32  *  @lib alfwidgetmodel.lib
       
    33  *  @since S60 ?S60_version
       
    34  *  @status Draft
       
    35  *  @interfaces IAlfAttributeSetter
       
    36  */
       
    37 class AlfCommonAttributeSetter : public IAlfAttributeSetter
       
    38     {
       
    39 public:
       
    40 
       
    41     /**
       
    42      * Constructor.
       
    43      *
       
    44      * @param aType Type of the attribute setter.
       
    45      */
       
    46     OSN_IMPORT AlfCommonAttributeSetter();
       
    47 
       
    48     /**
       
    49      * Destructor.
       
    50      */
       
    51     OSN_IMPORT virtual ~AlfCommonAttributeSetter();
       
    52 
       
    53     // from base class IAlfAttributeSetter
       
    54 
       
    55     /**
       
    56      * Returns the type of the attribute setter.
       
    57      *
       
    58      * @return The type of the attribute setter.
       
    59      */
       
    60     OSN_IMPORT virtual SetterType setterType();
       
    61 
       
    62     /**
       
    63      * Sets an attribute value in the target visual immediately without a transition.
       
    64      * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if aContainer is invalid. 
       
    65      *
       
    66      * @param aVisual The target visual. Doesn't take ownership
       
    67      * @param aContainer The container holding the new value of the attribute.
       
    68      *        Ownership of the object is not transferred.
       
    69      */
       
    70     OSN_IMPORT virtual void setAttributeValue(
       
    71         CAlfVisual &aVisual, AlfAttributeContainer* aContainer, IAlfMap* aData);
       
    72 
       
    73     /**
       
    74      * Creates a command to change the value of an attribute in the target visual
       
    75      * gradually with a transition.
       
    76      *
       
    77      * @param aVisual The target visual. Doesn't take ownership
       
    78      * @param aContainer The container holding the new value of the attribute.
       
    79      *        Ownership of the object is not transferred.
       
    80      * @param aData Not used currently.
       
    81      * @param aTransitionTime Time used for the transition.
       
    82      * @param aRefVisual Optional reference visual. If not NULL, the target value
       
    83      *        of the attribute is defined by adding the value specific by aContainer
       
    84      *        to the corresponding attribute value in the reference visual.
       
    85      * @ret The command to gradually change the attribute in the target visual.
       
    86      */
       
    87     OSN_IMPORT virtual TAlfCommand* createCommand(
       
    88         CAlfVisual& aVisual, AlfAttributeContainer* aContainer, IAlfMap* aData,
       
    89         int aTransitionTime = 0, CAlfVisual* aRefVisual = NULL);
       
    90 
       
    91     /**
       
    92      * Creates commands to change the given attribute values in the target visual
       
    93      * gradually with a transition.Then sends the commands via the ALF environment.
       
    94      *
       
    95      * @param aVisual The target visual. Doesn't take ownership
       
    96      * @param aContainer The attribute container holding the attribute value(s)
       
    97      * used by the attribute setter. Ownership is not transferred. The container
       
    98      * can hold new values for multiple different attributes, in which case several
       
    99      * commands are executed.
       
   100      * @param aRefVisual Optional reference visual. If not NULL, the target value
       
   101      *        of the attribute is defined by adding the value specific by aContainer
       
   102      *        to the corresponding attribute value in the reference visual.
       
   103      */
       
   104     OSN_IMPORT virtual void createAndSendCommands(CAlfVisual& aVisual,
       
   105             AlfAttributeContainer* aContainer, CAlfVisual* aRefVisual = NULL);
       
   106 
       
   107 // from base class IAlfInterfaceBase
       
   108 
       
   109     /**
       
   110      * From IAlfInterfaceBase.
       
   111      * Getter for interfaces provided by the element classes.
       
   112      * Derived classes should always call the base class method
       
   113      * from the overridden makeInterface.
       
   114      *
       
   115      * @since S60 ?S60_version
       
   116      * @param aType A descriptor to identify the type of the queried interface.
       
   117      * @return The queried interface, or NULL if the interface is not
       
   118      *         supported or available.
       
   119      */
       
   120     OSN_IMPORT IAlfInterfaceBase* makeInterface(const IfId& aType);
       
   121 
       
   122     /**
       
   123      * Converts text between Unicode (UCS-2) and the Unicode transformation format UTF-8.
       
   124      *
       
   125      * @param aSrc The source string.
       
   126      * @return Converted string.
       
   127      */
       
   128     HBufC* convertToUnicodeFromUtf8(const TPtrC8& aSrc) const;
       
   129 
       
   130     /**
       
   131      * Sets Dirty check flag.
       
   132      *
       
   133      * @param aCheck whether dirty check should be enabled or not.
       
   134      */
       
   135     OSN_IMPORT void enableDirtyCheck(bool aCheck);
       
   136 protected:
       
   137 
       
   138     /**
       
   139      * Sets a value of a static attribute to target visual immediately without a transition.
       
   140      *
       
   141      * @param aVisual The target visual. Ownership not passed.
       
   142      * @param aAttr The attribute to process. Ownership not passed.
       
   143      * @param aContainer The container holding attributes. Ownership not passed.
       
   144      */
       
   145     virtual void handleStaticAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr,
       
   146                                        AlfAttributeContainer& aContainer);
       
   147 
       
   148     /**
       
   149      * Sets a dynamic attribute value in the target visual using transitions defined in attributes
       
   150      *
       
   151      * @param aVisual The target visual. Ownership not passed.
       
   152      * @param aAttr The attribute to process. Ownership not passed.
       
   153      * @param aContainer The container holding attributes. Ownership not passed.
       
   154      */
       
   155     virtual void handleDynamicAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr,
       
   156                                         AlfAttributeContainer& aContainer);
       
   157 
       
   158     /**
       
   159      * Sets a value for static data attribute in the target visual
       
   160      * immediately without a transition using data in map.
       
   161      *
       
   162      * @param aVisual The target visual. Ownership not passed.
       
   163      * @param aAttr The attribute to process. Ownership not passed.
       
   164      * @param aContainer The container holding attributes. Ownership not passed.
       
   165      * @param aData Contains data. Ownership not passed.
       
   166      */
       
   167     virtual void handleStaticDataAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr,
       
   168                                            AlfAttributeContainer& aContainer, IAlfMap* aData);
       
   169 
       
   170     /**
       
   171       * Sets a value for dynamic data attribute value in the target visual using transitions and data in map.
       
   172       *
       
   173       * @param aVisual The target visual. Ownership not passed.
       
   174       * @param aAttr The attribute to process. Ownership not passed.
       
   175       * @param aContainer The container holding attributes. Ownership not passed.
       
   176       * @param aData Contains data. Ownership not passed.
       
   177       */
       
   178     virtual void handleDynamicDataAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr,
       
   179                                             AlfAttributeContainer& aContainer, IAlfMap* aData);
       
   180 
       
   181 private: // data
       
   182     bool mDoDirtycheck;
       
   183     };
       
   184 
       
   185     } // namespace Alf
       
   186 
       
   187 #endif // ALFCOMMONATTRIBUTESETTER_H