• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • kde-4.14
  • applications
  • kate
  • 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 
25 namespace KTextEditor
26 {
27 class SmartRange;
28 
29 class SmartCursorWatcher;
30 class SmartCursorNotifier;
31 
65 class 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::SmartCursor::operator=
SmartCursor & operator=(const SmartCursor &cursor)
Assignment operator.
Definition: smartcursor.h:274
KTextEditor::SmartCursor::InsertBehavior
InsertBehavior
Definition: smartcursor.h:187
QChar
cursor.h
KTextEditor::SmartRange
A Range which is bound to a specific Document, and maintains its position.
Definition: smartrange.h:94
KTextEditor::SmartCursorNotifier
A class which provides notifications of state changes to a SmartCursor via QObject signals...
Definition: smartcursornotifier.h:46
KTextEditor::Cursor
An object which represents a position in a Document.
Definition: cursor.h:55
ktexteditor_export.h
KTextEditor::Document
A KParts derived class representing a text document.
Definition: document.h:111
KTextEditor::SmartCursor
A Cursor which is bound to a specific Document, and maintains its position.
Definition: smartcursor.h:65
KTEXTEDITOR_EXPORT
#define KTEXTEDITOR_EXPORT
Definition: ktexteditor_export.h:35
KTextEditor::SmartCursor::AdvanceMode
AdvanceMode
Defines the ways in which the cursor can be advanced.
Definition: smartcursor.h:149
QStringList
KTextEditor::SmartCursor::ByCharacter
Movement is calculated on the basis of absolute numbers of characters.
Definition: smartcursor.h:151
KTextEditor::SmartCursorWatcher
A class which provides notifications of state changes to a SmartCursor via virtual inheritance...
Definition: smartcursorwatcher.h:47
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:48 by doxygen 1.8.7 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

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



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