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

KTextEditor

  • KTextEditor
  • MarkInterface
Public Types | Signals | Public Member Functions | Static Public Member Functions

KTextEditor::MarkInterface Class Reference
Document Extension Interfaces

Mark extension interface for the Document. More...

#include <markinterface.h>

List of all members.

Public Types

enum  MarkChangeAction { MarkAdded = 0, MarkRemoved = 1 }
enum  MarkTypes {
  markType01 = 0x1, markType02 = 0x2, markType03 = 0x4, markType04 = 0x8,
  markType05 = 0x10, markType06 = 0x20, markType07 = 0x40, markType08 = 0x80,
  markType09 = 0x100, markType10 = 0x200, markType11 = 0x400, markType12 = 0x800,
  markType13 = 0x1000, markType14 = 0x2000, markType15 = 0x4000, markType16 = 0x8000,
  markType17 = 0x10000, markType18 = 0x20000, markType19 = 0x40000, markType20 = 0x80000,
  markType21 = 0x100000, markType22 = 0x200000, markType23 = 0x400000, markType24 = 0x800000,
  markType25 = 0x1000000, markType26 = 0x2000000, markType27 = 0x4000000, markType28 = 0x8000000,
  markType29 = 0x10000000, markType30 = 0x20000000, markType31 = 0x40000000, markType32 = 0x80000000,
  Bookmark = markType01, BreakpointActive = markType02, BreakpointReached = markType03, BreakpointDisabled = markType04,
  Execution = markType05, Warning = markType06, Error = markType07
}

Signals

void markClicked (KTextEditor::Document *document, KTextEditor::Mark mark, bool &handled)
void markContextMenuRequested (KTextEditor::Document *document, KTextEditor::Mark mark, QPoint pos, bool &handled)
void markToolTipRequested (KTextEditor::Document *document, KTextEditor::Mark mark, QPoint position, bool &handled)

Public Member Functions

 MarkInterface ()
virtual ~MarkInterface ()
virtual void addMark (int line, uint markType)=0
virtual void clearMark (int line)=0
virtual void clearMarks ()=0
virtual uint editableMarks () const =0
virtual uint mark (int line)=0
virtual void markChanged (KTextEditor::Document *document, KTextEditor::Mark mark, KTextEditor::MarkInterface::MarkChangeAction action)=0
virtual QString markDescription (MarkTypes mark) const =0
virtual QPixmap markPixmap (MarkTypes mark) const =0
virtual const QHash< int,
KTextEditor::Mark * > & 
marks ()=0
virtual void marksChanged (KTextEditor::Document *document)=0
virtual void removeMark (int line, uint markType)=0
virtual void setEditableMarks (uint markMask)=0
virtual void setMark (int line, uint markType)=0
virtual void setMarkDescription (MarkTypes mark, const QString &text)=0
virtual void setMarkPixmap (MarkTypes mark, const QPixmap &pixmap)=0

Static Public Member Functions

static int reservedMarkersCount ()

Detailed Description

Mark extension interface for the Document.

Introduction

The MarkInterface provides methods to enable and disable marks in a Document, a marked line can be visualized for example with a shaded background color and/or a pixmap in the iconborder of the Document's View. There are a number of predefined mark types, specified in reservedMarkersCount(). Additionally it is possible to add custom marks and set custom pixmaps.

Implemeting the Interface

The MarkInterface is supposed to be an extension interface for a Document, i.e. the Document inherits the interface provided that the KTextEditor library in use implements the interface. Use qobject_cast to access the interface:

 // doc is of type KTextEditor::Document*
 KTextEditor::MarkInterface *iface =
     qobject_cast<KTextEditor::MarkInterface*>( doc );

 if( iface ) {
     // the implementation supports the interface
     // do stuff
 }

Handling Marks

Get all marks in the document by calling marks(). Use clearMarks() to remove all marks in the entire document. A single mark can be retrieved with mark(). To remove all marks from a line call clearMark(). To add and remove marks from a given line use addMark() and removeMark(). It is also possible to replace all marks with setMark(), i.e. setMark() is the same as a call of clearMark() followed by addMark(). The signals marksChanged() and markChanged() are emitted whenever a line's marks changed.

Attention:
A mark type is represented as an uint. An uint can have several mark types combined (see above: logical OR). That means for all functions/signals with an uint parameter, e.g. setMark(), removeMark(), etc, the uint may contain multiple marks, i.e. you can add and remove multiple marks simultaneously.

User Defined Marks

All marks that should be editable by the user can be specified with a mark mask via setEditableMarks(). To set a description and pixmap of a mark type call setMarkDescription() and setMarkPixmap().

See also:
KTextEditor::Document, KTextEditor::Mark
Author:
Christoph Cullmann <cullmann@kde.org>

Definition at line 118 of file markinterface.h.


Member Enumeration Documentation

enum KTextEditor::MarkInterface::MarkChangeAction

Possible actions on a mark.

See also:
markChanged()
Enumerator:
MarkAdded 

action: a mark was added.

MarkRemoved 

action: a mark was removed.

Definition at line 343 of file markinterface.h.

enum KTextEditor::MarkInterface::MarkTypes

Predefined mark types.

To add a new standard mark type, edit this interface and document the type.

Enumerator:
markType01 

Bookmark.

markType02 

Breakpoint active.

markType03 

Breakpoint reached.

markType04 

Breakpoint disabled.

markType05 

Execution mark.

markType06 

Warning.

markType07 

Error.

markType08 
markType09 
markType10 
markType11 
markType12 
markType13 
markType14 
markType15 
markType16 
markType17 
markType18 
markType19 
markType20 
markType21 
markType22 
markType23 
markType24 
markType25 
markType26 
markType27 
markType28 
markType29 
markType30 
markType31 
markType32 
Bookmark 
BreakpointActive 
BreakpointReached 
BreakpointDisabled 
Execution 
Warning 
Error 

Definition at line 209 of file markinterface.h.


Constructor & Destructor Documentation

MarkInterface::MarkInterface ( )

Definition at line 213 of file ktexteditor.cpp.

MarkInterface::~MarkInterface ( ) [virtual]

Virtual destructor.

Definition at line 217 of file ktexteditor.cpp.


Member Function Documentation

virtual void KTextEditor::MarkInterface::addMark ( int  line,
uint  markType 
) [pure virtual]

Add marks of type markType to line.

Existing marks on this line are preserved. If the mark markType already is set, nothing happens.

Parameters:
lineline to set the mark
markTypemark type
See also:
removeMark(), setMark()
virtual void KTextEditor::MarkInterface::clearMark ( int  line) [pure virtual]

Clear all marks set in the line.

Parameters:
lineline to clear marks
See also:
clearMarks(), removeMark(), addMark()
virtual void KTextEditor::MarkInterface::clearMarks ( ) [pure virtual]

Clear all marks in the entire document.

See also:
clearMark(), removeMark() TODO: dominik: add argument unit mask = 0
virtual uint KTextEditor::MarkInterface::editableMarks ( ) const [pure virtual]

Get, which marks can be toggled by the user.

The returned value is a mark mask containing all editable marks combined with a logical OR.

Returns:
mark mask containing all editable marks
See also:
setEditableMarks()
virtual uint KTextEditor::MarkInterface::mark ( int  line) [pure virtual]

Get all marks set on the line.

Parameters:
linerequested line
Returns:
a uint representing of the marks set in line concatenated by logical OR
See also:
addMark(), removeMark()
virtual void KTextEditor::MarkInterface::markChanged ( KTextEditor::Document *  document,
KTextEditor::Mark  mark,
KTextEditor::MarkInterface::MarkChangeAction  action 
) [pure virtual]

The document emits this signal whenever the mark changes.

Parameters:
documentthe document which emitted the signal
markchanged mark
actionaction, either removed or added
See also:
marksChanged()
void KTextEditor::MarkInterface::markClicked ( KTextEditor::Document *  document,
KTextEditor::Mark  mark,
bool &  handled 
) [signal]

The document emits this signal whenever the mark is left-clicked.

Parameters:
documentthe document which emitted the signal
markmark that was right-clicked
posposition where the menu should be started
handledset this to 'true' if this event was handled externally, and kate should not do own handling of the left click.
void KTextEditor::MarkInterface::markContextMenuRequested ( KTextEditor::Document *  document,
KTextEditor::Mark  mark,
QPoint  pos,
bool &  handled 
) [signal]

The document emits this signal whenever the mark is right-clicked to show a context menu.

The receiver may show an own context menu instead of the kate internal one.

Parameters:
documentthe document which emitted the signal
markmark that was right-clicked
posposition where the menu should be started
handledset this to 'true' if this event was handled externally, and kate should not create an own context menu.
virtual QString KTextEditor::MarkInterface::markDescription ( MarkTypes  mark) const [pure virtual]

Get the mark's description to text.

Parameters:
markmark to set the description
Returns:
text of the given mark or QString(), if the entry does not exist
See also:
setMarkDescription(), setMarkPixmap()
virtual QPixmap KTextEditor::MarkInterface::markPixmap ( MarkTypes  mark) const [pure virtual]

Get the mark's pixmap.

Parameters:
markmark type. If the pixmap does not exist the resulting is null (check with QPixmap::isNull()).
See also:
setMarkDescription()
virtual const QHash<int, KTextEditor::Mark*>& KTextEditor::MarkInterface::marks ( ) [pure virtual]

Get a hash holding all marks in the document.

The hash key for a mark is its line.

Returns:
a hash holding all marks in the document
virtual void KTextEditor::MarkInterface::marksChanged ( KTextEditor::Document *  document) [pure virtual]

The document emits this signal whenever a mark mask changed.

Parameters:
documentdocument which emitted this signal
See also:
markChanged()
void KTextEditor::MarkInterface::markToolTipRequested ( KTextEditor::Document *  document,
KTextEditor::Mark  mark,
QPoint  position,
bool &  handled 
) [signal]

The document emits this signal whenever the mark is hovered using the mouse, and the receiver may show a tooltip.

Parameters:
documentthe document which emitted the signal
markmark that was hovered
positionmouse position during the hovering
handledset this to 'true' if this event was handled externally
virtual void KTextEditor::MarkInterface::removeMark ( int  line,
uint  markType 
) [pure virtual]

Remove the mark mask of type markType from line.

Parameters:
lineline to remove the mark
markTypemark type to be removed
See also:
clearMark()
static int KTextEditor::MarkInterface::reservedMarkersCount ( ) [inline, static]

Get the number of predefined mark types we have so far.

Note:
FIXME: If you change this you have to make sure katepart supports the new size!
Returns:
number of reserved marker types

Definition at line 201 of file markinterface.h.

virtual void KTextEditor::MarkInterface::setEditableMarks ( uint  markMask) [pure virtual]

Set the mark mask the user is allowed to toggle to markMask.

I.e. concatenate all editable marks with a logical OR. If the user should be able to add a bookmark and set a breakpoint with the context menu in the icon pane, you have to call

 // iface is of Type KTextEditor::MarkInterface*
 // only make bookmark and breakpoint editable
 iface->setEditableMarks( MarkInterface::Bookmark |
                          MarkInterface::BreakpointActive );

 // or preserve last settings, and add bookmark and breakpoint
 iface->setEditableMarks( iface->editableMarks() |
                          MarkInterface::Bookmark |
                          MarkInterface::BreakpointActive );
Parameters:
markMaskbitmap pattern
See also:
editableMarks(), setMarkPixmap(), setMarkDescription()
virtual void KTextEditor::MarkInterface::setMark ( int  line,
uint  markType 
) [pure virtual]

Set the line's mark types to markType.

If line already contains a mark of the given type it has no effect. All other marks are deleted before the mark is set. You can achieve the same by calling

 clearMark(line);
 addMark(line, markType);
Parameters:
lineline to set the mark
markTypemark type
See also:
clearMark(), addMark(), mark()
virtual void KTextEditor::MarkInterface::setMarkDescription ( MarkTypes  mark,
const QString &  text 
) [pure virtual]

Set the mark's description to text.

Parameters:
markmark to set the description
textnew descriptive text
See also:
markDescription(), setMarkPixmap()
virtual void KTextEditor::MarkInterface::setMarkPixmap ( MarkTypes  mark,
const QPixmap &  pixmap 
) [pure virtual]

Set the mark's pixmap to pixmap.

Parameters:
markmark to which the pixmap will be attached
pixmapnew pixmap
See also:
setMarkDescription()

The documentation for this class was generated from the following files:
  • markinterface.h
  • ktexteditor.cpp

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Modules
  • 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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
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