File indexing completed on 2024-03-24 04:00:40
0001 /* 0002 SPDX-FileCopyrightText: 2013 Dominik Haumann <dhaumann@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KATE_ANIMATION_H 0008 #define KATE_ANIMATION_H 0009 0010 #include <QObject> 0011 #include <QPointer> 0012 0013 class QTimer; 0014 0015 class KMessageWidget; 0016 class KateFadeEffect; 0017 /** 0018 * This class provides a fade in/out effect for KMessageWidget%s. 0019 * Example: 0020 * \code 0021 * KateAnimation* animation = new KateAnimation(someMessageWidget); 0022 * animation->show(); 0023 * //... 0024 * animation->hide(); 0025 * \endcode 0026 */ 0027 class KateAnimation : public QObject 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 /** 0033 * The type of supported animation effects 0034 */ 0035 enum EffectType { 0036 FadeEffect = 0, ///< fade in/out 0037 GrowEffect ///< grow / shrink 0038 }; 0039 0040 public: 0041 /** 0042 * Constructor. 0043 */ 0044 KateAnimation(KMessageWidget *widget, EffectType effect); 0045 0046 /** 0047 * Returns true, if the hide animation is running, otherwise false. 0048 */ 0049 bool isHideAnimationRunning() const; 0050 0051 /** 0052 * Returns true, if the how animation is running, otherwise false. 0053 */ 0054 bool isShowAnimationRunning() const; 0055 0056 public Q_SLOTS: 0057 /** 0058 * Call to hide the widget. 0059 */ 0060 void hide(); 0061 0062 /** 0063 * Call to show and fade in the widget 0064 */ 0065 void show(); 0066 0067 Q_SIGNALS: 0068 /** 0069 * This signal is emitted when the hiding animation is finished. 0070 * At this point, the associated widget is hidden. 0071 */ 0072 void widgetHidden(); 0073 0074 /** 0075 * This signal is emitted when the showing animation is finished. 0076 * At this point, the associated widget is hidden. 0077 */ 0078 void widgetShown(); 0079 0080 private: 0081 QPointer<KMessageWidget> m_widget; ///< the widget to animate 0082 KateFadeEffect *m_fadeEffect; ///< the fade effect 0083 }; 0084 0085 #endif