28 #include <kparts/factory.h> 29 #include <kparts/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;
115 Document::~Document()
121 return myDocumentNumber;
127 num.setNum (documentNumber());
135 myViewNumber = globalViewNumber;
149 TQCString num1, num2;
151 num2.setNum (
document()->documentNumber());
153 return num2 +
"-" + num1;
156 Plugin::Plugin(
Document *
document,
const char *name ) : TQObject (document, name )
158 globalPluginNumber++;
159 myPluginNumber = globalPluginNumber;
160 d =
new PrivatePlugin ();
169 unsigned int Plugin::pluginNumber ()
const 171 return myPluginNumber;
179 PluginViewInterface::PluginViewInterface()
181 globalPluginViewInterfaceNumber++;
182 myPluginViewInterfaceNumber = globalPluginViewInterfaceNumber;
185 PluginViewInterface::~PluginViewInterface()
189 unsigned int PluginViewInterface::pluginViewInterfaceNumber ()
const 191 return myPluginViewInterfaceNumber;
194 Editor::Editor( TQObject *parent,
const char *name ) : KParts::ReadWritePart( parent, name )
196 globalEditorNumber++;
197 myEditorNumber = globalEditorNumber;
204 unsigned int Editor::editorNumber ()
const 206 return myEditorNumber;
209 Editor *KTextEditor::createEditor (
const char* libname, TQWidget *parentWidget,
const char *widgetName, TQObject *parent,
const char *name )
211 return KParts::ComponentFactory::createPartInstanceFromLibrary<Editor>( libname, parentWidget, widgetName, parent, name );
214 Document *KTextEditor::createDocument (
const char* libname, TQObject *parent,
const char *name )
216 return KParts::ComponentFactory::createPartInstanceFromLibrary<Document>( libname, 0, 0, parent, name );
219 Plugin *KTextEditor::createPlugin (
const char* libname,
Document *document,
const char *name )
221 return KParts::ComponentFactory::createInstanceFromLibrary<Plugin>( libname, document, name );
unsigned int viewNumber() const
Returns the number of this view.
Editor(TQObject *parent=0, const char *name=0)
Create a new editor widget.
TQCString documentDCOPSuffix() const
Returns this document's DCOP suffix for identifiying its DCOP interface.
View(class Document *, TQWidget *parent, const char *name=0)
Create a new view to the given document.
The main class representing a text document.
KTextEditor is KDE's standard text editing KPart interface.
TQCString viewDCOPSuffix() const
Returns the DCOP suffix to allow identification of this view's DCOP interface.
unsigned int documentNumber() const
Returns the global number of this document in your app.
virtual class Document * document() const =0
Acess the parent Document.
Basic KTextEditor plugin class.
This is a simplfied version of the Document & View classes Usage: Load it, merge it's gui + be happy Exte...