ginebra2/VisibilityAnimator.h
changeset 0 1450b09d0cfd
child 3 0954f5dd2cd0
equal deleted inserted replaced
-1:000000000000 0:1450b09d0cfd
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __GINEBRA_VISIBILITYANIMATOR_H__
       
    20 #define __GINEBRA_VISIBILITYANIMATOR_H__
       
    21 
       
    22 #include <QObject>
       
    23 
       
    24 class QTimeLine;
       
    25 
       
    26 namespace GVA {
       
    27 class ChromeSnippet;
       
    28 
       
    29 /**
       
    30  * \brief Base class for visibility animation delegates
       
    31  * 
       
    32  * \sa ChromeSnippet::setVisibilityAnimator()
       
    33  */
       
    34 
       
    35 class VisibilityAnimator : public QObject
       
    36 {
       
    37    Q_OBJECT
       
    38 
       
    39  public:
       
    40   VisibilityAnimator(ChromeSnippet* snippet) : m_snippet(snippet), m_timeLine(0), m_visible(true){}
       
    41   virtual ~VisibilityAnimator();
       
    42   static VisibilityAnimator * create(const QString & name, ChromeSnippet* snippet);
       
    43   void setVisible(bool visible, bool animate = true);
       
    44   void setTimeline(QTimeLine * timeline){m_timeLine = timeline;}
       
    45  public slots:
       
    46   virtual void updateVisibility(qreal step) = 0;
       
    47  private slots:
       
    48   void onFinished();
       
    49  signals:
       
    50   void started(bool visible);
       
    51   void finished(bool visible);
       
    52   void moving(qreal delta);
       
    53  protected:
       
    54   ChromeSnippet* m_snippet;
       
    55   QTimeLine *m_timeLine;
       
    56   bool m_visible;
       
    57 };
       
    58 
       
    59 }
       
    60 #endif