• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • part
katesupercursor.h
1/* This file is part of the KDE libraries
2 Copyright (C) 2003 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 KATESUPERCURSOR_H
20#define KATESUPERCURSOR_H
21
22#include "katecursor.h"
23
24class KateDocument;
25class KateView;
26
45class KateSuperCursor : public TQObject, public KateDocCursor, public Kate::Cursor
46{
47 TQ_OBJECT
48
49public:
55 KateSuperCursor(KateDocument* doc, bool privateC, const KateTextCursor& cursor, TQObject* parent = 0L, const char* name = 0L);
56 KateSuperCursor(KateDocument* doc, bool privateC, int lineNum = 0, int col = 0, TQObject* parent = 0L, const char* name = 0L);
57
58 ~KateSuperCursor ();
59
60 public:
61 // KTextEditor::Cursor interface
62 void position(uint *line, uint *col) const;
63 bool setPosition(uint line, uint col);
64 bool insertText(const TQString& text);
65 bool removeText(uint numberOfCharacters);
66 TQChar currentChar() const;
67
71 bool atStartOfLine() const;
72
76 bool atEndOfLine() const;
77
82 bool moveOnInsert() const;
83
89 void setMoveOnInsert(bool moveOnInsert);
90
94 operator TQString();
95
96 // Reimplementations;
97 virtual void setLine(int lineNum);
98 virtual void setCol(int colNum);
99 virtual void setPos(const KateTextCursor& pos);
100 virtual void setPos(int lineNum, int colNum);
101
102 signals:
106 void positionDirectlyChanged();
107
111 void positionChanged();
112
116 void positionUnChanged();
117
122 void positionDeleted();
123
132 void charInsertedAt();
133
137 void charDeletedBefore();
138
142 void charDeletedAfter();
143
144 //BEGIN METHODES TO CALL FROM KATE DOCUMENT TO KEEP CURSOR UP TO DATE
145 public:
146 void editTextInserted ( uint line, uint col, uint len);
147 void editTextRemoved ( uint line, uint col, uint len);
148
149 void editLineWrapped ( uint line, uint col, bool newLine = true );
150 void editLineUnWrapped ( uint line, uint col, bool removeLine = true, uint length = 0 );
151
152 void editLineInserted ( uint line );
153 void editLineRemoved ( uint line );
154 //END
155
156 private:
157 KateDocument *m_doc;
158 bool m_moveOnInsert : 1;
159 bool m_lineRemoved : 1;
160 bool m_privateCursor : 1;
161};
162
168class KateSuperRange : public TQObject, public KateRange
169{
170 friend class KateSuperRangeList;
171
172 TQ_OBJECT
173
174public:
176 enum InsertBehaviour {
178 DoNotExpand = 0,
180 ExpandLeft = 0x1,
182 ExpandRight = 0x2
183 };
184
188 KateSuperRange(KateSuperCursor* start, KateSuperCursor* end, TQObject* parent = 0L, const char* name = 0L);
189 KateSuperRange(KateDocument* doc, const KateRange& range, TQObject* parent = 0L, const char* name = 0L);
190 KateSuperRange(KateDocument* doc, const KateTextCursor& start, const KateTextCursor& end, TQObject* parent = 0L, const char* name = 0L);
191
192 virtual ~KateSuperRange();
193
194 // fulfill KateRange requirements
195 virtual KateTextCursor& start();
196 virtual KateTextCursor& end();
197 virtual const KateTextCursor& start() const;
198 virtual const KateTextCursor& end() const;
199
200 void allowZeroLength(bool yes=true){m_allowZeroLength=yes;}
204 KateSuperCursor& superStart();
205 const KateSuperCursor& superStart() const;
206
210 KateSuperCursor& superEnd();
211 const KateSuperCursor& superEnd() const;
212
216 int behaviour() const;
217
226 void setBehaviour(int behaviour);
227
231 virtual bool isValid() const;
232
244 bool owns(const KateTextCursor& cursor) const;
245
250 bool includes(const KateTextCursor& cursor) const;
251
255 bool includes(uint lineNum) const;
256
260 bool includesWholeLine(uint lineNum) const;
261
265 bool boundaryAt(const KateTextCursor& cursor) const;
266
270 bool boundaryOn(uint lineNum) const;
271
272signals:
282 void positionChanged();
283
287 void positionUnChanged();
288
292 void contentsChanged();
293
297 void boundaryDeleted();
298
305 void eliminated();
306
310 void tagRange(KateSuperRange* range);
311
312public slots:
313 void slotTagRange();
314
315private slots:
316 void slotEvaluateChanged();
317 void slotEvaluateUnChanged();
318
319private:
320 void init();
321 void evaluateEliminated();
322 void evaluatePositionChanged();
323
324 KateSuperCursor* m_start;
325 KateSuperCursor* m_end;
326 bool m_evaluate;
327 bool m_startChanged;
328 bool m_endChanged;
329 bool m_deleteCursors;
330 bool m_allowZeroLength;
331};
332
333class KateSuperCursorList : public TQPtrList<KateSuperCursor>
334{
335protected:
336 virtual int compareItems(TQPtrCollection::Item item1, TQPtrCollection::Item item2);
337};
338
339class KateSuperRangeList : public TQObject, public TQPtrList<KateSuperRange>
340{
341 TQ_OBJECT
342
343public:
347 KateSuperRangeList(bool autoManage = true, TQObject* parent = 0L, const char* name = 0L);
348
358 KateSuperRangeList(const TQPtrList<KateSuperRange>& rangeList, TQObject* parent = 0L, const char* name = 0L);
359
360 virtual ~KateSuperRangeList() {}
366 void appendList(const TQPtrList<KateSuperRange>& rangeList);
367
372 void connectAll();
373
377 virtual void clear();
378
383 bool autoManage() const;
384
388 void setAutoManage(bool autoManage);
389
394 TQPtrList<KateSuperRange> rangesIncluding(const KateTextCursor& cursor);
395 TQPtrList<KateSuperRange> rangesIncluding(uint line);
396
401 bool rangesInclude(const KateTextCursor& cursor);
402
409 KateSuperCursor* firstBoundary(const KateTextCursor* start = 0L);
410
414 KateSuperCursor* nextBoundary();
415
419 KateSuperCursor* currentBoundary();
420
421signals:
426 void rangeEliminated(KateSuperRange* range);
427
431 void listEmpty();
432
436 void tagRange(KateSuperRange* range);
437
438protected:
442 virtual int compareItems(TQPtrCollection::Item item1, TQPtrCollection::Item item2);
443
447 virtual TQPtrCollection::Item newItem(TQPtrCollection::Item d);
448
449private slots:
450 void slotEliminated();
451 void slotDeleted(TQObject* range);
452
453private:
454 bool m_autoManage;
455 bool m_connect;
456
457 KateSuperCursorList m_columnBoundaries;
458 bool m_trackingBoundaries;
459};
460
461#endif
KateDocCursor
Cursor class with a pointer to its document.
Definition: katecursor.h:93
KateSuperCursor
Possible additional features:
Definition: katesupercursor.h:46
KateSuperCursor::setMoveOnInsert
void setMoveOnInsert(bool moveOnInsert)
Change the behavior of the cursor when text is inserted at the cursor.
Definition: katesupercursor.cpp:100
KateSuperCursor::charDeletedAfter
void charDeletedAfter()
The character immediately after the cursor was deleted.
KateSuperCursor::charInsertedAt
void charInsertedAt()
A character was inserted immediately before the cursor.
KateSuperCursor::atEndOfLine
bool atEndOfLine() const
Definition: katesupercursor.cpp:90
KateSuperCursor::positionDeleted
void positionDeleted()
The cursor's surrounding characters were both deleted simultaneously.
KateSuperCursor::positionDirectlyChanged
void positionDirectlyChanged()
The cursor's position was directly changed by the program.
KateSuperCursor::KateSuperCursor
KateSuperCursor(KateDocument *doc, bool privateC, const KateTextCursor &cursor, TQObject *parent=0L, const char *name=0L)
bool privateC says: if private, than don't show to apps using the cursorinterface in the list,...
Definition: katesupercursor.cpp:28
KateSuperCursor::positionChanged
void positionChanged()
The cursor's position was changed.
KateSuperCursor::atStartOfLine
bool atStartOfLine() const
Definition: katesupercursor.cpp:85
KateSuperCursor::charDeletedBefore
void charDeletedBefore()
The character immediately before the cursor was deleted.
KateSuperCursor::moveOnInsert
bool moveOnInsert() const
Returns how this cursor behaves when text is inserted at the cursor.
Definition: katesupercursor.cpp:95
KateSuperCursor::positionUnChanged
void positionUnChanged()
Athough an edit took place, the cursor's position was unchanged.
KateSuperRange
Represents a range of text, from the start() to the end().
Definition: katesupercursor.h:169
KateSuperRange::isValid
virtual bool isValid() const
Start and end must be valid and start <= end.
Definition: katesupercursor.cpp:404
KateSuperRange::superEnd
KateSuperCursor & superEnd()
Returns the super end cursor.
Definition: katesupercursor.cpp:383
KateSuperRange::boundaryOn
bool boundaryOn(uint lineNum) const
Returns whether there is a boundary of this range on line.
Definition: katesupercursor.cpp:442
KateSuperRange::contentsChanged
void contentsChanged()
The contents of the range changed.
KateSuperRange::eliminated
void eliminated()
The range now contains no characters (ie.
KateSuperRange::KateSuperRange
KateSuperRange(KateSuperCursor *start, KateSuperCursor *end, TQObject *parent=0L, const char *name=0L)
Constructor.
Definition: katesupercursor.cpp:280
KateSuperRange::includes
bool includes(const KateTextCursor &cursor) const
Returns true if the range includes cursor 's character.
Definition: katesupercursor.cpp:422
KateSuperRange::behaviour
int behaviour() const
Returns how this range reacts to characters inserted immediately outside the range.
Definition: katesupercursor.cpp:393
KateSuperRange::superStart
KateSuperCursor & superStart()
Returns the super start cursor.
Definition: katesupercursor.cpp:373
KateSuperRange::includesWholeLine
bool includesWholeLine(uint lineNum) const
Returns true if the range totally encompasses line.
Definition: katesupercursor.cpp:432
KateSuperRange::InsertBehaviour
InsertBehaviour
Determine how the range reacts to characters inserted immediately outside the range.
Definition: katesupercursor.h:176
KateSuperRange::DoNotExpand
@ DoNotExpand
Don't expand to encapsulate new characters in either direction. This is the default.
Definition: katesupercursor.h:178
KateSuperRange::ExpandRight
@ ExpandRight
Expand to encapsulate new characters to the right of the range.
Definition: katesupercursor.h:182
KateSuperRange::ExpandLeft
@ ExpandLeft
Expand to encapsulate new characters to the left of the range.
Definition: katesupercursor.h:180
KateSuperRange::positionChanged
void positionChanged()
More interesting signals that aren't worth implementing here: firstCharDeleted: start()::charDeleted(...
KateSuperRange::boundaryDeleted
void boundaryDeleted()
Either cursor's surrounding characters were both deleted.
KateSuperRange::tagRange
void tagRange(KateSuperRange *range)
Indicates the region needs re-drawing.
KateSuperRange::positionUnChanged
void positionUnChanged()
The range's position was unchanged.
KateSuperRange::owns
bool owns(const KateTextCursor &cursor) const
This is for use where the ranges are used in a heirachy, ie.
Definition: katesupercursor.cpp:409
KateSuperRange::boundaryAt
bool boundaryAt(const KateTextCursor &cursor) const
Returns whether cursor is the site of a boundary of this range.
Definition: katesupercursor.cpp:437
KateSuperRange::setBehaviour
void setBehaviour(int behaviour)
Determine how the range should react to characters inserted immediately outside the range.
Definition: katesupercursor.cpp:398
KateTextCursor
Simple cursor class with no document pointer.
Definition: katecursor.h:34
KStdAction::clear
TDEAction * clear(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name=0)

kate

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

kate

Skip menu "kate"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kate by doxygen 1.9.4
This website is maintained by Timothy Pearson.