Kate
kateglobal.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries and the Kate part. 00002 * 00003 * Copyright (C) 2001-2010 Christoph Cullmann <cullmann@kde.org> 00004 * Copyright (C) 2009 Erlend Hamberg <ehamberg@gmail.com> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef __KATE_GLOBAL_H__ 00023 #define __KATE_GLOBAL_H__ 00024 00025 #include "katepartprivate_export.h" 00026 #include "katescript.h" 00027 00028 #include <ktexteditor/editor.h> 00029 00030 #include <kservice.h> 00031 #include <kcomponentdata.h> 00032 #include <kaboutdata.h> 00033 #include <ktexteditor/commandinterface.h> 00034 #include <ktexteditor/containerinterface.h> 00035 #include <ktexteditor/templateinterface2.h> 00036 #include <QtCore/QList> 00037 00038 class KateCmd; 00039 class KateModeManager; 00040 class KateSchemaManager; 00041 class KateGlobalConfig; 00042 class KateDocumentConfig; 00043 class KateViewConfig; 00044 class KateRendererConfig; 00045 class KateDocument; 00046 class KateRenderer; 00047 class KateView; 00048 class KateScriptManager; 00049 class KDirWatch; 00050 class KateHlManager; 00051 class KatePartPluginManager; 00052 class KateSpellCheckManager; 00053 class KateViGlobal; 00054 class KateWordCompletionModel; 00055 00056 namespace Kate { 00057 class Command; 00058 } 00059 00067 class KATEPART_TESTS_EXPORT KateGlobal : public KTextEditor::Editor, public KTextEditor::CommandInterface, public KTextEditor::ContainerInterface, public KTextEditor::TemplateScriptRegistrar 00068 { 00069 Q_OBJECT 00070 Q_INTERFACES(KTextEditor::CommandInterface) 00071 Q_INTERFACES(KTextEditor::ContainerInterface) 00072 Q_INTERFACES(KTextEditor::TemplateScriptRegistrar) 00073 00074 // for setDefaultEncoding 00075 friend class KateDocumentConfig; 00076 00077 private: 00081 KateGlobal (); 00082 00083 public: 00087 ~KateGlobal (); 00088 00094 KTextEditor::Document *createDocument ( QObject *parent ); 00095 00100 const QList<KTextEditor::Document*> &documents (); 00101 00105 public: 00110 const KAboutData* aboutData() const { return &m_aboutData; } 00111 00115 public: 00120 void readConfig (KConfig *config = 0); 00121 00126 void writeConfig (KConfig *config = 0); 00127 00132 bool configDialogSupported () const; 00133 00139 void configDialog (QWidget *parent); 00140 00147 int configPages () const; 00148 00154 KTextEditor::ConfigPage *configPage (int number, QWidget *parent); 00155 00156 QString configPageName (int number) const; 00157 00158 QString configPageFullName (int number) const; 00159 00160 KIcon configPageIcon (int number) const; 00161 00165 public: 00170 static KateGlobal *self (); 00171 00175 static void incRef () { ++s_ref; } 00176 00180 static void decRef () { if (s_ref > 0) --s_ref; if (s_ref == 0) { delete s_self; s_self = 0L; } } 00181 00186 static QString katePartVersion(); 00187 00192 const KComponentData &componentData() { return m_componentData; } 00193 00199 void registerDocument ( KateDocument *doc ); 00200 00205 void deregisterDocument ( KateDocument *doc ); 00206 00212 void registerView ( KateView *view ); 00213 00218 void deregisterView ( KateView *view ); 00219 00224 QList<KateDocument*> &kateDocuments () { return m_documents; } 00225 00230 QList<KateView*> &views () { return m_views; } 00231 00236 KatePartPluginManager *pluginManager () { return m_pluginManager; } 00237 00242 KDirWatch *dirWatch () { return m_dirWatch; } 00243 00249 KateModeManager *modeManager () { return m_modeManager; } 00250 00255 KateSchemaManager *schemaManager () { return m_schemaManager; } 00256 00261 KateDocumentConfig *documentConfig () { return m_documentConfig; } 00262 00267 KateViewConfig *viewConfig () { return m_viewConfig; } 00268 00273 KateRendererConfig *rendererConfig () { return m_rendererConfig; } 00274 00278 KateScriptManager *scriptManager () { return m_scriptManager; } 00279 00284 KateHlManager *hlManager () { return m_hlManager; } 00285 00290 KateCmd *cmdManager () { return m_cmdManager; } 00291 00296 KateViGlobal *viInputModeGlobal () { return m_viInputModeGlobal; } 00297 00302 KateSpellCheckManager *spellCheckManager () { return m_spellCheckManager; } 00303 00308 KateWordCompletionModel *wordCompletionModel () { return m_wordCompletionModel; } 00309 00316 bool registerCommand (KTextEditor::Command *cmd); 00317 00324 bool unregisterCommand (KTextEditor::Command *cmd); 00325 00331 KTextEditor::Command *queryCommand (const QString &cmd) const; 00332 00337 QList<KTextEditor::Command*> commands() const; 00338 00343 QStringList commandList() const; 00344 00345 00350 QObject * container(); 00351 00355 void setContainer( QObject * container ); 00356 00357 00362 KTextEditor::TemplateScript* registerTemplateScript (QObject* owner, const QString& script); 00363 void unregisterTemplateScript(KTextEditor::TemplateScript* templateScript); 00364 00365 00366 private: 00370 static KateGlobal *s_self; 00371 00375 static int s_ref; 00376 00380 KAboutData m_aboutData; 00381 00385 KComponentData m_componentData; 00386 00390 QList<KateDocument*> m_documents; 00391 00395 QList<KateView*> m_views; 00396 00400 KDirWatch *m_dirWatch; 00401 00405 KateModeManager *m_modeManager; 00406 00410 KateSchemaManager *m_schemaManager; 00411 00415 KatePartPluginManager *m_pluginManager; 00416 00420 KateGlobalConfig *m_globalConfig; 00421 00425 KateDocumentConfig *m_documentConfig; 00426 00430 KateViewConfig *m_viewConfig; 00431 00435 KateRendererConfig *m_rendererConfig; 00436 00440 QList<KTextEditor::Command *> m_cmds; 00441 00445 KateScriptManager *m_scriptManager; 00446 00450 KateHlManager *m_hlManager; 00451 00455 KateCmd *m_cmdManager; 00456 00460 KateViGlobal *m_viInputModeGlobal; 00461 00465 KateSpellCheckManager *m_spellCheckManager; 00466 00467 QList<KTextEditor::Document*> m_docs; 00468 00472 QPointer<QObject> m_container; 00473 00477 KateWordCompletionModel *m_wordCompletionModel; 00478 }; 00479 00480 #endif 00481 00482 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE 4.6 API Reference