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

Kate

katesupercursor.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2003 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 KATESUPERCURSOR_H
00020 #define KATESUPERCURSOR_H
00021 
00022 #include "katecursor.h"
00023 
00024 class KateDocument;
00025 class KateView;
00026 
00045 class KateSuperCursor : public QObject, public KateDocCursor, public Kate::Cursor
00046 {
00047   Q_OBJECT
00048 
00049 public:
00055     KateSuperCursor(KateDocument* doc, bool privateC, const KateTextCursor& cursor, QObject* parent = 0L, const char* name = 0L);
00056     KateSuperCursor(KateDocument* doc, bool privateC, int lineNum = 0, int col = 0, QObject* parent = 0L, const char* name = 0L);
00057 
00058     ~KateSuperCursor ();
00059 
00060   public:
00061     // KTextEditor::Cursor interface
00062     void position(uint *line, uint *col) const;
00063     bool setPosition(uint line, uint col);
00064     bool insertText(const QString& text);
00065     bool removeText(uint numberOfCharacters);
00066     QChar currentChar() const;
00067 
00071     bool atStartOfLine() const;
00072 
00076     bool atEndOfLine() const;
00077 
00082     bool moveOnInsert() const;
00083 
00089     void setMoveOnInsert(bool moveOnInsert);
00090 
00094     operator QString();
00095 
00096     // Reimplementations;
00097     virtual void setLine(int lineNum);
00098     virtual void setCol(int colNum);
00099     virtual void setPos(const KateTextCursor& pos);
00100     virtual void setPos(int lineNum, int colNum);
00101 
00102   signals:
00106     void positionDirectlyChanged();
00107 
00111     void positionChanged();
00112 
00116     void positionUnChanged();
00117 
00122     void positionDeleted();
00123 
00132     void charInsertedAt();
00133 
00137     void charDeletedBefore();
00138 
00142     void charDeletedAfter();
00143 
00144   //BEGIN METHODES TO CALL FROM KATE DOCUMENT TO KEEP CURSOR UP TO DATE
00145   public:
00146     void editTextInserted ( uint line, uint col, uint len);
00147     void editTextRemoved ( uint line, uint col, uint len);
00148 
00149     void editLineWrapped ( uint line, uint col, bool newLine = true );
00150     void editLineUnWrapped ( uint line, uint col, bool removeLine = true, uint length = 0 );
00151 
00152     void editLineInserted ( uint line );
00153     void editLineRemoved ( uint line );
00154   //END
00155 
00156   private:
00157     KateDocument *m_doc;
00158     bool m_moveOnInsert : 1;
00159     bool m_lineRemoved : 1;
00160     bool m_privateCursor : 1;
00161 };
00162 
00168 class KateSuperRange : public QObject, public KateRange
00169 {
00170               friend class KateSuperRangeList;
00171 
00172   Q_OBJECT
00173 
00174 public:
00176   enum InsertBehaviour {
00178     DoNotExpand = 0,
00180     ExpandLeft = 0x1,
00182     ExpandRight = 0x2
00183   };
00184 
00188   KateSuperRange(KateSuperCursor* start, KateSuperCursor* end, QObject* parent = 0L, const char* name = 0L);
00189   KateSuperRange(KateDocument* doc, const KateRange& range, QObject* parent = 0L, const char* name = 0L);
00190   KateSuperRange(KateDocument* doc, const KateTextCursor& start, const KateTextCursor& end, QObject* parent = 0L, const char* name = 0L);
00191 
00192   virtual ~KateSuperRange();
00193 
00194   // fulfill KateRange requirements
00195   virtual KateTextCursor& start();
00196   virtual KateTextCursor& end();
00197   virtual const KateTextCursor& start() const;
00198   virtual const KateTextCursor& end() const;
00199 
00200   void allowZeroLength(bool yes=true){m_allowZeroLength=yes;}
00204   KateSuperCursor& superStart();
00205   const KateSuperCursor& superStart() const;
00206 
00210   KateSuperCursor& superEnd();
00211   const KateSuperCursor& superEnd() const;
00212 
00216   int behaviour() const;
00217 
00226   void setBehaviour(int behaviour);
00227 
00231   virtual bool isValid() const;
00232 
00244   bool owns(const KateTextCursor& cursor) const;
00245 
00250   bool includes(const KateTextCursor& cursor) const;
00251 
00255   bool includes(uint lineNum) const;
00256 
00260   bool includesWholeLine(uint lineNum) const;
00261 
00265   bool boundaryAt(const KateTextCursor& cursor) const;
00266 
00270   bool boundaryOn(uint lineNum) const;
00271 
00272 signals:
00282   void positionChanged();
00283 
00287   void positionUnChanged();
00288 
00292   void contentsChanged();
00293 
00297   void boundaryDeleted();
00298 
00305   void eliminated();
00306 
00310   void tagRange(KateSuperRange* range);
00311 
00312 public slots:
00313   void slotTagRange();
00314 
00315 private slots:
00316   void slotEvaluateChanged();
00317   void slotEvaluateUnChanged();
00318 
00319 private:
00320   void init();
00321   void evaluateEliminated();
00322   void evaluatePositionChanged();
00323 
00324   KateSuperCursor* m_start;
00325   KateSuperCursor* m_end;
00326   bool m_evaluate;
00327   bool m_startChanged;
00328   bool m_endChanged;
00329   bool m_deleteCursors;
00330   bool m_allowZeroLength;
00331 };
00332 
00333 class KateSuperCursorList : public QPtrList<KateSuperCursor>
00334 {
00335 protected:
00336   virtual int compareItems(QPtrCollection::Item item1, QPtrCollection::Item item2);
00337 };
00338 
00339 class KateSuperRangeList : public QObject, public QPtrList<KateSuperRange>
00340 {
00341   Q_OBJECT
00342 
00343 public:
00347   KateSuperRangeList(bool autoManage = true, QObject* parent = 0L, const char* name = 0L);
00348 
00358   KateSuperRangeList(const QPtrList<KateSuperRange>& rangeList, QObject* parent = 0L, const char* name = 0L);
00359 
00360   virtual ~KateSuperRangeList() {}
00366   void appendList(const QPtrList<KateSuperRange>& rangeList);
00367 
00372   void connectAll();
00373 
00377   virtual void clear();
00378 
00383   bool autoManage() const;
00384 
00388   void setAutoManage(bool autoManage);
00389 
00394   QPtrList<KateSuperRange> rangesIncluding(const KateTextCursor& cursor);
00395   QPtrList<KateSuperRange> rangesIncluding(uint line);
00396 
00401   bool rangesInclude(const KateTextCursor& cursor);
00402 
00409   KateSuperCursor* firstBoundary(const KateTextCursor* start = 0L);
00410 
00414   KateSuperCursor* nextBoundary();
00415 
00419   KateSuperCursor* currentBoundary();
00420 
00421 signals:
00426   void rangeEliminated(KateSuperRange* range);
00427 
00431   void listEmpty();
00432 
00436   void tagRange(KateSuperRange* range);
00437 
00438 protected:
00442   virtual int compareItems(QPtrCollection::Item item1, QPtrCollection::Item item2);
00443 
00447   virtual QPtrCollection::Item newItem(QPtrCollection::Item d);
00448 
00449 private slots:
00450   void slotEliminated();
00451   void slotDeleted(QObject* range);
00452 
00453 private:
00454   bool m_autoManage;
00455   bool m_connect;
00456 
00457   KateSuperCursorList m_columnBoundaries;
00458   bool m_trackingBoundaries;
00459 };
00460 
00461 #endif
00462 
00463 // 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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
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