27 #include <tdeaction.h>
28 #include <tdeparts/factory.h>
29 #include <tdeparts/componentfactory.h>
31 #include "document.moc"
78 class PrivatePluginViewInterface
81 PrivatePluginViewInterface ()
85 ~PrivatePluginViewInterface ()
103 unsigned int Document::globalDocumentNumber = 0;
104 unsigned int View::globalViewNumber = 0;
105 unsigned int Plugin::globalPluginNumber = 0;
106 unsigned int PluginViewInterface::globalPluginViewInterfaceNumber = 0;
107 unsigned int Editor::globalEditorNumber = 0;
109 Document::Document( TQObject *parent,
const char *name ) :
KTextEditor::
Editor (parent, name )
111 globalDocumentNumber++;
112 myDocumentNumber = globalDocumentNumber;
113 myDocumentListPosition = -1;
116 Document::~Document()
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;
167 Plugin::Plugin(
Document *document,
const char *name ) : TQObject (document, name )
169 globalPluginNumber++;
170 myPluginNumber = globalPluginNumber;
171 d =
new PrivatePlugin ();
180 unsigned int Plugin::pluginNumber ()
const
182 return myPluginNumber;
190 PluginViewInterface::PluginViewInterface()
192 globalPluginViewInterfaceNumber++;
193 myPluginViewInterfaceNumber = globalPluginViewInterfaceNumber;
196 PluginViewInterface::~PluginViewInterface()
200 unsigned int PluginViewInterface::pluginViewInterfaceNumber ()
const
202 return myPluginViewInterfaceNumber;
205 Editor::Editor( TQObject *parent,
const char *name ) : KParts::ReadWritePart( parent, name )
207 globalEditorNumber++;
208 myEditorNumber = globalEditorNumber;
215 unsigned int Editor::editorNumber ()
const
217 return myEditorNumber;
220 Editor *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 );
225 Document *KTextEditor::createDocument (
const char* libname, TQObject *parent,
const char *name )
227 return KParts::ComponentFactory::createPartInstanceFromLibrary<Document>( libname, 0, 0, parent, name );
230 Plugin *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.
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.
virtual class Document * document() const =0
Acess the parent Document.
KTextEditor is KDE's standard text editing KPart interface.