KTextEditor

kateanimation.h
1 /*
2  SPDX-FileCopyrightText: 2013 Dominik Haumann <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KATE_ANIMATION_H
8 #define KATE_ANIMATION_H
9 
10 #include <QObject>
11 #include <QPointer>
12 
13 class QTimer;
14 
15 class KMessageWidget;
16 class KateFadeEffect;
17 /**
18  * This class provides a fade in/out effect for KMessageWidget%s.
19  * Example:
20  * \code
21  * KateAnimation* animation = new KateAnimation(someMessageWidget);
22  * animation->show();
23  * //...
24  * animation->hide();
25  * \endcode
26  */
27 class KateAnimation : public QObject
28 {
29  Q_OBJECT
30 
31 public:
32  /**
33  * The type of supported animation effects
34  */
35  enum EffectType {
36  FadeEffect = 0, ///< fade in/out
37  GrowEffect ///< grow / shrink
38  };
39 
40 public:
41  /**
42  * Constructor.
43  */
44  KateAnimation(KMessageWidget *widget, EffectType effect);
45 
46  /**
47  * Returns true, if the hide animation is running, otherwise false.
48  */
49  bool isHideAnimationRunning() const;
50 
51  /**
52  * Returns true, if the how animation is running, otherwise false.
53  */
54  bool isShowAnimationRunning() const;
55 
56 public Q_SLOTS:
57  /**
58  * Call to hide the widget.
59  */
60  void hide();
61 
62  /**
63  * Call to show and fade in the widget
64  */
65  void show();
66 
67 Q_SIGNALS:
68  /**
69  * This signal is emitted when the hiding animation is finished.
70  * At this point, the associated widget is hidden.
71  */
72  void widgetHidden();
73 
74  /**
75  * This signal is emitted when the showing animation is finished.
76  * At this point, the associated widget is hidden.
77  */
78  void widgetShown();
79 
80 private:
81  QPointer<KMessageWidget> m_widget; ///< the widget to animate
82  KateFadeEffect *m_fadeEffect; ///< the fade effect
83 };
84 
85 #endif
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
KateAnimation(KMessageWidget *widget, EffectType effect)
Constructor.
This class provides a fade in/out effect for KMessageWidgets.
Definition: kateanimation.h:27
void show()
Call to show and fade in the widget.
bool isHideAnimationRunning() const
Returns true, if the hide animation is running, otherwise false.
@ GrowEffect
grow / shrink
Definition: kateanimation.h:37
void hide()
Call to hide the widget.
void widgetShown()
This signal is emitted when the showing animation is finished.
void widgetHidden()
This signal is emitted when the hiding animation is finished.
Q_SIGNALSQ_SIGNALS
EffectType
The type of supported animation effects.
Definition: kateanimation.h:35
This class provides a fade in/out effect for arbitrary QWidgets.
@ FadeEffect
fade in/out
Definition: kateanimation.h:36
bool isShowAnimationRunning() const
Returns true, if the how animation is running, otherwise false.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 15 2022 03:55:01 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.