1/*
2 SPDX-FileCopyrightText: 2013-2018 Dominik Haumann <dhaumann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KATE_TEXT_ANIMATION_H
8#define KATE_TEXT_ANIMATION_H
9
10#include <QObject>
11#include <QRectF>
12#include <QString>
13
14#include <ktexteditor/attribute.h>
15#include <ktexteditor/range.h>
16
17namespace KTextEditor
18{
19class DocumentPrivate;
20}
21class KateViewInternal;
22class QTimeLine;
23class QPainter;
24
25/**
26 * This class is used to flash text in the text view.
27 * The duration of the flash animation is about 250 milliseconds.
28 * When the animation is finished, it deletes itself.
29 */
30class KateTextAnimation : public QObject
31{
32public:
33 KateTextAnimation(KTextEditor::Range range, KTextEditor::Attribute::Ptr attribute, KateViewInternal *view);
34 ~KateTextAnimation() override;
35
36 // draw the text to highlight, given the current animation progress
37 void draw(QPainter &painter);
38
39public:
40 // request repaint from view of the respective region
41 void nextFrame(qreal value);
42
43private:
44 // calculate rect for the text to highlight, given the current animation progress
45 QRectF rectForText();
46
47private:
48 KTextEditor::Range m_range;
49 QString m_text;
50 KTextEditor::Attribute::Ptr m_attribute;
51
52 KTextEditor::DocumentPrivate *m_doc;
53 KateViewInternal *m_view;
54 QTimeLine *m_timeLine;
55 qreal m_value;
56};
57
58#endif // KATE_TEXT_ANIMATION_H
59

source code of ktexteditor/src/view/katetextanimation.h