~ubuntu-branches/ubuntu/vivid/kate/vivid-updates

« back to all changes in this revision

Viewing changes to ktexteditor/smartcursornotifier.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of the KDE project
2
 
   Copyright (C) 2003-2005 Hamish Rodda <rodda@kde.org>
3
 
 
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.
8
 
 
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.
13
 
 
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.
18
 
*/
19
 
 
20
 
#ifndef KDELIBS_KTEXTEDITOR_SMARTCURSORNOTIFIER_H
21
 
#define KDELIBS_KTEXTEDITOR_SMARTCURSORNOTIFIER_H
22
 
 
23
 
#include <ktexteditor/ktexteditor_export.h>
24
 
#include <QtCore/QObject>
25
 
#include <kdebug.h>
26
 
 
27
 
namespace KTextEditor
28
 
{
29
 
class SmartCursor;
30
 
 
31
 
/**
32
 
 * \short A class which provides notifications of state changes to a SmartCursor via QObject signals.
33
 
 *
34
 
 * \ingroup kte_group_smart_classes
35
 
 *
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.
39
 
 *
40
 
 * If you prefer to receive notifications via virtual inheritance, see SmartCursorWatcher.
41
 
 *
42
 
 * \sa SmartCursor, SmartCursorNotifier
43
 
 *
44
 
 * \author Hamish Rodda \<rodda@kde.org\>
45
 
 */
46
 
class KTEXTEDITOR_EXPORT SmartCursorNotifier : public QObject
47
 
{
48
 
  Q_OBJECT
49
 
 
50
 
  public:
51
 
    /**
52
 
     * Default constructor.
53
 
     */
54
 
    SmartCursorNotifier();
55
 
 
56
 
    /**
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.
60
 
     */
61
 
    bool wantsDirectChanges() const;
62
 
 
63
 
    /**
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.
67
 
     *
68
 
     * \param wantsDirectChanges whether this notifier should provide notifications for direct changes.
69
 
     */
70
 
    void setWantsDirectChanges(bool wantsDirectChanges);
71
 
 
72
 
  Q_SIGNALS:
73
 
    /**
74
 
     * The cursor's position was changed.
75
 
     *
76
 
     * \param cursor pointer to the cursor which generated the notification.
77
 
     */
78
 
    void positionChanged(KTextEditor::SmartCursor* cursor);
79
 
 
80
 
    /**
81
 
     * The cursor's surrounding characters were both deleted simultaneously.
82
 
     * The cursor is automatically placed at the start of the deleted region.
83
 
     *
84
 
     * \param cursor pointer to the cursor which generated the notification.
85
 
     */
86
 
    void positionDeleted(KTextEditor::SmartCursor* cursor);
87
 
 
88
 
    /**
89
 
     * One character immediately surrounding the cursor was deleted.
90
 
     * If both characters are simultaneously deleted, positionDeleted() is called instead.
91
 
     *
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.
95
 
     */
96
 
    void characterDeleted(KTextEditor::SmartCursor* cursor, bool deletedBefore);
97
 
 
98
 
    /**
99
 
     * A character was inserted immediately before or after the cursor, as given
100
 
     * by \p insertedBefore.
101
 
     *
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
105
 
     */
106
 
    void characterInserted(KTextEditor::SmartCursor* cursor, bool insertedBefore);
107
 
 
108
 
    /**
109
 
     * The SmartCursor instance specified by \p cursor is being deleted.
110
 
     *
111
 
     * \param cursor pointer to the cursor which is about to be deleted.  It is
112
 
     *               still safe to access information at this point.
113
 
     */
114
 
    void deleted(KTextEditor::SmartCursor* cursor);
115
 
 
116
 
  private:
117
 
    bool m_wantDirectChanges;
118
 
};
119
 
 
120
 
}
121
 
 
122
 
#endif
123
 
 
124
 
// kate: space-indent on; indent-width 2; replace-tabs on;