KDE 4.9 PyKDE API Reference

- KDE's Python API

# ModeInterface Class Reference

`from PyKDE4.ktexteditor import *`

Namespace: KTextEditor

## Detailed Description

Mode information interface for the Document.

Introduction

The ModeInterface provides access to the modes of a document

Accessing the ModeInterface

The ModeInterface 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.ModeInterface *iface =
         qobject_cast<KTextEditor.ModeInterface*>( doc );

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

See also:
  KTextEditor.Document

Author:
  Joseph Wenninger <jowenn@kde.org>

## Methods
| __init__ (self)
QStringList | allPossibleModes (self)
QString | modeAt (self, KTextEditor.Cursor position)

## Method Documentation

__init__ | ( |  | self ) |

Constructor.

QStringList allPossibleModes | ( |  | self ) |

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

Get all available file modes for the current document.

Returns:
  Returns a list of all possible modes within a document.

See also:
  KTextEditor.Document.mode()

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

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

Get the possible modes for a given position

The mode of a certain position might be ambiguos. eg. mode C++ could stand for the source or the header file. In most cases this mode will be equal to the highlighting name but it does not have to be. Modes should not be mixed with HighlightingModes. For instance for the toplevel in a document this might defer. For sub modes it might in the future

See also:
  modes()

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