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 |
|
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 * |
4 * |
9 * Initial Contributors: |
5 * This program is free software: you can redistribute it and/or modify |
10 * Nokia Corporation - initial contribution. |
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
11 * |
8 * |
12 * Contributors: |
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
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 __GINEBRA_VISIBILITYANIMATOR_H__ |
22 #ifndef __GINEBRA_VISIBILITYANIMATOR_H__ |
20 #define __GINEBRA_VISIBILITYANIMATOR_H__ |
23 #define __GINEBRA_VISIBILITYANIMATOR_H__ |
21 |
24 |
22 #include <QObject> |
25 #include <QObject> |
24 class QTimeLine; |
27 class QTimeLine; |
25 |
28 |
26 namespace GVA { |
29 namespace GVA { |
27 class ChromeSnippet; |
30 class ChromeSnippet; |
28 |
31 |
29 /** |
32 /*! \ingroup JavascriptAPI |
30 * \brief Base class for visibility animation delegates |
33 * \brief Base class for visibility animation delegates |
31 * |
34 * |
|
35 * Example javascript code to set a fade animation with the default 500ms duration on a snippet. |
|
36 * This will cause the snippet to fade-in when it is shown and fade-out when it is hidden. |
|
37 * \code |
|
38 * snippets.SnippetId.setVisibilityAnimator("G_VISIBILITY_FADE_ANIMATOR"); |
|
39 * \endcode |
|
40 * Example javascript code to set a fade animation with a 200ms duration on a snippet. |
|
41 * \code |
|
42 * snippets.SnippetId.setVisibilityAnimator("G_VISIBILITY_FADE_ANIMATOR").duration = 200; |
|
43 * \endcode |
32 * \sa ChromeSnippet::setVisibilityAnimator() |
44 * \sa ChromeSnippet::setVisibilityAnimator() |
33 */ |
45 */ |
34 |
46 |
35 class VisibilityAnimator : public QObject |
47 class VisibilityAnimator : public QObject |
36 { |
48 { |
37 Q_OBJECT |
49 Q_OBJECT |
38 |
50 |
39 public: |
51 public: |
40 VisibilityAnimator(ChromeSnippet* snippet) : m_snippet(snippet), m_timeLine(0), m_visible(true){} |
52 VisibilityAnimator(ChromeSnippet* snippet) : m_snippet(snippet), m_timeLine(0), m_visible(true), m_duration(500){} |
41 virtual ~VisibilityAnimator(); |
53 virtual ~VisibilityAnimator(); |
42 static VisibilityAnimator * create(const QString & name, ChromeSnippet* snippet); |
54 static VisibilityAnimator * create(const QString & name, ChromeSnippet* snippet); |
43 void setVisible(bool visible, bool animate = true); |
55 void setVisible(bool visible, bool animate = true); |
44 void setTimeline(QTimeLine * timeline){m_timeLine = timeline;} |
56 void setTimeline(QTimeLine * timeline){m_timeLine = timeline;} |
|
57 void setDuration(uint value) { m_duration = value; } |
|
58 uint duration() const { return m_duration; } |
|
59 Q_PROPERTY(uint duration READ duration WRITE setDuration) |
45 public slots: |
60 public slots: |
46 virtual void updateVisibility(qreal step) = 0; |
61 virtual void updateVisibility(qreal step) = 0; |
47 private slots: |
62 private slots: |
48 void onFinished(); |
63 void onFinished(); |
49 signals: |
64 signals: |