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

KTextEditor

  • KTextEditor
  • MdiContainer
Public Member Functions | List of all members
KTextEditor::MdiContainer Class Referenceabstract

#include <containerinterface.h>

Public Member Functions

 MdiContainer ()
 
virtual ~MdiContainer ()
 
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
 
virtual void setActiveView (View *view)=0
 

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 166 of file containerinterface.h.

Constructor & Destructor Documentation

MdiContainer::MdiContainer ( )

Constructor.

Definition at line 233 of file ktexteditor.cpp.

MdiContainer::~MdiContainer ( )
virtual

Virtual destructor.

Definition at line 236 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
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:52:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal