• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Kate

katesmartcursor.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2003,2004,2005 Hamish Rodda <rodda@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #ifndef KATESMARTCURSOR_H
00020 #define KATESMARTCURSOR_H
00021 
00022 #include <ktexteditor/smartcursor.h>
00023 
00024 #include <QtCore/QObject>
00025 
00026 class KateDocument;
00027 class KateEditInfo;
00028 class KateSmartGroup;
00029 class KateSmartCursorNotifier;
00030 namespace KTextEditor { class Document; }
00031 
00047 class KateSmartCursor : public KTextEditor::SmartCursor
00048 {
00049   friend class KateSmartRange;
00050 
00051   public:
00052     KateSmartCursor(const KTextEditor::Cursor& position, KTextEditor::Document* doc, KTextEditor::SmartCursor::InsertBehavior insertBehavior = KTextEditor::SmartCursor::MoveOnInsert);
00054     explicit KateSmartCursor(KTextEditor::Document* doc, KTextEditor::SmartCursor::InsertBehavior insertBehavior = KTextEditor::SmartCursor::MoveOnInsert);
00055     virtual ~KateSmartCursor();
00056 
00057     void unbindFromRange();
00058 
00059     bool isInternal() const { return m_isInternal; }
00060     void setInternal();
00061 
00065     operator QString();
00066 
00067     KateDocument* kateDocument() const;
00068     inline KateSmartCursor& operator= (const KTextEditor::Cursor& rhs) { setPosition(rhs); return *this; }
00069 
00070     // Reimplementations;
00071     virtual int line() const;
00072     virtual void setLine(int line);
00073     virtual void setPosition(const KTextEditor::Cursor& pos);
00074 
00075     virtual bool isValid() const;
00076     virtual bool isValid(const Cursor& position) const;
00077     virtual bool atEndOfLine() const;
00078 
00079     virtual bool hasNotifier() const;
00080     virtual KTextEditor::SmartCursorNotifier* notifier();
00081     virtual void deleteNotifier();
00082     virtual KTextEditor::SmartCursorWatcher* watcher() const;
00083     virtual void setWatcher(KTextEditor::SmartCursorWatcher* watcher = 0L);
00084 
00085     inline bool feedbackEnabled() const { return m_feedbackEnabled; }
00086 
00087     inline KateSmartGroup* smartGroup() const { return m_smartGroup; }
00088     void migrate(KateSmartGroup* newGroup);
00089 
00090     bool translate(const KateEditInfo& edit);
00091 
00096     bool cursorMoved() const;
00097 
00103     void translated(const KateEditInfo & edit);
00104 
00105     // Called when the cursor's position has changed only (character changes not possible)
00106     void shifted();
00107 
00108     // Used by KateSmartRange once it has finished its feedback.
00109     const KTextEditor::Cursor& lastPosition() const { return m_lastPosition; }
00110     void resetLastPosition();
00111 
00112   protected:
00113     void setLineInternal(int newLine, bool internal = true);
00114 
00115     // Where internal == true, don't constrain parent or child ranges.
00116     void setPositionInternal(const KTextEditor::Cursor& pos, bool internal = true);
00117     virtual void checkFeedback();
00118 
00119   private:
00120     KateSmartGroup* m_smartGroup;
00121     mutable int m_oldGroupLineStart;
00122 
00128     Cursor m_lastPosition;
00129 
00130     bool m_feedbackEnabled     :1;
00131     bool  m_isInternal         :1;
00132     bool  m_lastPositionNeeded :1;
00133 
00134     // Hack for corner case as documented in translate()
00135     const void*  m_bypassTranslation;
00136 
00137     KateSmartCursorNotifier* m_notifier;
00138     KTextEditor::SmartCursorWatcher* m_watcher;
00139 };
00140 
00141 #endif
00142 
00143 // kate: space-indent on; indent-width 2; replace-tabs on;

Kate

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal