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

KTextEditor

KTextEditor::ContainerInterface

KTextEditor::ContainerInterface Class Reference
[Editor Extension Interfaces]

Class that allows the kpart host to provide some extensions. More...

#include <containerinterface.h>

List of all members.


Public Member Functions

virtual QObject * container ()=0
 ContainerInterface ()
virtual void setContainer (QObject *container)=0
virtual ~ContainerInterface ()

Detailed Description

Class that allows the kpart host to provide some extensions.

The KTextEditor framework allows the kpart host to provide additional services to the kpart. Those services are provided through the ContainerInterface class.

If the container supports those specific services, it should set an instance of the service class with ContainerInterface::setContainer(). That instance should inherit QObject, have the Q_OBJECT macro and declare a Q_INTERFACES(), in order for the qobject_cast mechanism to work.

To obtain a ContainerInterface, in order to set a specific container extension, the kpart host should do:

 // inside the kpart host
 Editor * editor = KTextEditor::EditorChooser::editor();
 ContainerInterface * iface = qobject_cast<ContainerInterface *>( editor );
 if (iface != NULL) {
   iface->setContainer( myContainerExtension );
 } else {
   // the kpart does not support ContainerInterface.
 }

It is then up to the kpart to use it.

Definition at line 65 of file containerinterface.h.


Constructor & Destructor Documentation

ContainerInterface::ContainerInterface (  ) 

Constructor.

Definition at line 290 of file ktexteditor.cpp.

ContainerInterface::~ContainerInterface (  )  [virtual]

Virtual Destructor.

Definition at line 293 of file ktexteditor.cpp.


Member Function Documentation

virtual QObject* KTextEditor::ContainerInterface::container (  )  [pure virtual]

Fetch the container extension.

This method is used by the KTextEditor component to know which extensions are supported by the KTextEditor host.

The kpart will cast the result with qobject_cast() to the right container extension to see if that particular extension is supported:

Example:

 // inside the kpart

 Editor * editor = KTextEditor::EditorChooser::editor();
 ContainerInterface * iface = qobject_cast<ConainterInterace *>( editor );
 SomeContainerExtension * myExt =
     qobject_cast<SomeContainerExtension *>( iface->container() );

 if (myExt) {
     // do some stuff with the specific container extension
     // ...
 } else {
     // too bad, that extension is not supported.
 }

See also:
setContainer

virtual void KTextEditor::ContainerInterface::setContainer ( QObject *  container  )  [pure virtual]

Set the KTextEditor container.

This method is used by the KTextEditor host to set an instance of a class providing optional container extensions.

See also:
container


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