• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • interfaces
  • ktexteditor
smartcursor.h
Go to the documentation of this file.
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 version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18
19#ifndef KDELIBS_KTEXTEDITOR_SMARTCURSOR_H
20#define KDELIBS_KTEXTEDITOR_SMARTCURSOR_H
21
22#include <ktexteditor/ktexteditor_export.h>
23#include <ktexteditor/cursor.h>
24
25namespace KTextEditor
26{
27class SmartRange;
28
29class SmartCursorWatcher;
30class SmartCursorNotifier;
31
65class KTEXTEDITOR_EXPORT SmartCursor : public Cursor
66{
67 friend class SmartRange;
68
69 public:
76 virtual ~SmartCursor();
77
81 virtual bool isSmartCursor() const;
82
86 virtual SmartCursor* toSmartCursor() const;
87
93 SmartRange* smartRange() const;
94
95 //BEGIN Functionality present from having this cursor associated with a Document
106 Document* document() const;
107
113 virtual bool atEndOfLine() const;
114
120 virtual bool atEndOfDocument() const;
121
126 virtual bool isValid() const;
127
132 QChar character() const;
133
142 virtual bool insertText(const QStringList &text, bool block = false);
143
149 enum AdvanceMode {
151 ByCharacter,
153 ByCursorPosition
154 };
155
175 virtual bool advance(int distance, AdvanceMode mode = ByCharacter);
176 //END
177
178 //BEGIN Behavior methods
187 enum InsertBehavior {
188 StayOnInsert = 0,
189 MoveOnInsert
190 };
195 InsertBehavior insertBehavior() const;
196
202 void setInsertBehavior(InsertBehavior insertBehavior);
203 //END
204
205 //BEGIN Notification methods
220 virtual bool hasNotifier() const = 0;
221
234 virtual SmartCursorNotifier* notifier() = 0;
235
242 virtual void deleteNotifier() = 0;
243
249 virtual SmartCursorWatcher* watcher() const = 0;
250
257 virtual void setWatcher(SmartCursorWatcher* watcher = 0L) = 0;
259 //END
260
274 inline SmartCursor& operator=(const SmartCursor& cursor)
275 { setPosition(cursor); return *this; }
276
277 protected:
291 SmartCursor(const Cursor& position, Document* doc, InsertBehavior insertBehavior);
292
293 private:
298 SmartCursor(const SmartCursor&);
299
305 Document* m_doc;
306
312 bool m_moveOnInsert : 1;
313};
314
315}
316
317#endif
318
319// kate: space-indent on; indent-width 2; replace-tabs on;
KTextEditor::Cursor
An object which represents a position in a Document.
Definition: cursor.h:62
KTextEditor::Document
A KParts derived class representing a text document.
Definition: document.h:112
KTextEditor::SmartCursorNotifier
A class which provides notifications of state changes to a SmartCursor via QObject signals.
Definition: smartcursornotifier.h:47
KTextEditor::SmartCursorWatcher
A class which provides notifications of state changes to a SmartCursor via virtual inheritance.
Definition: smartcursorwatcher.h:48
KTextEditor::SmartCursor
A Cursor which is bound to a specific Document, and maintains its position.
Definition: smartcursor.h:66
KTextEditor::SmartCursor::setWatcher
virtual void setWatcher(SmartCursorWatcher *watcher=0L)=0
Provide a SmartCursorWatcher to receive calls indicating change of state of this cursor.
KTextEditor::SmartCursor::InsertBehavior
InsertBehavior
Definition: smartcursor.h:187
KTextEditor::SmartCursor::watcher
virtual SmartCursorWatcher * watcher() const =0
Returns a pointer to the current SmartCursorWatcher, if one has been set.
KTextEditor::SmartCursor::deleteNotifier
virtual void deleteNotifier()=0
Deletes the current SmartCursorNotifier.
KTextEditor::SmartCursor::operator=
SmartCursor & operator=(const SmartCursor &cursor)
Assignment operator.
Definition: smartcursor.h:274
KTextEditor::SmartCursor::notifier
virtual SmartCursorNotifier * notifier()=0
Returns the current SmartCursorNotifier.
KTextEditor::SmartCursor::hasNotifier
virtual bool hasNotifier() const =0
Determine if a notifier already exists for this smart cursor.
KTextEditor::SmartCursor::AdvanceMode
AdvanceMode
Defines the ways in which the cursor can be advanced.
Definition: smartcursor.h:149
KTextEditor::SmartCursor::ByCharacter
@ ByCharacter
Movement is calculated on the basis of absolute numbers of characters.
Definition: smartcursor.h:151
KTextEditor::SmartRange
A Range which is bound to a specific Document, and maintains its position.
Definition: smartrange.h:95
cursor.h
ktexteditor_export.h
KTextEditor
Namespace for the KDE Text Editor Interfaces.
Definition: annotationinterface.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal