1 | /* |
2 | SPDX-FileCopyrightText: 2010 Christoph Cullmann <cullmann@kde.org> |
3 | |
4 | Based on code of the SmartCursor/Range by: |
5 | SPDX-FileCopyrightText: 2003-2005 Hamish Rodda <rodda@kde.org> |
6 | |
7 | SPDX-License-Identifier: LGPL-2.0-or-later |
8 | */ |
9 | |
10 | #ifndef KTEXTEDITOR_MOVINGRANGEFEEDBACK_H |
11 | #define KTEXTEDITOR_MOVINGRANGEFEEDBACK_H |
12 | |
13 | #include <ktexteditor_export.h> |
14 | |
15 | namespace KTextEditor |
16 | { |
17 | class View; |
18 | class MovingRange; |
19 | |
20 | /** |
21 | * \class MovingRangeFeedback movingrangefeedback.h <KTextEditor/MovingRangeFeedback> |
22 | * |
23 | * \short A class which provides notifications of state changes to a MovingRange. |
24 | * |
25 | * \ingroup kte_group_moving_classes |
26 | * |
27 | * This class provides notifications of changes to the position or contents of a MovingRange. |
28 | * |
29 | * Before destruction, you must unregister the feedback class from any range using it. |
30 | * |
31 | * \author Christoph Cullmann \<cullmann@kde.org\> |
32 | * |
33 | * \since 4.5 |
34 | */ |
35 | class KTEXTEDITOR_EXPORT MovingRangeFeedback |
36 | { |
37 | public: |
38 | /** |
39 | * Default constructor |
40 | */ |
41 | MovingRangeFeedback(); |
42 | |
43 | /** |
44 | * Virtual destructor |
45 | */ |
46 | virtual ~MovingRangeFeedback(); |
47 | |
48 | /** |
49 | * The range is now empty (ie. the start and end cursors are the same). |
50 | * If the range has invalidateIfEmpty set, this will never be emitted, but instead rangeInvalid is triggered. |
51 | * You may delete the range inside this method, but don't alter the range here (for example by using setRange). |
52 | * |
53 | * \param range pointer to the range which generated the notification. |
54 | */ |
55 | virtual void rangeEmpty(MovingRange *range); |
56 | |
57 | /** |
58 | * The range is now invalid (ie. the start and end cursors are invalid). |
59 | * You may delete the range inside this method, but don't alter the range here (for example by using setRange). |
60 | * |
61 | * \param range pointer to the range which generated the notification. |
62 | */ |
63 | virtual void rangeInvalid(MovingRange *range); |
64 | |
65 | /** |
66 | * The mouse cursor on \a view entered \p range. |
67 | * |
68 | * \param range pointer to the range which generated the notification. |
69 | * \param view view over which the mouse moved to generate the notification |
70 | */ |
71 | virtual void mouseEnteredRange(MovingRange *range, View *view); |
72 | |
73 | /** |
74 | * The mouse cursor on \a view exited \p range. |
75 | * |
76 | * \param range pointer to the range which generated the notification. |
77 | * \param view view over which the mouse moved to generate the notification |
78 | */ |
79 | virtual void mouseExitedRange(MovingRange *range, View *view); |
80 | |
81 | /** |
82 | * The caret on \a view entered \p range. |
83 | * |
84 | * \param range pointer to the range which generated the notification. |
85 | * \param view view over which the mouse moved to generate the notification |
86 | */ |
87 | virtual void caretEnteredRange(MovingRange *range, View *view); |
88 | |
89 | /** |
90 | * The caret on \a view exited \p range. |
91 | * |
92 | * \param range pointer to the range which generated the notification. |
93 | * \param view view over which the mouse moved to generate the notification |
94 | */ |
95 | virtual void caretExitedRange(MovingRange *range, View *view); |
96 | |
97 | private: |
98 | /** |
99 | * private d-pointer |
100 | */ |
101 | class MovingRangeFeedbackPrivate *const d = nullptr; |
102 | }; |
103 | |
104 | } |
105 | |
106 | #endif |
107 | |