• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • interfaces/tdetexteditor
 

interfaces/tdetexteditor

  • interfaces
  • tdetexteditor
tdetexteditor.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2001 Christoph Cullmann (cullmann@kde.org)
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#include <config.h>
21
22#include "document.h"
23#include "view.h"
24#include "plugin.h"
25#include "editor.h"
26
27#include <tdeaction.h>
28#include <tdeparts/factory.h>
29#include <tdeparts/componentfactory.h>
30
31#include "document.moc"
32#include "view.moc"
33#include "plugin.moc"
34#include "editor.moc"
35
36using namespace KTextEditor;
37
38namespace KTextEditor
39{
40 class PrivateDocument
41 {
42 public:
43 PrivateDocument ()
44 {
45 }
46
47 ~PrivateDocument()
48 {
49 }
50 };
51
52 class PrivateView
53 {
54 public:
55 PrivateView ()
56 {
57 }
58
59 ~PrivateView()
60 {
61 }
62 };
63
64 class PrivatePlugin
65 {
66 public:
67 PrivatePlugin ()
68 {
69 }
70
71 ~PrivatePlugin ()
72 {
73 }
74
75 class Document *m_doc;
76 };
77
78 class PrivatePluginViewInterface
79 {
80 public:
81 PrivatePluginViewInterface ()
82 {
83 }
84
85 ~PrivatePluginViewInterface ()
86 {
87 }
88 };
89
90 class PrivateEditor
91 {
92 public:
93 PrivateEditor ()
94 {
95 }
96
97 ~PrivateEditor()
98 {
99 }
100 };
101}
102
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;
108
109Document::Document( TQObject *parent, const char *name ) : KTextEditor::Editor (parent, name )
110{
111 globalDocumentNumber++;
112 myDocumentNumber = globalDocumentNumber;
113 myDocumentListPosition = -1; // Don't care
114}
115
116Document::~Document()
117{
118}
119
120unsigned int Document::documentNumber () const
121{
122 return myDocumentNumber;
123}
124
125long Document::documentListPosition () const
126{
127 return myDocumentListPosition;
128}
129
130void Document::setDocumentListPosition (long pos)
131{
132 myDocumentListPosition = pos;
133}
134
135TQCString Document::documentDCOPSuffix () const
136{
137 TQCString num;
138 num.setNum (documentNumber());
139
140 return num;
141}
142
143View::View( Document *, TQWidget *parent, const char *name ) : TQWidget( parent, name )
144{
145 globalViewNumber++;
146 myViewNumber = globalViewNumber;
147}
148
149View::~View()
150{
151}
152
153unsigned int View::viewNumber () const
154{
155 return myViewNumber;
156}
157
158TQCString View::viewDCOPSuffix () const
159{
160 TQCString num1, num2;
161 num1.setNum (viewNumber());
162 num2.setNum (document()->documentNumber());
163
164 return num2 + "-" + num1;
165}
166
167Plugin::Plugin( Document *document, const char *name ) : TQObject (document, name )
168{
169 globalPluginNumber++;
170 myPluginNumber = globalPluginNumber;
171 d = new PrivatePlugin ();
172 d->m_doc = document;
173}
174
175Plugin::~Plugin()
176{
177 delete d;
178}
179
180unsigned int Plugin::pluginNumber () const
181{
182 return myPluginNumber;
183}
184
185Document *Plugin::document () const
186{
187 return d->m_doc;
188}
189
190PluginViewInterface::PluginViewInterface()
191{
192 globalPluginViewInterfaceNumber++;
193 myPluginViewInterfaceNumber = globalPluginViewInterfaceNumber;
194}
195
196PluginViewInterface::~PluginViewInterface()
197{
198}
199
200unsigned int PluginViewInterface::pluginViewInterfaceNumber () const
201{
202 return myPluginViewInterfaceNumber;
203}
204
205Editor::Editor( TQObject *parent, const char *name ) : KParts::ReadWritePart( parent, name )
206{
207 globalEditorNumber++;
208 myEditorNumber = globalEditorNumber;
209}
210
211Editor::~Editor()
212{
213}
214
215unsigned int Editor::editorNumber () const
216{
217 return myEditorNumber;
218}
219
220Editor *KTextEditor::createEditor ( const char* libname, TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name )
221{
222 return KParts::ComponentFactory::createPartInstanceFromLibrary<Editor>( libname, parentWidget, widgetName, parent, name );
223}
224
225Document *KTextEditor::createDocument ( const char* libname, TQObject *parent, const char *name )
226{
227 return KParts::ComponentFactory::createPartInstanceFromLibrary<Document>( libname, 0, 0, parent, name );
228}
229
230Plugin *KTextEditor::createPlugin ( const char* libname, Document *document, const char *name )
231{
232 return KParts::ComponentFactory::createInstanceFromLibrary<Plugin>( libname, document, name );
233}
234
235PluginViewInterface *KTextEditor::pluginViewInterface (Plugin *plugin)
236{
237 if (!plugin)
238 return 0;
239
240 return dynamic_cast<KTextEditor::PluginViewInterface*>(plugin);
241}
242
KTextEditor::Document
The main class representing a text document.
Definition: document.h:32
KTextEditor::Document::documentListPosition
long documentListPosition() const
Returns the list position of this document in your app, if applicable.
Definition: tdetexteditor.cpp:125
KTextEditor::Document::setDocumentListPosition
void setDocumentListPosition(long pos)
Sets the list position of this document in your app, if applicable.
Definition: tdetexteditor.cpp:130
KTextEditor::Document::documentDCOPSuffix
TQCString documentDCOPSuffix() const
Returns this document's DCOP suffix for identifiying its DCOP interface.
Definition: tdetexteditor.cpp:135
KTextEditor::Document::documentNumber
unsigned int documentNumber() const
Returns the global number of this document in your app.
Definition: tdetexteditor.cpp:120
KTextEditor::Editor
This is a simplfied version of the Document & View classes Usage: Load it, merge it's gui + be happy ...
Definition: editor.h:40
KTextEditor::Editor::Editor
Editor(TQObject *parent=0, const char *name=0)
Create a new editor widget.
Definition: tdetexteditor.cpp:205
KTextEditor::PluginViewInterface
View plugin class.
Definition: plugin.h:63
KTextEditor::Plugin
Basic KTextEditor plugin class.
Definition: plugin.h:37
KTextEditor::View::document
virtual class Document * document() const =0
Acess the parent Document.
KTextEditor::View::View
View(class Document *, TQWidget *parent, const char *name=0)
Create a new view to the given document.
Definition: tdetexteditor.cpp:143
KTextEditor::View::viewNumber
unsigned int viewNumber() const
Returns the number of this view.
Definition: tdetexteditor.cpp:153
KTextEditor::View::viewDCOPSuffix
TQCString viewDCOPSuffix() const
Returns the DCOP suffix to allow identification of this view's DCOP interface.
Definition: tdetexteditor.cpp:158
KTextEditor
KTextEditor is KDE's standard text editing KPart interface.
Definition: blockselectiondcopinterface.h:10

interfaces/tdetexteditor

Skip menu "interfaces/tdetexteditor"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

interfaces/tdetexteditor

Skip menu "interfaces/tdetexteditor"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for interfaces/tdetexteditor by doxygen 1.9.4
This website is maintained by Timothy Pearson.