• Skip to content
  • Skip to link menu
KDE 4.2 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 #include "kateedit.h"
00027 
00028 class KateDocument;
00029 class KateSmartGroup;
00030 class KateSmartCursorNotifier;
00031 namespace KTextEditor { class Document; }
00032 
00048 class KateSmartCursor : public KTextEditor::SmartCursor
00049 {
00050   friend class KateSmartRange;
00051 
00052   public:
00053     KateSmartCursor(const KTextEditor::Cursor& position, KTextEditor::Document* doc, KTextEditor::SmartCursor::InsertBehavior insertBehavior = KTextEditor::SmartCursor::MoveOnInsert);
00055     explicit KateSmartCursor(KTextEditor::Document* doc, KTextEditor::SmartCursor::InsertBehavior insertBehavior = KTextEditor::SmartCursor::MoveOnInsert);
00056     virtual ~KateSmartCursor();
00057 
00058     void unbindFromRange();
00059 
00060     bool isInternal() const { return m_isInternal; }
00061     void setInternal();
00062 
00066     operator QString();
00067 
00068     KateDocument* kateDocument() const;
00069     inline KateSmartCursor& operator= (const KTextEditor::Cursor& rhs) { setPosition(rhs); return *this; }
00070 
00071     // Reimplementations;
00072     virtual int line() const;
00073     virtual void setLine(int line);
00074     virtual void setPosition(const KTextEditor::Cursor& pos);
00075 
00076     virtual bool isValid() const;
00077     virtual bool isValid(const Cursor& position) const;
00078     virtual bool atEndOfLine() const;
00079 
00080     virtual bool hasNotifier() const;
00081     virtual KTextEditor::SmartCursorNotifier* notifier();
00082     virtual void deleteNotifier();
00083     virtual KTextEditor::SmartCursorWatcher* watcher() const;
00084     virtual void setWatcher(KTextEditor::SmartCursorWatcher* watcher = 0L);
00085 
00086     inline bool feedbackEnabled() const { return m_feedbackEnabled; }
00087 
00088     inline KateSmartGroup* smartGroup() const { return m_smartGroup; }
00089     void migrate(KateSmartGroup* newGroup);
00090 
00091     bool translate(const KateEditInfo& edit);
00092 
00097     bool cursorMoved() const;
00098 
00104     void translated(const KateEditInfo & edit);
00105 
00106     // Called when the cursor's position has changed only (character changes not possible)
00107     void shifted();
00108 
00109     // Used by KateSmartRange once it has finished its feedback.
00110     const KTextEditor::Cursor& lastPosition() const { return m_lastPosition; }
00111     void resetLastPosition();
00112 
00113   protected:
00114     void setLineInternal(int newLine, bool internal = true);
00115 
00116     // Where internal == true, don't constrain parent or child ranges.
00117     void setPositionInternal(const KTextEditor::Cursor& pos, bool internal = true);
00118     virtual void checkFeedback();
00119 
00120   private:
00121     KateSmartGroup* m_smartGroup;
00122     mutable int m_oldGroupLineStart;
00123 
00129     Cursor m_lastPosition;
00130 
00131     bool m_feedbackEnabled     :1;
00132     bool  m_isInternal         :1;
00133     bool  m_lastPositionNeeded :1;
00134 
00135     // Hack for corner case as documented in translate()
00136     const void*  m_bypassTranslation;
00137 
00138     KateSmartCursorNotifier* m_notifier;
00139     KTextEditor::SmartCursorWatcher* m_watcher;
00140 };
00141 
00142 #endif
00143 
00144 // 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
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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