1
/* This file is part of the KDE project
2
Copyright (C) 2003-2005 Hamish Rodda <rodda@kde.org>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301, USA.
20
#ifndef KDELIBS_KTEXTEDITOR_SMARTCURSORNOTIFIER_H
21
#define KDELIBS_KTEXTEDITOR_SMARTCURSORNOTIFIER_H
23
#include <ktexteditor/ktexteditor_export.h>
24
#include <QtCore/QObject>
32
* \short A class which provides notifications of state changes to a SmartCursor via QObject signals.
34
* \ingroup kte_group_smart_classes
36
* This class provides notifications of changes to a SmartCursor such as the
37
* position in the document, and deletion or insertion of text immediately
38
* before or after the cursor.
40
* If you prefer to receive notifications via virtual inheritance, see SmartCursorWatcher.
42
* \sa SmartCursor, SmartCursorNotifier
44
* \author Hamish Rodda \<rodda@kde.org\>
46
class KTEXTEDITOR_EXPORT SmartCursorNotifier : public QObject
52
* Default constructor.
54
SmartCursorNotifier();
57
* Returns whether this notifier will notify of changes that happen
58
* directly to the cursor, e.g. by calls to SmartCursor::setPosition(), rather
59
* than just when surrounding text changes.
61
bool wantsDirectChanges() const;
64
* Set whether this notifier should notify of changes that happen
65
* directly to the cursor, e.g. by calls to SmartCursor::setPosition(), rather
66
* than just when surrounding text changes.
68
* \param wantsDirectChanges whether this notifier should provide notifications for direct changes.
70
void setWantsDirectChanges(bool wantsDirectChanges);
74
* The cursor's position was changed.
76
* \param cursor pointer to the cursor which generated the notification.
78
void positionChanged(KTextEditor::SmartCursor* cursor);
81
* The cursor's surrounding characters were both deleted simultaneously.
82
* The cursor is automatically placed at the start of the deleted region.
84
* \param cursor pointer to the cursor which generated the notification.
86
void positionDeleted(KTextEditor::SmartCursor* cursor);
89
* One character immediately surrounding the cursor was deleted.
90
* If both characters are simultaneously deleted, positionDeleted() is called instead.
92
* \param cursor pointer to the cursor which generated the notification.
93
* \param deletedBefore \c true if the character immediately before was deleted,
94
* \c false if the character immediately after was deleted.
96
void characterDeleted(KTextEditor::SmartCursor* cursor, bool deletedBefore);
99
* A character was inserted immediately before or after the cursor, as given
100
* by \p insertedBefore.
102
* \param cursor pointer to the cursor which generated the notification.
103
* \param insertedBefore \e true if a character was inserted before \p cursor,
104
* \e false if a character was inserted after
106
void characterInserted(KTextEditor::SmartCursor* cursor, bool insertedBefore);
109
* The SmartCursor instance specified by \p cursor is being deleted.
111
* \param cursor pointer to the cursor which is about to be deleted. It is
112
* still safe to access information at this point.
114
void deleted(KTextEditor::SmartCursor* cursor);
117
bool m_wantDirectChanges;
124
// kate: space-indent on; indent-width 2; replace-tabs on;