inc/alf/alfcommonlayoutattributesetter.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:   layout attribute setters base implementation header.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ALFCOMMONLAYOUTATTRIBUTESETTER_H
       
    20 #define ALFCOMMONLAYOUTATTRIBUTESETTER_H
       
    21 
       
    22 #include <osn/osndefines.h>
       
    23 #include <memory>
       
    24 #include <osn/ustring.h>
       
    25 #include "alf/alfcommonvisualattributesetter.h"
       
    26 
       
    27 using namespace osncore;
       
    28 
       
    29 using std::auto_ptr;
       
    30 
       
    31 namespace Alf
       
    32     {
       
    33 
       
    34 /**
       
    35  *  @class AlfCommonLayoutAttributeSetter alfcommonlayoutattributesetter.h "alf/alfcommonlayoutattributesetter.h"
       
    36  *  Base implementation for layout attribute setters. Attribute setters for custom layouts can derive from this 
       
    37  *  class.
       
    38  *  @see IAlfAttributeSetter 
       
    39  *
       
    40  *  @lib alfwidgetmodel.lib
       
    41  *  @since S60 ?S60_version
       
    42  *  @status Draft
       
    43  *  @interfaces IAlfAttributeSetter
       
    44  */
       
    45 class AlfCommonLayoutAttributeSetter : public AlfCommonVisualAttributeSetter
       
    46     {
       
    47 public:
       
    48 
       
    49     /**
       
    50      * Constructor.
       
    51      *
       
    52      * @param aType Type of the attribute setter.
       
    53      */
       
    54     OSN_IMPORT AlfCommonLayoutAttributeSetter();
       
    55 
       
    56     /**
       
    57      * Destructor.
       
    58      */
       
    59     OSN_IMPORT virtual ~AlfCommonLayoutAttributeSetter();
       
    60 
       
    61     /**
       
    62      * Sets the attribute values to the target visual.
       
    63      * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aVisual is not 
       
    64      *                                        a layout.
       
    65      *
       
    66      * @since S60 ?S60_version
       
    67      * @param aVisual The target visual. Doesn't take ownership
       
    68      * @param aContainer The container holding the value of the attributes.
       
    69      *        Ownership of the object is not transferred.
       
    70      * @param aData Used with data attributes to fetch the data.
       
    71      */
       
    72     OSN_IMPORT virtual void setAttributeValue (
       
    73         CAlfVisual &aVisual,
       
    74         AlfAttributeContainer* aContainer,
       
    75         IAlfMap* aData );
       
    76 
       
    77     /**
       
    78      * Creates a command to change the value of an attribute in the target visual gradually with a transition.
       
    79      *
       
    80      * @param aVisual The target visual. Doesn't take ownership
       
    81      * @param aContainer The container holding the new value of the attribute. Ownership of the object is not transferred.
       
    82      * @param aData Not used currently.
       
    83      * @param aTransitionTime Time used for the transition.
       
    84      * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding
       
    85      * the value specific by aContainer to the corresponding attribute value in the reference visual.
       
    86      * @ret The command to gradually change the attribute in the target visual.
       
    87      */
       
    88     OSN_IMPORT virtual TAlfCommand* createCommand(
       
    89         CAlfVisual& aVisual,
       
    90         AlfAttributeContainer* aContainer,
       
    91         IAlfMap* aData,
       
    92         int aTransitionTime = 0,
       
    93         CAlfVisual* aRefVisual = NULL );
       
    94 
       
    95     /**
       
    96      * Creates commands to change the given attribute values in the target visual gradually with a transition.
       
    97      * Then sends the commands via the ALF environment.
       
    98      *
       
    99      * @param aVisual The target visual. Doesn't take ownership
       
   100      * @param aContainer The attribute container holding the attribute value(s)
       
   101      * used by the attribute setter. Ownership is not transferred. The container
       
   102      * can hold new values for multiple different attributes, in which case several
       
   103      * commands are executed.
       
   104      * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding
       
   105      * the value specific by aContainer to the corresponding attribute value in the reference visual.
       
   106      */
       
   107     OSN_IMPORT virtual void createAndSendCommands(
       
   108         CAlfVisual& aVisual,
       
   109         AlfAttributeContainer* aContainer,
       
   110         CAlfVisual* aRefVisual = NULL );
       
   111 
       
   112 
       
   113 
       
   114 protected:
       
   115 
       
   116     /**
       
   117      * From AlfCommonVisualAttributeSetter
       
   118      * Sets an value of a static attribute to target visual immediately without a transition.
       
   119      *
       
   120      * @param aVisual The target visual. Doesn't take ownership
       
   121      * @param aAttr The attribute to process. Doesn't take ownership
       
   122      * @param aContainer The container holding attributes. Ownership of the object is not transferred.
       
   123      */
       
   124     void handleStaticAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr,
       
   125                                AlfAttributeContainer& aContainer);
       
   126 
       
   127     /**
       
   128      * From AlfCommonVisualAttributeSetter
       
   129      * Sets an dynamic attribute value in the target visual using transitions defined in attributes
       
   130      *
       
   131      * @param aVisual The target visual. Doesn't take ownership
       
   132      * @param aAttr The attribute to process. Doesn't take ownership
       
   133      * @param aContainer The container holding attributes. Ownership of the object is not transferred.
       
   134      */
       
   135     void handleDynamicAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr,
       
   136                                 AlfAttributeContainer& aContainer);
       
   137 
       
   138     /**
       
   139      * From AlfCommonVisualAttributeSetter
       
   140      * Sets an value for static attribute in the target visual immediately without a transition using data in map.
       
   141      *
       
   142      * @param aVisual The target visual. Doesn't take ownership
       
   143      * @param aAttr The attribute to process. Doesn't take ownership
       
   144      * @param aContainer The container holding attributes. Ownership of the object is not transferred.
       
   145      * @param aData Contains data.Ownership of the object is not transferred.
       
   146      */
       
   147     void handleStaticDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr,
       
   148                                    AlfAttributeContainer& aContainer, IAlfMap* aData);
       
   149 
       
   150     /**
       
   151      * From AlfCommonVisualAttributeSetter
       
   152      * Sets an value for dynamic attribute value in the target visual using transitions and data in map.
       
   153      *
       
   154      * @param aVisual The target visual. Doesn't take ownership
       
   155      * @param aAttr The attribute to process. Doesn't take ownership
       
   156      * @param aContainer The container holding attributes. Ownership of the object is not transferred.
       
   157      * @param aData Contains data.Ownership of the object is not transferred.
       
   158      */
       
   159     void handleDynamicDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr,
       
   160                                     AlfAttributeContainer& aContainer, IAlfMap* aData);
       
   161     };
       
   162 
       
   163     } // namespace Alf
       
   164 
       
   165 #endif // ALFCOMMONLAYOUTATTRIBUTESETTER_H
       
   166