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

KTextEditor

KTextEditor::CodeCompletionInterface

KTextEditor::CodeCompletionInterface Class Reference
[View Extension Interfaces]

#include <codecompletioninterface.h>

List of all members.


Detailed Description

Code completion extension interface for the View.

Introduction

The CodeCompletionInterface is designed to provide code completion functionality for a KTextEditor::View. This interface provides the basic mechanisms to display a list of completions, update this list according to user input, and allow the user to select a completion.

Essentially, this provides an item view for the available completions. In order to use this interface, you will need to implement a CodeCompletionModel that generates the relevant completions given the current input.

Accessing the CodeCompletionInterface

The CodeCompletionInterface is an extension interface for a View, i.e. the View inherits the interface provided that the used KTextEditor library implements the interface. Use qobject_cast to access the interface:
 // view is of type KTextEditor::View*
 KTextEditor::CodeCompletionInterface *iface =
     qobject_cast<KTextEditor::CodeCompletionInterface*>( view );

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

Using the CodeCompletionInterface

The CodeCompletionInterface can be used in different ways, which we will call "automatic", and "manual".

Automatic

In automatic mode, the CodeCompletionInterface will take care of starting and aborting the generation of code completions as appropriate, when the users inserts or changes text.

To use the interface in this way, first register a CodeCompletionModel using registerCompletionModel(). Now call setAutomaticCompletionEnabled() to enabled automatic completions.

Manual

If you need more control over when code completions get shown or not, or which fragment of the text should be considered as the basis for generated completions, proceed as follows:

Call setAutomaticCompletionEnabled(false) to disable automatic completions. To start the generation of code completions for the current word, call startCompletion(), with the appropriate parameters. To hide the generated completions, use abortCompletion().

See also:
KTextEditor::View, KTextEditor::CodeCompletionModel

Definition at line 92 of file codecompletioninterface.h.


Public Member Functions

virtual void abortCompletion ()=0
virtual void forceCompletion ()=0
virtual bool isAutomaticInvocationEnabled () const =0
virtual bool isCompletionActive () const =0
virtual void registerCompletionModel (CodeCompletionModel *model)=0
virtual void setAutomaticInvocationEnabled (bool enabled=true)=0
virtual void startCompletion (const Range &word, CodeCompletionModel *model)=0
virtual void unregisterCompletionModel (CodeCompletionModel *model)=0
virtual ~CodeCompletionInterface ()

Constructor & Destructor Documentation

CodeCompletionInterface::~CodeCompletionInterface (  )  [virtual]

Definition at line 23 of file codecompletioninterface.cpp.


Member Function Documentation

virtual void KTextEditor::CodeCompletionInterface::abortCompletion (  )  [pure virtual]

Abort the currently displayed code completion without executing any currently selected completion.

This is safe, even when the completion box is not currently active.

See also:
isCompletionActive()

virtual void KTextEditor::CodeCompletionInterface::forceCompletion (  )  [pure virtual]

Force execution of the currently selected completion, and hide the code completion box.

virtual bool KTextEditor::CodeCompletionInterface::isAutomaticInvocationEnabled (  )  const [pure virtual]

Determine the status of automatic code completion invocation.

virtual bool KTextEditor::CodeCompletionInterface::isCompletionActive (  )  const [pure virtual]

Query whether the code completion box is currently displayed.

virtual void KTextEditor::CodeCompletionInterface::registerCompletionModel ( CodeCompletionModel *  model  )  [pure virtual]

Register a new code completion model.

Parameters:
model new completion model
See also:
unregisterCompletionModel()

virtual void KTextEditor::CodeCompletionInterface::setAutomaticInvocationEnabled ( bool  enabled = true  )  [pure virtual]

Enable or disable automatic code completion invocation.

virtual void KTextEditor::CodeCompletionInterface::startCompletion ( const Range &  word,
CodeCompletionModel *  model 
) [pure virtual]

Invoke code completion over a given range, with a specific model.

virtual void KTextEditor::CodeCompletionInterface::unregisterCompletionModel ( CodeCompletionModel *  model  )  [pure virtual]

Unregister a code completion model.

Parameters:
model the model that should be unregistered
See also:
registerCompletionModel()


The documentation for this class was generated from the following files:
  • codecompletioninterface.h
  • codecompletioninterface.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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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