widgetmodel/alfwidgetmodel/inc/alfanimationoutput.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:  Animation class for alfred widget model.
       
    15       This class creates the animation and commands.
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef ALF_ANIMATIONOUTPUT_H
       
    24 #define ALF_ANIMATIONOUTPUT_H
       
    25 
       
    26 #include <osn/osndefines.h>
       
    27 // FORWARD DECLARATIONS
       
    28 class CAlfControl;
       
    29 class CAlfVisual;
       
    30 namespace Alf
       
    31     {
       
    32 // FORWARD DECLARATIONS
       
    33 class IAlfAttributeSetter;
       
    34 class AlfReferenceToVisual;
       
    35 class AlfAttributeContainer;
       
    36 
       
    37 /**
       
    38  *  @class AlfAnimationOutput alfanimationoutput.h "alfanimationoutput.h"
       
    39  *  Class for creating a command for setting or animating
       
    40  *  visual attribute values. Animation sequences can be created
       
    41  *  by specifying delay parameters. The target attribute value
       
    42  *  can be specified relatively to a reference visual.
       
    43  *
       
    44  *  @lib alfwidgetmodel.lib
       
    45  *  @since S60 ?S60_version
       
    46  *  @status Draft
       
    47  */
       
    48 class AlfAnimationOutput
       
    49     {
       
    50 public:
       
    51     /**
       
    52      * Constructor.
       
    53      *
       
    54      * @since S60 ?S60_version
       
    55      *
       
    56      * @param aTargetVisual  Reference to the animated visual.
       
    57      * @param aReferenceVisual Reference to the visual with the reference value,
       
    58      *       or NULL if no reference value is used.
       
    59      * @param aAttributeSetter The attribute setter for animating the attribute
       
    60      *       using Hitchcock commands. Ownership is transferred.
       
    61      *
       
    62      * @param aAttributeContainer The attribute container holding the attribute
       
    63      * value(s) used by the attribute setter. Ownership is transferred, if the method does not
       
    64      * throw an exception. The container can hold new values for multiple different
       
    65      * attributes, in which case all of them are applied when the animation output
       
    66      * is triggered.
       
    67      *
       
    68      * @param aAnimationTime The duration of the animation. Note that this parameter
       
    69      * is used only if the transition time parameter is not defined in the
       
    70      * corresponding attribute in the attribute container.
       
    71      *
       
    72      * @param aDelay The delay in microseconds before starting the animation.
       
    73      * Note that this parameter is used only if the delay parameter is not defined in the
       
    74      * corresponding attribute in the attribute container.
       
    75      */
       
    76     OSN_IMPORT AlfAnimationOutput(AlfReferenceToVisual* aTargetVisual,
       
    77                                   AlfReferenceToVisual* aReferenceVisual,
       
    78                                   IAlfAttributeSetter* aAttributeSetter,
       
    79                                   AlfAttributeContainer* aAttributeContainer,
       
    80                                   unsigned int aAnimationTime, unsigned int aDelay);
       
    81 
       
    82     /** Destructor. No derived classes, therefore not virtual. */
       
    83     OSN_IMPORT ~AlfAnimationOutput();
       
    84 
       
    85 
       
    86     /**
       
    87      * Create and send the animation command.
       
    88      * @exception osncore::AlfVisualException Thrown with EInvalidVisual if reference visual or \n
       
    89      *                                        target visual is invalid .
       
    90      * 
       
    91      * @since S60 ?S60_version
       
    92      * @param aControl  The control to find the animated visual and
       
    93      *      the reference visual.
       
    94      * @param aDataID  The data ID used to create the animated visual
       
    95      *      and the reference visual. The caller
       
    96      *      is responsible for determining what data ID
       
    97      *      is related to the visuals. The visual references
       
    98      *      may or may not use the given data ID.
       
    99      * @return The visual, or NULL if the visual was not found.
       
   100      */
       
   101     OSN_IMPORT void sendCommand(CAlfWidgetControl& aControl, unsigned int aDataID);
       
   102 
       
   103 private:
       
   104     // Reference to the animated visual. Owned.
       
   105     AlfReferenceToVisual* mTargetVisual;
       
   106     // Reference to the visual with the reference value. Owned.
       
   107     AlfReferenceToVisual* mReferenceVisual;
       
   108     // The attribute setter. Owned.
       
   109     IAlfAttributeSetter* mAttributeSetter;
       
   110     // The attribute value container. Owned.
       
   111     AlfAttributeContainer* mAttributeContainer;
       
   112     // The duration of the animation.
       
   113     unsigned int mAnimationTime;
       
   114     // The delay before sending the animation command.
       
   115     unsigned int mDelay;
       
   116     };
       
   117 
       
   118     } // namespace Alf
       
   119 
       
   120 #endif //ALF_ANIMATIONOUTPUT_H