inc/alf/alfviewportlayoutattributesetter.h
branchRCL_3
changeset 20 0e9bb658ef58
parent 0 e83bab7cf002
equal deleted inserted replaced
19:4ea6f81c838a 20: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:   Viewport layout attribute setter header.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ALFVIEWPORTLAYOUTATTRIBUTESETTER_H
       
    20 #define ALFVIEWPORTLAYOUTATTRIBUTESETTER_H
       
    21 
       
    22 //includes
       
    23 
       
    24 //widget model includes
       
    25 #include "alf/alfcommonlayoutattributesetter.h"
       
    26 
       
    27 //osn includes
       
    28 #include <osn/osndefines.h>
       
    29 
       
    30 
       
    31 namespace Alf
       
    32     {
       
    33 
       
    34 /**
       
    35  *  @class AlfViewportLayoutAttributeSetter alfviewportlayoutattributesetter.h
       
    36  *  "alf/alfviewportlayoutattributesetter.h"
       
    37  *
       
    38  *  The implementation of the attribute setter for setting viewport 
       
    39  *  layout attributes.
       
    40  *
       
    41  *  @see IAlfAttributeSetter
       
    42  *
       
    43  *  @lib alfwidgetmodel.lib
       
    44  *  @since S60 ?S60_version
       
    45  *  @status Draft
       
    46  *  @interfaces IAlfAttributeSetter
       
    47  */
       
    48 class AlfViewportLayoutAttributeSetter : public AlfCommonLayoutAttributeSetter
       
    49     {
       
    50 
       
    51 public:
       
    52 
       
    53     /**
       
    54      * Constructor.
       
    55      */
       
    56     OSN_IMPORT AlfViewportLayoutAttributeSetter();
       
    57 
       
    58     /**
       
    59      * Destructor.
       
    60      */
       
    61     OSN_IMPORT virtual ~AlfViewportLayoutAttributeSetter();
       
    62 
       
    63 
       
    64     /**
       
    65      * Sets an attribute value in the target visual immediately without a transition.
       
    66      * @exception osncore::AlfVisualException Thrown with error code 
       
    67      *     osncore::EInvalidVisual if aVisual is not viewport layout.
       
    68      * @exception osncore::AlfDataException Thrown with error code 
       
    69      *     osncore::EInvalidVariantDataType if aData  for data attributes is 0.
       
    70      * @exception osncore::AlfDataException Thrown with error code 
       
    71      *     osncore::EIncompleteAttributeValues if the aContainer contains an
       
    72      *     incomplete set of attributes. See language specification on creating
       
    73      *     attributes for viewport layout. 
       
    74      *
       
    75      * @param aVisual The target visual. Doesn't take ownership
       
    76      * @param aContainer The container holding the new value of the attribute.
       
    77      *      Ownership of the object is not transferred.
       
    78      * @param aData Used with data attributes to fetch the data.
       
    79      */
       
    80     OSN_IMPORT virtual void setAttributeValue (
       
    81                                 CAlfVisual &aVisual,
       
    82                                 AlfAttributeContainer* aContainer,
       
    83                                 IAlfMap* aData );
       
    84 
       
    85     /**
       
    86      * Depracated! Do not use!
       
    87      * Creates a command to change the value of an attribute in the target
       
    88      * visual gradually with a transition.
       
    89      *
       
    90      * @param aVisual The target visual. Doesn't take ownership
       
    91      * @param aContainer The container holding the new value of the attribute.
       
    92      *      Ownership of the object is not transferred.
       
    93      * @param aData Not used currently.
       
    94      * @param aTransitionTime Time used for the transition.
       
    95      * @param aRefVisual Optional reference visual. If not NULL, the target
       
    96      *      value of the attribute is defined by adding the value
       
    97      *      specific by aContainer to the corresponding attribute
       
    98      *      value in the reference visual.
       
    99      * @ret The command to gradually change the attribute in the target visual.
       
   100      */
       
   101     OSN_IMPORT virtual TAlfCommand* createCommand (
       
   102                                         CAlfVisual& aVisual,
       
   103                                         AlfAttributeContainer* aContainer,
       
   104                                         IAlfMap* aData,
       
   105                                         int aTransitionTime = 0,
       
   106                                         CAlfVisual* aRefVisual = NULL );
       
   107 
       
   108     /**
       
   109      * Creates commands to change the given attribute values in the target
       
   110      * visual gradually with a transition. Then sends the commands via the
       
   111      * ALF environment.
       
   112      *
       
   113      * @param aVisual The target visual. Doesn't take ownership
       
   114      * @param aContainer The attribute container holding the attribute value(s)
       
   115      *     used by the attribute setter. Ownership is not transferred.The
       
   116      *     container can hold new values for multiple different attributes, in
       
   117      *     which case several commands are executed.
       
   118      * @param aRefVisual Optional reference visual. If not NULL, the target
       
   119      *     value of the attribute is defined by adding the value specific by 
       
   120      *     aContainer to the corresponding attribute value in the reference
       
   121      *     visual.
       
   122      */
       
   123     OSN_IMPORT virtual void createAndSendCommands (
       
   124                                 CAlfVisual& aVisual,
       
   125                                 AlfAttributeContainer* aContainer,
       
   126                                 CAlfVisual* aRefVisual = NULL );
       
   127 
       
   128 
       
   129 protected:
       
   130 
       
   131     /**
       
   132      * Sets a dynamic attribute value in the target visual using transitions
       
   133      * defined in attributes
       
   134      *
       
   135      * @since S60 ?S60_version
       
   136      * @param aVisual The target visual. Doesn't take ownership
       
   137      * @param aAttr The attribute to process. Doesn't take ownership
       
   138      * @param aContainer The container holding attributes. Ownership of the
       
   139      *      object is not transferred.
       
   140      */
       
   141     virtual void handleDynamicAttribute (
       
   142                      CAlfVisual &aVisual,
       
   143                      AlfAttribute& aAttr,
       
   144                      AlfAttributeContainer& aContainer);
       
   145 
       
   146     /**
       
   147      * Sets a value for static attribute in the target visual immediately
       
   148      * without a transition using data in map.
       
   149      *
       
   150      * @param aVisual The target visual. Doesn't take ownership
       
   151      * @param aAttr The attribute to process. Doesn't take ownership
       
   152      * @param aContainer The container holding attributes. Ownership of the
       
   153      *      object is not transferred.
       
   154      * @param aData Contains data.Ownership of the object is not transferred.
       
   155      */
       
   156     virtual void handleStaticDataAttribute (
       
   157                      CAlfVisual &aVisual, AlfAttribute& aAttr,
       
   158                      AlfAttributeContainer& aContainer, IAlfMap* aData );
       
   159 
       
   160     /**
       
   161      * Sets a value for dynamic attribute value in the target visual using
       
   162      * transitions and data in map.
       
   163      *
       
   164      * @param aVisual The target visual. Doesn't take ownership
       
   165      * @param aAttr The attribute to process. Doesn't take ownership
       
   166      * @param aContainer The container holding attributes. Ownership of the
       
   167      *      object is not transferred.
       
   168         * @param aData Contains data.Ownership of the object is not transferred.
       
   169      */
       
   170     virtual void handleDynamicDataAttribute (
       
   171                      CAlfVisual &aVisual, AlfAttribute& aAttr,
       
   172                      AlfAttributeContainer& aContainer, IAlfMap* aData);
       
   173 
       
   174     /**
       
   175      * Sets a value of a static attribute to target visual immediately without
       
   176      * a transition.
       
   177      *
       
   178      * @param aVisual The target visual. Doesn't take ownership
       
   179      * @param aAttr The attribute to process. Doesn't take ownership
       
   180      * @param aContainer The container holding attributes. Ownership of the
       
   181      *      object is not transferred.
       
   182      * @param aData Contains data.Ownership of the object is not transferred.
       
   183      */
       
   184     virtual void handleStaticAttribute (
       
   185                      CAlfVisual &aVisual, AlfAttribute& aAttr,
       
   186                      AlfAttributeContainer& aContainer);
       
   187 
       
   188 private:
       
   189 
       
   190     /**
       
   191      * Sets a dynamic attribute value in the target visual using transitions
       
   192      * defined in attributes
       
   193      *
       
   194      * @since S60 ?S60_version
       
   195      * @param aVisual The target visual. Doesn't take ownership
       
   196      * @param aAttr The attribute to process. Doesn't take ownership
       
   197      * @param aContainer The container holding attributes. Ownership of the
       
   198      *      object is not transferred.
       
   199      * @param aImmediate if true, the change is immediate and time value of
       
   200      *      the attribute is not used.
       
   201      */
       
   202     bool doHandleDynamicAttribute (
       
   203             CAlfVisual &aVisual, AlfAttribute& aAttr,
       
   204             AlfAttributeContainer& aContainer, bool aImmediate = false);
       
   205 
       
   206     /**
       
   207      * Sets a value for dynamic attribute value in the target visual using
       
   208      * transitions and data in map.
       
   209      *
       
   210      * @param aVisual The target visual. Doesn't take ownership
       
   211      * @param aAttr The attribute to process. Doesn't take ownership
       
   212      * @param aContainer The container holding attributes. Ownership of the
       
   213      *      object is not transferred.
       
   214      * @param aData Contains data.Ownership of the object is not transferred.
       
   215      * @param aImmediate if true, the change is immediate and time value of
       
   216      *      the attribute is not used.
       
   217      */
       
   218     bool doHandleDynamicDataAttribute (
       
   219              CAlfVisual &aVisual, AlfAttribute& aAttr,
       
   220              AlfAttributeContainer& aContainer, IAlfMap* aData,
       
   221              bool aImmediate = false);
       
   222 
       
   223     /**
       
   224     * Gets the data from map pointed by attribute's field name.
       
   225     *
       
   226     * @param aAttr The attribute to process. Doesn't take ownership
       
   227     * @param aData Contains data.Ownership of the object is not transferred.
       
   228     *
       
   229     * @return pointer to the data from map pointed by attribute's field name.
       
   230     */
       
   231     IAlfVariantType* getData(AlfAttribute& aAttr, IAlfMap* aData);
       
   232 
       
   233     /**
       
   234     * gets the time from attribute safely.
       
   235     *
       
   236     * @param aAttr The attribute to process. Doesn't take ownership
       
   237     * @param aImmediate if true, returns 0 else the time set for the attribute
       
   238     */
       
   239     int getTime(const AlfAttribute& aAttr, bool aImmediate = false);
       
   240 
       
   241 private: // data
       
   242     };
       
   243 
       
   244     } // namespace Alf
       
   245 
       
   246 #endif // ALFVIEWPORTLAYOUTATTRIBUTESETTER_H
       
   247 // End of file
       
   248 
       
   249