1/* This file is part of the KDE project
2 *
3 * Copyright (C) 2010 Christoph Cullmann <cullmann@kde.org>
4 *
5 * Based on code of the SmartCursor/Range by:
6 * Copyright (C) 2003-2005 Hamish Rodda <rodda@kde.org>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
24#ifndef KTEXTEDITOR_MOVINGRANGEFEEDBACK_H
25#define KTEXTEDITOR_MOVINGRANGEFEEDBACK_H
26
27#include <ktexteditor_export.h>
28
29namespace KTextEditor
30{
31
32class View;
33class MovingRange;
34
35/**
36 * \short A class which provides notifications of state changes to a MovingRange.
37 *
38 * \ingroup kte_group_moving_classes
39 *
40 * This class provides notifications of changes to the position or contents of a MovingRange.
41 *
42 * Before destruction, you must unregister the feedback class from any range using it.
43 *
44 * \author Christoph Cullmann \<cullmann@kde.org\>
45 *
46 * \since 4.5
47 */
48class KTEXTEDITOR_EXPORT MovingRangeFeedback
49{
50public:
51 /**
52 * Default constructor
53 */
54 MovingRangeFeedback();
55
56 /**
57 * Virtual destructor
58 */
59 virtual ~MovingRangeFeedback();
60
61 /**
62 * The range is now empty (ie. the start and end cursors are the same).
63 * If the range has invalidateIfEmpty set, this will never be emitted, but instead rangeInvalid is triggered.
64 * You may delete the range inside this method, but don't alter the range here (for example by using setRange).
65 *
66 * \param range pointer to the range which generated the notification.
67 */
68 virtual void rangeEmpty(MovingRange *range);
69
70 /**
71 * The range is now invalid (ie. the start and end cursors are invalid).
72 * You may delete the range inside this method, but don't alter the range here (for example by using setRange).
73 *
74 * \param range pointer to the range which generated the notification.
75 */
76 virtual void rangeInvalid(MovingRange *range);
77
78 /**
79 * The mouse cursor on \a view entered \p range.
80 *
81 * \param range pointer to the range which generated the notification.
82 * \param view view over which the mouse moved to generate the notification
83 */
84 virtual void mouseEnteredRange(MovingRange *range, View *view);
85
86 /**
87 * The mouse cursor on \a view exited \p range.
88 *
89 * \param range pointer to the range which generated the notification.
90 * \param view view over which the mouse moved to generate the notification
91 */
92 virtual void mouseExitedRange(MovingRange *range, View *view);
93
94 /**
95 * The caret on \a view entered \p range.
96 *
97 * \param range pointer to the range which generated the notification.
98 * \param view view over which the mouse moved to generate the notification
99 */
100 virtual void caretEnteredRange(MovingRange *range, View *view);
101
102 /**
103 * The caret on \a view exited \p range.
104 *
105 * \param range pointer to the range which generated the notification.
106 * \param view view over which the mouse moved to generate the notification
107 */
108 virtual void caretExitedRange(MovingRange *range, View *view);
109
110private:
111 /**
112 * private d-pointer
113 */
114 class MovingRangeFeedbackPrivate *const d = nullptr;
115};
116
117}
118
119#endif
120
121