Home · All Namespaces · All Classes |
00001 /*************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of mhome. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 #ifndef TRANSFORMLAYOUTANIMATION_H 00020 #define TRANSFORMLAYOUTANIMATION_H 00021 00022 #include <MLayoutAnimation> 00023 #include <QVariantAnimation> 00024 #include "transformlayoutanimationstyle.h" 00025 00026 class QParallelAnimationGroup; 00027 00031 class TransformAnimation : public QVariantAnimation 00032 { 00033 public: 00038 TransformAnimation(QGraphicsWidget *widget); 00039 00041 virtual ~TransformAnimation(); 00042 00044 virtual void updateCurrentValue(const QVariant &value); 00045 virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); 00049 QGraphicsWidget *widget() const; 00050 00052 void setEndValue(const QRectF &rect); 00053 00054 private: 00056 QGraphicsWidget *animatedWidget; 00057 00059 QSizeF invDestSize; 00060 }; 00061 00066 class TransformLayoutAnimation : public MLayoutAnimation 00067 { 00068 M_ANIMATION(TransformLayoutAnimationStyle) 00069 Q_OBJECT 00070 00071 public: 00076 TransformLayoutAnimation(MLayout *layout); 00077 00079 virtual ~TransformLayoutAnimation(); 00080 00082 virtual int duration() const; 00083 virtual void itemAddedToLayout(int index); 00084 virtual void itemRemovedFromLayout(int index); 00085 virtual void animatedDeleteItem(int index); 00086 virtual void setItemGeometry(int index, const QRectF &geometry); 00087 virtual void hideItem(int index); 00093 void setManualControl(bool enabled); 00094 00096 bool manualControl() const; 00097 00099 void cancelAnimation(); 00100 00102 bool isCanceled(); 00103 00106 void setProgress(float t); 00107 00109 float progress() const; 00110 00112 float currentCurveValue() const; 00113 00115 float speed() const; 00116 00117 signals: 00121 void willFinish(); 00122 00123 protected: 00125 virtual void updateCurrentTime(int currentTime); 00126 virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); 00132 virtual TransformAnimation *createAnimation(QGraphicsWidget *widget); 00133 00135 QList<TransformAnimation*> animations; 00136 00138 void resetAnimationAttributes(); 00139 00140 private slots: 00142 void updateContainerPosition(); 00143 00144 private: 00146 QPointF containerSourcePos; 00147 00149 QPointF containerPos; 00150 00152 QGraphicsWidget *container; 00153 00155 QParallelAnimationGroup *animationGroup; 00156 00158 bool manualControlMode; 00159 00161 bool canceled; 00162 00164 bool finishNotified; 00165 00167 float currentProgress; 00168 00170 float lastProgress; 00171 00173 float currentSpeed; 00174 00176 float lastSpeed; 00177 }; 00178 00179 #endif
Copyright © 2011 Nokia Corporation | Generated on Thu Jul 7 2011 22:14:50 Doxygen 1.7.1 |
MeeGo Touch |