ginebra2/GraphicsItemAnimation.h
changeset 3 0954f5dd2cd0
parent 0 1450b09d0cfd
equal deleted inserted replaced
1:b0dd75e285d2 3:0954f5dd2cd0
     1 /*
     1 /*
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 *
     5 * under the terms of "Eclipse Public License v1.0"
     5 * This program is free software: you can redistribute it and/or modify
     6 * which accompanies this distribution, and is available
     6 * it under the terms of the GNU Lesser General Public License as published by
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * the Free Software Foundation, version 2.1 of the License.
     8 *
     8 *
     9 * Initial Contributors:
     9 * This program is distributed in the hope that it will be useful,
    10 * Nokia Corporation - initial contribution.
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11 *
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12 * Contributors:
    12 * GNU Lesser General Public License for more details.
    13 *
    13 *
    14 * Description: 
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not,
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 * Description:
    15 *
    19 *
    16 */
    20 */
    17 
       
    18 
    21 
    19 #ifndef GRAPHICSITEMANIMATION_H
    22 #ifndef GRAPHICSITEMANIMATION_H
    20 #define GRAPHICSITEMANIMATION_H
    23 #define GRAPHICSITEMANIMATION_H
    21 
    24 
    22 #include <QObject>
    25 #include <QObject>
    37     virtual ~GraphicsItemAnimator() {}
    40     virtual ~GraphicsItemAnimator() {}
    38 };
    41 };
    39 
    42 
    40 // ----------------------
    43 // ----------------------
    41 
    44 
    42 /** 
    45 /**
    43  * \brief Provides fade animations for ChromeSnippets.
    46  * \brief Provides fade animations for ChromeSnippets.
    44  * 
    47  *
    45  * \sa GraphicsItemAnimation
    48  * \sa GraphicsItemAnimation
    46  */
    49  */
    47 class GraphicsItemAnimatorFade : public GraphicsItemAnimator
    50 class GraphicsItemAnimatorFade : public GraphicsItemAnimator
    48 {
    51 {
    49 public:
    52 public:
    61     qreal m_opacityDelta;
    64     qreal m_opacityDelta;
    62 };
    65 };
    63 
    66 
    64 // ----------------------
    67 // ----------------------
    65 
    68 
    66 /** 
    69 /**
    67  * \brief Provides translation animations for ChromeSnippets.
    70  * \brief Provides translation animations for ChromeSnippets.
    68  * 
    71  *
    69  * \sa GraphicsItemAnimation
    72  * \sa GraphicsItemAnimation
    70  */
    73  */
    71 class GraphicsItemAnimatorTranslate : public GraphicsItemAnimator
    74 class GraphicsItemAnimatorTranslate : public GraphicsItemAnimator
    72 {
    75 {
    73 public:
    76 public:
    87     qreal m_yDelta;
    90     qreal m_yDelta;
    88 };
    91 };
    89 
    92 
    90 // ----------------------
    93 // ----------------------
    91 
    94 
    92 /** 
    95 /**
    93 v * \brief Provides rotation animations for ChromeSnippets.
    96 v * \brief Provides rotation animations for ChromeSnippets.
    94  * 
    97  *
    95  * \sa GraphicsItemAnimation
    98  * \sa GraphicsItemAnimation
    96  */
    99  */
    97 class GraphicsItemAnimatorRotate : public GraphicsItemAnimator
   100 class GraphicsItemAnimatorRotate : public GraphicsItemAnimator
    98 {
   101 {
    99 public:
   102 public:
   121 
   124 
   122 // ----------------------
   125 // ----------------------
   123 
   126 
   124 /**
   127 /**
   125  * \brief Basic animations for ChromeSnippets
   128  * \brief Basic animations for ChromeSnippets
   126  * 
   129  *
   127  * The GraphicsItemAnimation class provides basic animations for ChromeSnippets.
   130  * The GraphicsItemAnimation class provides basic animations for ChromeSnippets.
   128  * 
   131  *
   129  * Calls to translateTo(), translateBy(), fadeTo() etc. can be chained together in javascript as follows:
   132  * Calls to translateTo(), translateBy(), fadeTo() etc. can be chained together in javascript as follows:
   130  *   \code window.snippets.TopChromeId.animate(500).translateBy(10,30).fadeBy(-0.5).start()\endcode
   133  *   \code window.snippets.TopChromeId.animate(500).translateBy(10,30).fadeBy(-0.5).start()\endcode
   131  *   
   134  *
   132  * \sa ChromeSnippet::animate()
   135  * \sa ChromeSnippet::animate()
   133  * \sa GraphicsItemAnimator
   136  * \sa GraphicsItemAnimator
   134  * \sa AttentionAnimator
   137  * \sa AttentionAnimator
   135  * \sa VisibilityAnimator
   138  * \sa VisibilityAnimator
   136  */
   139  */
   208         }
   211         }
   209         emit updated(value);
   212         emit updated(value);
   210     }
   213     }
   211 
   214 
   212 private:
   215 private:
   213     ChromeSnippet *m_snippet;
   216     ChromeSnippet *m_snippet;   // not owned
   214     QTimeLine m_timeLine;
   217     QTimeLine m_timeLine;
   215     QList<GraphicsItemAnimator *> m_animators;
   218     QList<GraphicsItemAnimator *> m_animators;
   216 };
   219 };
   217 
   220 
   218 }
   221 }