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

KTextEditor

KTextEditor::MdiContainer

KTextEditor::MdiContainer Class Reference

#include <containerinterface.h>

List of all members.


Detailed Description

A container for MDI-capable kpart hosts.

The kpart container for the KTextEditor interface may have different capabilities. For example, inside KDevelop or Kate, the container can manage multiple views and multiple documents. However, if the kpart text is used inside konqueror as a replacement of the text entry in html forms, the container will only support one view with one document.

This class allows the kpart component to create and delete views, create and delete documents, fetch and set the current view. Note that the ktexteditor framework already supports multiple document and views and that the kpart host can create them and delete them as it wishes. What this class provides is the ability for the kpart component being hosted to do the same.

An instance of this extension should be set with ContainerInterface::setContainerExtension().Check ContainerInterface() to see how to obtain an instance of ContainerInterface. The instance should inherit QObject, inherit MdiContainer, declare the Q_OBJECT macro and declare a Q_INTERFACES(KTextEditor::MdiContainer) .

Code example to support MdiContainer (in the kpart host):

 class MyMdiContainer : public QObject,
                        public MdiContainer
 {
   Q_OBJECT
   Q_INTERFACES( KTextEditor::MdiContainer )

   public:
     // ...
 }

To check if the kpart hosts supports the MDI container:

 Editor * editor = KTextEditor::EditorChooser::editor();
 ContainerInterface * iface = qobject_cast<ContainerInterface *>( editor );
 if (iface) {
   MdiContainer * mdiContainer = qobject_cast<MdiContainer *>( iface->container() );
   if (MdiContainer != NULL ) {
    // great, I can create additional views
    // ...
   }
 }

Definition at line 164 of file containerinterface.h.


Public Member Functions

virtual View * activeView ()=0
virtual bool closeDocument (Document *doc)=0
virtual bool closeView (View *view)=0
virtual Document * createDocument ()=0
virtual View * createView (Document *doc)=0
 MdiContainer ()
virtual void setActiveView (View *view)=0
virtual ~MdiContainer ()

Constructor & Destructor Documentation

MdiContainer::MdiContainer (  ) 

Constructor.

Definition at line 293 of file ktexteditor.cpp.

MdiContainer::~MdiContainer (  )  [virtual]

Virtual destructor.

Definition at line 296 of file ktexteditor.cpp.


Member Function Documentation

virtual View* KTextEditor::MdiContainer::activeView (  )  [pure virtual]

Get the current activew view.

Returns:
the active view.
See also:
setActiveView

virtual bool KTextEditor::MdiContainer::closeDocument ( Document *  doc  )  [pure virtual]

Closes of document doc .

The document is about to be closed but is still valid when this call is made. The Document does not contain any view when this call is made (closeView() has been called on all the views of the document previously).

The signal aboutToClose() is emitted before this method is called.

Returns:
true if the removal is authorized and acted, or false if removing documents by the kpart is not supported by the container.

virtual bool KTextEditor::MdiContainer::closeView ( View *  view  )  [pure virtual]

Closes the View view .

The view is still valid when this call is made but will be deleted shortly after.

Returns:
true if the removal is authorized and acted, or false if the container does not support view removing from the kpart, or

virtual Document* KTextEditor::MdiContainer::createDocument (  )  [pure virtual]

Create a new Document and return it to the kpart.

Canonical implementation is:

 Document * createDocument()
 {
     Document * doc;
     // set parentQObject to relevant value
     doc = editor->createDocument( parentQObject );
     // integrate the new document in the document list of the
     // container, ...
     return doc;
 }

The signal documentCreated() will be emitted during the creation.

Returns:
a pointer to the new Document object.

virtual View* KTextEditor::MdiContainer::createView ( Document *  doc  )  [pure virtual]

Creates a new View and return it to the kpart.

Canonical implementation is:

 View * createView( Document * doc )
 {
     // set parentWidget to relevant value
     return doc->createView( parentWidget );
 }

The signal viewCreated() will be emitted during the createView() call.

Returns:
a pointer to the new View created.

virtual void KTextEditor::MdiContainer::setActiveView ( View *  view  )  [pure virtual]

Set the view requested by the part as the active view.

See also:
activeView


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
  • 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