File indexing completed on 2024-05-12 15:45:41

0001 /*
0002     SPDX-FileCopyrightText: 2010 Christoph Cullmann <cullmann@kde.org>
0003 
0004     Based on code of the SmartCursor/Range by:
0005     SPDX-FileCopyrightText: 2003-2005 Hamish Rodda <rodda@kde.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #ifndef KTEXTEDITOR_MOVINGRANGEFEEDBACK_H
0011 #define KTEXTEDITOR_MOVINGRANGEFEEDBACK_H
0012 
0013 #include <ktexteditor_export.h>
0014 
0015 namespace KTextEditor
0016 {
0017 class View;
0018 class MovingRange;
0019 
0020 /**
0021  * \class MovingRangeFeedback movingrangefeedback.h <KTextEditor/MovingRangeFeedback>
0022  *
0023  * \short A class which provides notifications of state changes to a MovingRange.
0024  *
0025  * \ingroup kte_group_moving_classes
0026  *
0027  * This class provides notifications of changes to the position or contents of a MovingRange.
0028  *
0029  * Before destruction, you must unregister the feedback class from any range using it.
0030  *
0031  * \author Christoph Cullmann \<cullmann@kde.org\>
0032  *
0033  * \since 4.5
0034  */
0035 class KTEXTEDITOR_EXPORT MovingRangeFeedback
0036 {
0037 public:
0038     /**
0039      * Default constructor
0040      */
0041     MovingRangeFeedback();
0042 
0043     /**
0044      * Virtual destructor
0045      */
0046     virtual ~MovingRangeFeedback();
0047 
0048     /**
0049      * The range is now empty (ie. the start and end cursors are the same).
0050      * If the range has invalidateIfEmpty set, this will never be emitted, but instead rangeInvalid is triggered.
0051      * You may delete the range inside this method, but don't alter the range here (for example by using setRange).
0052      *
0053      * \param range pointer to the range which generated the notification.
0054      */
0055     virtual void rangeEmpty(MovingRange *range);
0056 
0057     /**
0058      * The range is now invalid (ie. the start and end cursors are invalid).
0059      * You may delete the range inside this method, but don't alter the range here (for example by using setRange).
0060      *
0061      * \param range pointer to the range which generated the notification.
0062      */
0063     virtual void rangeInvalid(MovingRange *range);
0064 
0065     /**
0066      * The mouse cursor on \a view entered \p range.
0067      *
0068      * \param range pointer to the range which generated the notification.
0069      * \param view view over which the mouse moved to generate the notification
0070      */
0071     virtual void mouseEnteredRange(MovingRange *range, View *view);
0072 
0073     /**
0074      * The mouse cursor on \a view exited \p range.
0075      *
0076      * \param range pointer to the range which generated the notification.
0077      * \param view view over which the mouse moved to generate the notification
0078      */
0079     virtual void mouseExitedRange(MovingRange *range, View *view);
0080 
0081     /**
0082      * The caret on \a view entered \p range.
0083      *
0084      * \param range pointer to the range which generated the notification.
0085      * \param view view over which the mouse moved to generate the notification
0086      */
0087     virtual void caretEnteredRange(MovingRange *range, View *view);
0088 
0089     /**
0090      * The caret on \a view exited \p range.
0091      *
0092      * \param range pointer to the range which generated the notification.
0093      * \param view view over which the mouse moved to generate the notification
0094      */
0095     virtual void caretExitedRange(MovingRange *range, View *view);
0096 
0097 private:
0098     /**
0099      * private d-pointer
0100      */
0101     class MovingRangeFeedbackPrivate *const d = nullptr;
0102 };
0103 
0104 }
0105 
0106 #endif