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

interfaces

  • interfaces
  • ktexteditor
ktexteditor.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 <kaction.h>
28 #include <kparts/factory.h>
29 #include <kparts/componentfactory.h>
30 
31 #include "document.moc"
32 #include "view.moc"
33 #include "plugin.moc"
34 #include "editor.moc"
35 
36 using namespace KTextEditor;
37 
38 namespace 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 
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;
108 
109 Document::Document( TQObject *parent, const char *name ) : KTextEditor::Editor (parent, name )
110 {
111  globalDocumentNumber++;
112  myDocumentNumber = globalDocumentNumber;
113 }
114 
115 Document::~Document()
116 {
117 }
118 
119 unsigned int Document::documentNumber () const
120 {
121  return myDocumentNumber;
122 }
123 
124 TQCString Document::documentDCOPSuffix () const
125 {
126  TQCString num;
127  num.setNum (documentNumber());
128 
129  return num;
130 }
131 
132 View::View( Document *, TQWidget *parent, const char *name ) : TQWidget( parent, name )
133 {
134  globalViewNumber++;
135  myViewNumber = globalViewNumber;
136 }
137 
138 View::~View()
139 {
140 }
141 
142 unsigned int View::viewNumber () const
143 {
144  return myViewNumber;
145 }
146 
147 TQCString View::viewDCOPSuffix () const
148 {
149  TQCString num1, num2;
150  num1.setNum (viewNumber());
151  num2.setNum (document()->documentNumber());
152 
153  return num2 + "-" + num1;
154 }
155 
156 Plugin::Plugin( Document *document, const char *name ) : TQObject (document, name )
157 {
158  globalPluginNumber++;
159  myPluginNumber = globalPluginNumber;
160  d = new PrivatePlugin ();
161  d->m_doc = document;
162 }
163 
164 Plugin::~Plugin()
165 {
166  delete d;
167 }
168 
169 unsigned int Plugin::pluginNumber () const
170 {
171  return myPluginNumber;
172 }
173 
174 Document *Plugin::document () const
175 {
176  return d->m_doc;
177 }
178 
179 PluginViewInterface::PluginViewInterface()
180 {
181  globalPluginViewInterfaceNumber++;
182  myPluginViewInterfaceNumber = globalPluginViewInterfaceNumber;
183 }
184 
185 PluginViewInterface::~PluginViewInterface()
186 {
187 }
188 
189 unsigned int PluginViewInterface::pluginViewInterfaceNumber () const
190 {
191  return myPluginViewInterfaceNumber;
192 }
193 
194 Editor::Editor( TQObject *parent, const char *name ) : KParts::ReadWritePart( parent, name )
195 {
196  globalEditorNumber++;
197  myEditorNumber = globalEditorNumber;
198 }
199 
200 Editor::~Editor()
201 {
202 }
203 
204 unsigned int Editor::editorNumber () const
205 {
206  return myEditorNumber;
207 }
208 
209 Editor *KTextEditor::createEditor ( const char* libname, TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name )
210 {
211  return KParts::ComponentFactory::createPartInstanceFromLibrary<Editor>( libname, parentWidget, widgetName, parent, name );
212 }
213 
214 Document *KTextEditor::createDocument ( const char* libname, TQObject *parent, const char *name )
215 {
216  return KParts::ComponentFactory::createPartInstanceFromLibrary<Document>( libname, 0, 0, parent, name );
217 }
218 
219 Plugin *KTextEditor::createPlugin ( const char* libname, Document *document, const char *name )
220 {
221  return KParts::ComponentFactory::createInstanceFromLibrary<Plugin>( libname, document, name );
222 }
223 
224 PluginViewInterface *KTextEditor::pluginViewInterface (Plugin *plugin)
225 {
226  if (!plugin)
227  return 0;
228 
229  return dynamic_cast<KTextEditor::PluginViewInterface*>(plugin);
230 }
231 
KParts
KTextEditor::View::viewDCOPSuffix
TQCString viewDCOPSuffix() const
Returns the DCOP suffix to allow identification of this view's DCOP interface.
Definition: ktexteditor.cpp:147
KTextEditor::Editor::Editor
Editor(TQObject *parent=0, const char *name=0)
Create a new editor widget.
Definition: ktexteditor.cpp:194
KTextEditor::View::View
View(class Document *, TQWidget *parent, const char *name=0)
Create a new view to the given document.
Definition: ktexteditor.cpp:132
KTextEditor::Document
The main class representing a text document.
Definition: document.h:31
KTextEditor
KTextEditor is KDE's standard text editing KPart interface.
Definition: blockselectiondcopinterface.h:9
KTextEditor::View::document
virtual class Document * document() const =0
Acess the parent Document.
KTextEditor::Plugin
Basic KTextEditor plugin class.
Definition: plugin.h:36
KTextEditor::Document::documentDCOPSuffix
TQCString documentDCOPSuffix() const
Returns this document's DCOP suffix for identifiying its DCOP interface.
Definition: ktexteditor.cpp:124
KTextEditor::View::viewNumber
unsigned int viewNumber() const
Returns the number of this view.
Definition: ktexteditor.cpp:142
KTextEditor::Document::documentNumber
unsigned int documentNumber() const
Returns the global number of this document in your app.
Definition: ktexteditor.cpp:119
KTextEditor::Editor
This is a simplfied version of the Document & View classes Usage: Load it, merge it's gui + be happy Exte...
Definition: editor.h:39
KTextEditor::PluginViewInterface
View plugin class.
Definition: plugin.h:62

interfaces

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

interfaces

Skip menu "interfaces"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for interfaces by doxygen 1.8.8
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |