KTextEditor.HighlightInterface

KDE 4.9 PyKDE API Reference

- KDE's Python API

# HighlightInterface Class Reference

`from PyKDE4.ktexteditor import *`

Namespace: KTextEditor

## Detailed Description

Abstract class:
  This class can be used as a base class for new classes, but can not be instantiated directly.

Highlighting information interface for the Document.

Introduction

The HighlightInterface provides methods to access the Attributes used for highlighting the Document.

Accessing the HighlightInterface

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

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

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

See also:
  KTextEditor.Document

Author:
  Milian Wolff <mail@milianw.de>

Since:
  4.4

## Enumerations
DefaultStyle | { dsNormal, dsKeyword, dsDataType, dsDecVal, dsBaseN, dsFloat, dsChar, dsString, dsComment, dsOthers, dsAlert, dsFunction, dsRegionMarker, dsError }
## Methods
| __init__ (self)
KSharedPtr | defaultStyle (self, KTextEditor.HighlightInterface.DefaultStyle ds)
QStringList | embeddedHighlightingModes (self)
QString | highlightingModeAt (self, KTextEditor.Cursor position)

## Method Documentation

__init__ | ( |  | self ) |

Constructor.

KSharedPtr defaultStyle | ( | self, |
|  | KTextEditor.HighlightInterface.DefaultStyle | ds
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Returns the attribute used for the style ds.

QStringList embeddedHighlightingModes | ( |  | self ) |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Get all available highlighting modes for the current document.

Each document can be highlighted using an arbitrary number of highlighting contexts. This method will return the names for each of the used modes.

Example: The "PHP (HTML)" mode includes the highlighting for PHP, HTML, CSS and JavaScript.

Returns:
  Returns a list of embedded highlighting modes for the current Document.

See also:
  KTextEditor.Document.highlightingMode()

QString highlightingModeAt | ( | self, |
|  | KTextEditor.Cursor | position
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Get the highlight mode used at a given position in the document.

Retrieve the name of the applied highlight mode at a given position in the current document.

See also:
  highlightingModes()

TODO: I intended to make this const but Kate's implementation needs to call kateTextline which is non-const. Solution?

## Enumeration Documentation

DefaultStyle

Enumerator:

  dsNormal |
  dsKeyword |
  dsDataType |
  dsDecVal |
  dsBaseN |
  dsFloat |
  dsChar |
  dsString |
  dsComment |
  dsOthers |
  dsAlert |
  dsFunction |
  dsRegionMarker |
  dsError |