28#include <tdeparts/factory.h>
29#include <tdeparts/componentfactory.h>
31#include "document.moc"
78 class PrivatePluginViewInterface
81 PrivatePluginViewInterface ()
85 ~PrivatePluginViewInterface ()
103unsigned int Document::globalDocumentNumber = 0;
104unsigned int View::globalViewNumber = 0;
105unsigned int Plugin::globalPluginNumber = 0;
106unsigned int PluginViewInterface::globalPluginViewInterfaceNumber = 0;
107unsigned int Editor::globalEditorNumber = 0;
109Document::Document( TQObject *parent,
const char *name ) :
KTextEditor::
Editor (parent, name )
111 globalDocumentNumber++;
112 myDocumentNumber = globalDocumentNumber;
113 myDocumentListPosition = -1;
122 return myDocumentNumber;
127 return myDocumentListPosition;
132 myDocumentListPosition = pos;
146 myViewNumber = globalViewNumber;
160 TQCString num1, num2;
162 num2.setNum (
document()->documentNumber());
164 return num2 +
"-" + num1;
167Plugin::Plugin(
Document *document,
const char *name ) : TQObject (document, name )
169 globalPluginNumber++;
170 myPluginNumber = globalPluginNumber;
171 d =
new PrivatePlugin ();
180unsigned int Plugin::pluginNumber ()
const
182 return myPluginNumber;
190PluginViewInterface::PluginViewInterface()
192 globalPluginViewInterfaceNumber++;
193 myPluginViewInterfaceNumber = globalPluginViewInterfaceNumber;
196PluginViewInterface::~PluginViewInterface()
200unsigned int PluginViewInterface::pluginViewInterfaceNumber ()
const
202 return myPluginViewInterfaceNumber;
205Editor::Editor( TQObject *parent,
const char *name ) : KParts::ReadWritePart( parent, name )
207 globalEditorNumber++;
208 myEditorNumber = globalEditorNumber;
215unsigned int Editor::editorNumber ()
const
217 return myEditorNumber;
220Editor *KTextEditor::createEditor (
const char* libname, TQWidget *parentWidget,
const char *widgetName, TQObject *parent,
const char *name )
222 return KParts::ComponentFactory::createPartInstanceFromLibrary<Editor>( libname, parentWidget, widgetName, parent, name );
225Document *KTextEditor::createDocument (
const char* libname, TQObject *parent,
const char *name )
227 return KParts::ComponentFactory::createPartInstanceFromLibrary<Document>( libname, 0, 0, parent, name );
230Plugin *KTextEditor::createPlugin (
const char* libname,
Document *document,
const char *name )
232 return KParts::ComponentFactory::createInstanceFromLibrary<Plugin>( libname, document, name );
The main class representing a text document.
long documentListPosition() const
Returns the list position of this document in your app, if applicable.
void setDocumentListPosition(long pos)
Sets the list position of this document in your app, if applicable.
TQCString documentDCOPSuffix() const
Returns this document's DCOP suffix for identifiying its DCOP interface.
unsigned int documentNumber() const
Returns the global number of this document in your app.
This is a simplfied version of the Document & View classes Usage: Load it, merge it's gui + be happy ...
Editor(TQObject *parent=0, const char *name=0)
Create a new editor widget.
Basic KTextEditor plugin class.
virtual class Document * document() const =0
Acess the parent Document.
View(class Document *, TQWidget *parent, const char *name=0)
Create a new view to the given document.
unsigned int viewNumber() const
Returns the number of this view.
TQCString viewDCOPSuffix() const
Returns the DCOP suffix to allow identification of this view's DCOP interface.
KTextEditor is KDE's standard text editing KPart interface.