diff options
Diffstat (limited to 'kate/interfaces')
-rw-r--r-- | kate/interfaces/Makefile.am | 14 | ||||
-rw-r--r-- | kate/interfaces/application.cpp | 97 | ||||
-rw-r--r-- | kate/interfaces/application.h | 79 | ||||
-rw-r--r-- | kate/interfaces/documentmanager.cpp | 120 | ||||
-rw-r--r-- | kate/interfaces/documentmanager.h | 111 | ||||
-rw-r--r-- | kate/interfaces/mainwindow.cpp | 82 | ||||
-rw-r--r-- | kate/interfaces/mainwindow.h | 65 | ||||
-rw-r--r-- | kate/interfaces/plugin.cpp | 106 | ||||
-rw-r--r-- | kate/interfaces/plugin.h | 87 | ||||
-rw-r--r-- | kate/interfaces/pluginconfiginterface.cpp | 63 | ||||
-rw-r--r-- | kate/interfaces/pluginconfiginterface.h | 63 | ||||
-rw-r--r-- | kate/interfaces/pluginconfiginterfaceextension.cpp | 68 | ||||
-rw-r--r-- | kate/interfaces/pluginconfiginterfaceextension.h | 104 | ||||
-rw-r--r-- | kate/interfaces/pluginmanager.cpp | 78 | ||||
-rw-r--r-- | kate/interfaces/pluginmanager.h | 70 | ||||
-rw-r--r-- | kate/interfaces/toolviewmanager.cpp | 85 | ||||
-rw-r--r-- | kate/interfaces/toolviewmanager.h | 96 | ||||
-rw-r--r-- | kate/interfaces/viewmanager.cpp | 73 | ||||
-rw-r--r-- | kate/interfaces/viewmanager.h | 89 |
19 files changed, 1550 insertions, 0 deletions
diff --git a/kate/interfaces/Makefile.am b/kate/interfaces/Makefile.am new file mode 100644 index 000000000..1cace79c8 --- /dev/null +++ b/kate/interfaces/Makefile.am @@ -0,0 +1,14 @@ +METASOURCES = AUTO + +noinst_LTLIBRARIES = libkateinterfacesprivate.la + +libkateinterfacesprivate_la_SOURCES = application.cpp mainwindow.cpp documentmanager.cpp viewmanager.cpp toolviewmanager.cpp \ + pluginmanager.cpp plugin.cpp pluginconfiginterface.cpp pluginconfiginterfaceextension.cpp + +libkateinterfacesprivate_la_LIBADD = -lkatepartinterfaces +libkateinterfacesprivate_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) + +kateinclude_HEADERS = application.h documentmanager.h mainwindow.h plugin.h viewmanager.h pluginconfiginterface.h pluginconfiginterfaceextension.h toolviewmanager.h pluginmanager.h +kateincludedir = $(includedir)/kate + +INCLUDES= $(all_includes) diff --git a/kate/interfaces/application.cpp b/kate/interfaces/application.cpp new file mode 100644 index 000000000..160c460c8 --- /dev/null +++ b/kate/interfaces/application.cpp @@ -0,0 +1,97 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "application.h" +#include "application.moc" + +#include "documentmanager.h" +#include "mainwindow.h" +#include "pluginmanager.h" + +#include "../app/kateapp.h" +#include "../app/katedocmanager.h" +#include "../app/katepluginmanager.h" +#include "../app/katemainwindow.h" + +namespace Kate +{ + +class PrivateApplication + { + public: + PrivateApplication () + { + } + + ~PrivateApplication () + { + + } + + KateApp *app; + }; + +Application::Application (void *application) : QObject ((KateApp *) application) +{ + d = new PrivateApplication; + d->app = (KateApp *) application; +} + +Application::~Application () +{ + delete d; +} + +DocumentManager *Application::documentManager () +{ + return d->app->documentManager ()->documentManager (); +} + +PluginManager *Application::pluginManager () +{ + return d->app->pluginManager ()->pluginManager (); +} + +MainWindow *Application::activeMainWindow () +{ + if (!d->app->activeMainWindow()) + return 0; + + return d->app->activeMainWindow()->mainWindow(); +} + +uint Application::mainWindows () +{ + return d->app->mainWindows (); +} + +MainWindow *Application::mainWindow (uint n) +{ + if (n < mainWindows ()) + return d->app->mainWindow (n)->mainWindow(); + + return 0; +} + +Application *application () +{ + return KateApp::self()->application (); +} + +} + diff --git a/kate/interfaces/application.h b/kate/interfaces/application.h new file mode 100644 index 000000000..6f576a311 --- /dev/null +++ b/kate/interfaces/application.h @@ -0,0 +1,79 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KATE_APPLICATION_INCLUDE_ +#define _KATE_APPLICATION_INCLUDE_ + +#include <qobject.h> +#include <kurl.h> + +namespace Kate +{ + +class DocumentManager; +class PluginManager; +class InitPluginManager; +class MainWindow; + +/** + * Interface to the application, beside some global methodes to access + * other objects like document/projectmanager, ... no way goes around this + * central interface + */ +class KDE_EXPORT Application : public QObject +{ + friend class PrivateApplication; + + Q_OBJECT + + public: + /** + * Construtor, should not interest, internal usage + */ + Application (void *application); + + /** + * Desctructor + */ + virtual ~Application (); + + public: + /** Returns a pointer to the document manager + */ + Kate::DocumentManager *documentManager (); + + Kate::PluginManager *pluginManager (); + + Kate::MainWindow *activeMainWindow (); + + uint mainWindows (); + Kate::MainWindow *mainWindow (uint n = 0); + + private: + class PrivateApplication *d; +}; + +/** + * Returns the application object + * @return Application application object + */ +KDE_EXPORT Application *application (); + +} + +#endif diff --git a/kate/interfaces/documentmanager.cpp b/kate/interfaces/documentmanager.cpp new file mode 100644 index 000000000..1b8292290 --- /dev/null +++ b/kate/interfaces/documentmanager.cpp @@ -0,0 +1,120 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "documentmanager.h" +#include "documentmanager.moc" + +#include "plugin.h" +#include "viewmanager.h" +#include "toolviewmanager.h" +#include "pluginmanager.h" + +#include "application.h" + +#include "../app/katedocmanager.h" + +namespace Kate +{ + +class PrivateDocumentManager + { + public: + PrivateDocumentManager () + { + } + + ~PrivateDocumentManager () + { + } + + KateDocManager *docMan; + }; + +DocumentManager::DocumentManager (void *documentManager) : QObject ((KateDocManager*) documentManager) +{ + d = new PrivateDocumentManager (); + d->docMan = (KateDocManager*) documentManager; +} + +DocumentManager::~DocumentManager () +{ + delete d; +} + +Document *DocumentManager::document (uint n) +{ + return d->docMan->document (n); +} + +Document *DocumentManager::activeDocument () +{ + return d->docMan->activeDocument (); +} + +Document *DocumentManager::documentWithID (uint id) +{ + return d->docMan->documentWithID (id); +} + +int DocumentManager::findDocument (const KURL &url) +{ + return d->docMan->findDocument (url); +} + +bool DocumentManager::isOpen (const KURL &url) +{ + return d->docMan->isOpen (url); +} + +uint DocumentManager::documents () +{ + return d->docMan->documents (); +} + +Document *DocumentManager::openURL(const KURL&url,const QString &encoding,uint *id) +{ + return d->docMan->openURL (url, encoding, id); +} + +bool DocumentManager::closeDocument(Document *document) +{ + return d->docMan->closeDocument (document); +} + +bool DocumentManager::closeDocument(uint n) +{ + return d->docMan->closeDocument (n); +} + +bool DocumentManager::closeDocumentWithID(uint id) +{ + return d->docMan->closeDocument (id); +} + +bool DocumentManager::closeAllDocuments() +{ + return d->docMan->closeAllDocuments (); +} + +DocumentManager *documentManager () +{ + return application()->documentManager (); +} + +} + diff --git a/kate/interfaces/documentmanager.h b/kate/interfaces/documentmanager.h new file mode 100644 index 000000000..82a714aa6 --- /dev/null +++ b/kate/interfaces/documentmanager.h @@ -0,0 +1,111 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KATE_DOCMANAGER_INCLUDE_ +#define _KATE_DOCMANAGER_INCLUDE_ + +#include <qobject.h> +#include <kurl.h> + +namespace Kate +{ +/** This interface provides access to the Kate Document Manager. +*/ +class KDE_EXPORT DocumentManager : public QObject +{ + friend class PrivateDocumentManager; + + Q_OBJECT + + public: + DocumentManager ( void *documentManager ); + virtual ~DocumentManager (); + + public: + /** Returns a pointer to the document indexed by n in the managers internal list. + */ + class Document *document (uint n = 0); + /** Returns a pointer to the currently active document or NULL if no document is open. + */ + class Document *activeDocument (); + /** Returns a pointer to the document with the given ID or NULL if no such document exists. + */ + class Document *documentWithID (uint id); + + /** Returns the ID of the document located at url if such a document is known by the manager. + */ + int findDocument (const KURL &url); + /** Returns true if the document located at url is open, otherwise false. + */ + bool isOpen (const KURL &url); + + /** returns the number of documents managed by this manager. + */ + uint documents (); + + /** open a document and return a pointer to the document, if you specify a pointer != 0 to the id parameter + * you will get the document id returned too + */ + class Document *openURL(const KURL&url,const QString &encoding=QString::null,uint *id =0); + /** close a document by pointer + */ + bool closeDocument(class Document *document); + /** close a document identified by the index + */ + bool closeDocument(uint n = 0); + /** close a document identified by the ID + */ + bool closeDocumentWithID(uint id); + /** close all documents + */ + bool closeAllDocuments(); + + #undef signals + #define signals public + signals: + #undef signals + #define signals protected + + /** + * emitted if the current doc changes (there need not to be a active document) + */ + void documentChanged (); + + /** + * this document has now been created + */ + void documentCreated (Kate::Document *document); + + /** + * the document with this number was deleted + */ + void documentDeleted (uint documentNumber); + + private: + class PrivateDocumentManager *d; +}; + +/** + * Returns the document manager object + * @return DocumentManager document manager object + */ +KDE_EXPORT DocumentManager *documentManager (); + +} + +#endif diff --git a/kate/interfaces/mainwindow.cpp b/kate/interfaces/mainwindow.cpp new file mode 100644 index 000000000..ad563d6ab --- /dev/null +++ b/kate/interfaces/mainwindow.cpp @@ -0,0 +1,82 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "mainwindow.h" +#include "mainwindow.moc" + +#include "documentmanager.h" +#include "plugin.h" +#include "viewmanager.h" +#include "toolviewmanager.h" +#include "pluginmanager.h" + +#include "../app/katemainwindow.h" +#include "../app/kateviewmanager.h" + +namespace Kate +{ + +class PrivateMainWindow + { + public: + PrivateMainWindow () + { + } + + ~PrivateMainWindow () + { + + } + + KateMainWindow *win; + }; + +MainWindow::MainWindow (void *mainWindow) : QObject ((KateMainWindow*) mainWindow) +{ + d = new PrivateMainWindow; + d->win = (KateMainWindow*) mainWindow; +} + +MainWindow::~MainWindow () +{ + delete d; +} + +KXMLGUIFactory *MainWindow::guiFactory() const +{ + return d->win->guiFactory(); +} + +ViewManager *MainWindow::viewManager () const +{ + return d->win->viewManager ()->viewManager (); +} + +class QWidget *MainWindow::centralWidget() const +{ + return d->win->centralWidget(); +} + +ToolViewManager *MainWindow::toolViewManager () const +{ + return d->win->toolViewManager (); +} + +} + +// kate: space-indent on; indent-width 2; replace-tabs on; diff --git a/kate/interfaces/mainwindow.h b/kate/interfaces/mainwindow.h new file mode 100644 index 000000000..19d5170cb --- /dev/null +++ b/kate/interfaces/mainwindow.h @@ -0,0 +1,65 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KATE_MAINWINDOW_INCLUDE_ +#define _KATE_MAINWINDOW_INCLUDE_ + +#include <qobject.h> + +#include <kxmlguifactory.h> +#include <kurl.h> + +namespace Kate +{ + +class ViewManager; + +class KDE_EXPORT MainWindow : public QObject +{ + friend class PrivateMainWindow; + + Q_OBJECT + + public: + MainWindow (void *mainWindow); + virtual ~MainWindow (); + + public: /*these are slots for kjs*/ + KXMLGUIFactory *guiFactory() const; + + public slots: + Kate::ViewManager *viewManager () const; + + public : + /** + * Access the widget (in the middle of the 4 sidebars) in which the editor + * component and the KateTabBar are embedded. This widget is a QVBox, so + * other child widgets can be embedded unter the editor widget. + */ + class QWidget *centralWidget() const; + class ToolViewManager *toolViewManager() const; + + private: + class PrivateMainWindow *d; +}; + +} + +#endif + +// kate: space-indent on; indent-width 2; replace-tabs on; diff --git a/kate/interfaces/plugin.cpp b/kate/interfaces/plugin.cpp new file mode 100644 index 000000000..3a540440f --- /dev/null +++ b/kate/interfaces/plugin.cpp @@ -0,0 +1,106 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + #include "application.h" + +#include "plugin.h" +#include "plugin.moc" + +#include <kparts/componentfactory.h> + +namespace Kate +{ + + class PrivatePlugin + { + public: + PrivatePlugin () + { + } + + ~PrivatePlugin () + { + } + }; + + class PrivatePluginViewInterface + { + public: + PrivatePluginViewInterface () + { + } + + ~PrivatePluginViewInterface () + { + } + + }; + +unsigned int Plugin::globalPluginNumber = 0; +unsigned int PluginViewInterface::globalPluginViewInterfaceNumber = 0; + +Plugin::Plugin( Application *application, const char *name ) : QObject (application, name ) +{ + globalPluginNumber++; + myPluginNumber = globalPluginNumber; +} + +Plugin::~Plugin() +{ +} + +unsigned int Plugin::pluginNumber () const +{ + return myPluginNumber; +} + +Application *Plugin::application () const +{ + return Kate::application(); +} + +PluginViewInterface::PluginViewInterface() +{ + globalPluginViewInterfaceNumber++; + myPluginViewInterfaceNumber = globalPluginViewInterfaceNumber; +} + +PluginViewInterface::~PluginViewInterface() +{ +} + +unsigned int PluginViewInterface::pluginViewInterfaceNumber () const +{ + return myPluginViewInterfaceNumber; +} + +Plugin *createPlugin ( const char* libname, Application *application, const char *name, const QStringList &args ) +{ + return KParts::ComponentFactory::createInstanceFromLibrary<Plugin>( libname, application, name, args); +} + +PluginViewInterface *pluginViewInterface (Plugin *plugin) +{ + if (!plugin) + return 0; + + return static_cast<PluginViewInterface*>(plugin->qt_cast("Kate::PluginViewInterface")); +} + +} + diff --git a/kate/interfaces/plugin.h b/kate/interfaces/plugin.h new file mode 100644 index 000000000..57bddae71 --- /dev/null +++ b/kate/interfaces/plugin.h @@ -0,0 +1,87 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + Copyright (C) 2002 Joseph Wenninger <jowenn@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KATE_PLUGIN_INCLUDE_ +#define _KATE_PLUGIN_INCLUDE_ + +#include <qwidget.h> +#include <qpixmap.h> +#include <kicontheme.h> + +#include <kurl.h> + +namespace Kate +{ + +class Application; +class MainWindow; + +class KDE_EXPORT Plugin : public QObject +{ + friend class PrivatePlugin; + + Q_OBJECT + + public: + Plugin (Application *application = 0, const char *name = 0 ); + virtual ~Plugin (); + + unsigned int pluginNumber () const; + + Application *application() const; + + private: + class PrivatePlugin *d; + static unsigned int globalPluginNumber; + unsigned int myPluginNumber; +}; + +KDE_EXPORT Plugin *createPlugin ( const char* libname, Application *application = 0, const char *name = 0,const QStringList &args = QStringList() ); + +/* + * view plugin class + * this plugin will be bound to a ktexteditor::view + */ +class KDE_EXPORT PluginViewInterface +{ + friend class PrivatePluginViewInterface; + + public: + PluginViewInterface (); + virtual ~PluginViewInterface (); + + unsigned int pluginViewInterfaceNumber () const; + + /* + * will be called from the part to bound the plugin to a view + */ + virtual void addView (MainWindow *) = 0; + virtual void removeView (MainWindow *) = 0; + + private: + class PrivatePluginViewInterface *d; + static unsigned int globalPluginViewInterfaceNumber; + unsigned int myPluginViewInterfaceNumber; +}; + +KDE_EXPORT PluginViewInterface *pluginViewInterface (Plugin *plugin); + +} + +#endif diff --git a/kate/interfaces/pluginconfiginterface.cpp b/kate/interfaces/pluginconfiginterface.cpp new file mode 100644 index 000000000..594b73e5d --- /dev/null +++ b/kate/interfaces/pluginconfiginterface.cpp @@ -0,0 +1,63 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "pluginconfiginterface.h" + +#include "plugin.h" + +namespace Kate +{ + +class PrivatePluginConfigInterface +{ + public: + PrivatePluginConfigInterface() {} + ~PrivatePluginConfigInterface() {} +}; + +} + +using namespace Kate; + +unsigned int PluginConfigInterface::globalPluginConfigInterfaceNumber = 0; + +PluginConfigInterface::PluginConfigInterface() +{ + globalPluginConfigInterfaceNumber++; + myPluginConfigInterfaceNumber = globalPluginConfigInterfaceNumber++; + + d = new PrivatePluginConfigInterface(); +} + +PluginConfigInterface::~PluginConfigInterface() +{ + delete d; +} + +unsigned int PluginConfigInterface::pluginConfigInterfaceNumber () const +{ + return myPluginConfigInterfaceNumber; +} + +PluginConfigInterface *Kate::pluginConfigInterface (Plugin *plugin) +{ + if (!plugin) + return 0; + + return static_cast<PluginConfigInterface*>(plugin->qt_cast("Kate::PluginConfigInterface")); +} diff --git a/kate/interfaces/pluginconfiginterface.h b/kate/interfaces/pluginconfiginterface.h new file mode 100644 index 000000000..f626b1cde --- /dev/null +++ b/kate/interfaces/pluginconfiginterface.h @@ -0,0 +1,63 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __kate_pluginconfiginterface_h__ +#define __kate_pluginconfiginterface_h__ + +#include <kdemacros.h> + +namespace Kate +{ + +/* +* This is an interface for the KTextEditor::Document/Plugin/ViewPlugin classes !!! +*/ +class KDE_EXPORT PluginConfigInterface +{ + friend class PrivatePluginConfigInterface; + + public: + PluginConfigInterface(); + virtual ~PluginConfigInterface(); + + unsigned int pluginConfigInterfaceNumber () const; + + // + // slots !!! + // + public: + /** + Read/Write the config to the standard place where this editor + part saves it config, say: read/save default values for that + editor part + */ + virtual void readConfig () = 0; + virtual void writeConfig () = 0; + + private: + class PrivatePluginConfigInterface *d; + static unsigned int globalPluginConfigInterfaceNumber; + unsigned int myPluginConfigInterfaceNumber; +}; + +class Plugin; +KDE_EXPORT PluginConfigInterface *pluginConfigInterface (Plugin *plugin); + +} + +#endif diff --git a/kate/interfaces/pluginconfiginterfaceextension.cpp b/kate/interfaces/pluginconfiginterfaceextension.cpp new file mode 100644 index 000000000..99cb824bd --- /dev/null +++ b/kate/interfaces/pluginconfiginterfaceextension.cpp @@ -0,0 +1,68 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "pluginconfiginterfaceextension.h" +#include "pluginconfiginterfaceextension.moc" + +#include "plugin.h" + +namespace Kate +{ + +class PrivatePluginConfigInterfaceExtension +{ + public: + PrivatePluginConfigInterfaceExtension() {} + ~PrivatePluginConfigInterfaceExtension() {} +}; + +} + +using namespace Kate; + +PluginConfigPage::PluginConfigPage ( QWidget *parent, const char *name ) : QWidget (parent, name) { } + +PluginConfigPage::~PluginConfigPage () { } + +unsigned int PluginConfigInterfaceExtension::globalPluginConfigInterfaceExtensionNumber = 0; + +PluginConfigInterfaceExtension::PluginConfigInterfaceExtension() +{ + globalPluginConfigInterfaceExtensionNumber++; + myPluginConfigInterfaceExtensionNumber = globalPluginConfigInterfaceExtensionNumber++; + + d = new PrivatePluginConfigInterfaceExtension(); +} + +PluginConfigInterfaceExtension::~PluginConfigInterfaceExtension() +{ + delete d; +} + +unsigned int PluginConfigInterfaceExtension::pluginConfigInterfaceExtensionNumber () const +{ + return myPluginConfigInterfaceExtensionNumber; +} + +PluginConfigInterfaceExtension *Kate::pluginConfigInterfaceExtension (Plugin *plugin) +{ + if (!plugin) + return 0; + + return static_cast<PluginConfigInterfaceExtension*>(plugin->qt_cast("Kate::PluginConfigInterfaceExtension")); +} diff --git a/kate/interfaces/pluginconfiginterfaceextension.h b/kate/interfaces/pluginconfiginterfaceextension.h new file mode 100644 index 000000000..4c4169179 --- /dev/null +++ b/kate/interfaces/pluginconfiginterfaceextension.h @@ -0,0 +1,104 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __kate_pluginconfiginterfaceextension_h__ +#define __kate_pluginconfiginterfaceextension_h__ + +#include <qwidget.h> +#include <qpixmap.h> +#include <kicontheme.h> + +namespace Kate +{ + +class KDE_EXPORT PluginConfigPage : public QWidget +{ + Q_OBJECT + + public: + PluginConfigPage ( QWidget *parent=0, const char *name=0 ); + virtual ~PluginConfigPage (); + + // + // slots !!! + // + public: + /** + Applies the changes to the document + */ + virtual void apply () = 0; + + /** + Reset the changes + */ + virtual void reset () = 0; + + /** + Sets default options + */ + virtual void defaults () = 0; + + signals: + void changed(); +}; + +/* +* This is an interface for the KTextEditor::Document/Plugin/ViewPlugin classes !!! +*/ +class KDE_EXPORT PluginConfigInterfaceExtension +{ + friend class PrivatePluginConfigInterfaceExtension; + + public: + PluginConfigInterfaceExtension(); + virtual ~PluginConfigInterfaceExtension(); + + unsigned int pluginConfigInterfaceExtensionNumber () const; + + // + // slots !!! + // + public: + /** + Number of available config pages + */ + virtual uint configPages () const = 0; + + /** + returns config page with the given number, + config pages from 0 to configPages()-1 are available + if configPages() > 0 + */ + virtual PluginConfigPage *configPage (uint number = 0, QWidget *parent = 0, const char *name=0 ) = 0; + + virtual QString configPageName (uint number = 0) const = 0; + virtual QString configPageFullName (uint number = 0) const = 0; + virtual QPixmap configPagePixmap (uint number = 0, int size = KIcon::SizeSmall) const = 0; + + private: + class PrivatePluginConfigInterfaceExtension *d; + static unsigned int globalPluginConfigInterfaceExtensionNumber; + unsigned int myPluginConfigInterfaceExtensionNumber; +}; + +class Plugin; +KDE_EXPORT PluginConfigInterfaceExtension *pluginConfigInterfaceExtension (Plugin *plugin); + +} + +#endif diff --git a/kate/interfaces/pluginmanager.cpp b/kate/interfaces/pluginmanager.cpp new file mode 100644 index 000000000..2ea7c54b5 --- /dev/null +++ b/kate/interfaces/pluginmanager.cpp @@ -0,0 +1,78 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "pluginmanager.moc" + +#include "plugin.h" +#include "documentmanager.h" +#include "toolviewmanager.h" +#include "pluginmanager.h" + +#include "../app/katepluginmanager.h" +#include "../app/kateapp.h" + +namespace Kate +{ + +class PrivatePluginManager + { + public: + PrivatePluginManager () + { + } + + ~PrivatePluginManager () + { + } + + KatePluginManager *pluginMan; + }; + +PluginManager::PluginManager (void *pluginManager) : QObject ((KatePluginManager*) pluginManager) +{ + d = new PrivatePluginManager (); + d->pluginMan = (KatePluginManager*) pluginManager; +} + +PluginManager::~PluginManager () +{ + delete d; +} + +Plugin *PluginManager::plugin(const QString &name) +{ + return d->pluginMan->plugin(name); +} + +bool PluginManager::pluginAvailable(const QString &name) +{ + return d->pluginMan->pluginAvailable (name); +} + +Plugin *PluginManager::loadPlugin(const QString &name,bool permanent) +{ + return d->pluginMan->loadPlugin (name, permanent); +} + +void PluginManager::unloadPlugin(const QString &name,bool permanent) +{ + d->pluginMan->unloadPlugin (name, permanent); +} + +} + diff --git a/kate/interfaces/pluginmanager.h b/kate/interfaces/pluginmanager.h new file mode 100644 index 000000000..53279fd94 --- /dev/null +++ b/kate/interfaces/pluginmanager.h @@ -0,0 +1,70 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + Copyright (C) 2002 Joseph Wenninger <jowenn@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KATE_PLUGINMANAGER_INCLUDE_ +#define _KATE_PLUGINMANAGER_INCLUDE_ + +#include <qobject.h> +#include <kurl.h> + +namespace Kate +{ +/** This interface provides access to the Kate Plugin Manager. +*/ +class KDE_EXPORT PluginManager : public QObject +{ + friend class PrivatePluginManager; + + Q_OBJECT + + public: + PluginManager ( void *pluginManager ); + virtual ~PluginManager (); + + public: + /** if the plugin with the library name "name" is loaded, a pointer to that plugin is returned */ + class Plugin *plugin(const QString &name); + + /** return true, if plugin is known to kate (either loaded or not loaded) + * + * This method is not used yet + */ + bool pluginAvailable(const QString &name); + + /** tries loading the specified plugin and returns a pointer to the new plugin or 0 + * if permanent is true (default value) the plugin will be loaded at the next kate startup + * + * This method is not used yet + */ + class Plugin *loadPlugin(const QString &name,bool permanent=true); + + /** unload the specified plugin. If the value permanent is true (default value), the plugin will not be + * loaded on kate's next startup. Even if it had been loaded with permanent=true. + * + * This method is not used yet + */ + void unloadPlugin(const QString &name,bool permanent=true); + + private: + class PrivatePluginManager *d; +}; + +} + +#endif diff --git a/kate/interfaces/toolviewmanager.cpp b/kate/interfaces/toolviewmanager.cpp new file mode 100644 index 000000000..9f96a476d --- /dev/null +++ b/kate/interfaces/toolviewmanager.cpp @@ -0,0 +1,85 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Joseph Wenninger <jowenn@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "toolviewmanager.h" +#include "toolviewmanager.moc" + +#include "plugin.h" +#include "documentmanager.h" +#include "pluginmanager.h" + +#include "../app/katemainwindow.h" + +namespace Kate +{ + +class PrivateToolViewManager + { + public: + PrivateToolViewManager () + { + } + + ~PrivateToolViewManager () + { + } + + KateMainWindow *toolViewMan; + }; + +ToolViewManager::ToolViewManager (void *toolViewManager) : QObject ((KateMainWindow*) toolViewManager) +{ + d = new PrivateToolViewManager (); + d->toolViewMan = (KateMainWindow*) toolViewManager; +} + +ToolViewManager::~ToolViewManager () +{ + delete d; +} + +QWidget *ToolViewManager::createToolView (const QString &identifier, ToolViewManager::Position pos, const QPixmap &icon, const QString &text) +{ + return d->toolViewMan->createToolView (identifier, (KMultiTabBar::KMultiTabBarPosition)pos, icon, text); +} + +bool ToolViewManager::moveToolView (QWidget *widget, ToolViewManager::Position pos) +{ + if (!widget || !widget->qt_cast("KateMDI::ToolView")) + return false; + + return d->toolViewMan->moveToolView (static_cast<KateMDI::ToolView*>(widget), (KMultiTabBar::KMultiTabBarPosition)pos); +} + +bool ToolViewManager::showToolView(QWidget *widget) +{ + if (!widget || !widget->qt_cast("KateMDI::ToolView")) + return false; + + return d->toolViewMan->showToolView (static_cast<KateMDI::ToolView*>(widget)); +} + +bool ToolViewManager::hideToolView(QWidget *widget) +{ + if (!widget || !widget->qt_cast("KateMDI::ToolView")) + return false; + + return d->toolViewMan->hideToolView (static_cast<KateMDI::ToolView*>(widget)); +} + +} diff --git a/kate/interfaces/toolviewmanager.h b/kate/interfaces/toolviewmanager.h new file mode 100644 index 000000000..0a1011181 --- /dev/null +++ b/kate/interfaces/toolviewmanager.h @@ -0,0 +1,96 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Joseph Wenninger <jowenn@kde.org> + Copyright (C) 2002 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KATE_TOOLVIEWMANAGER_INCLUDE_ +#define _KATE_TOOLVIEWMANAGER_INCLUDE_ + +#include <qwidget.h> +#include <kurl.h> + +namespace Kate +{ + +/** + Interface to the toolviewmanager + */ +class KDE_EXPORT ToolViewManager : public QObject +{ + friend class PrivateToolViewManager; + + Q_OBJECT + + public: + /** + * Construtor, should not interest, internal usage + */ + ToolViewManager (void *toolViewManager); + + /** + * Desctructor + */ + virtual ~ToolViewManager (); + + public: + /** + * positions + */ + enum Position {Left, Right, Top, Bottom}; + + /** + * add a given widget to the given sidebar if possible, name is very important + * @param identifier unique identifier for this toolview + * @param pos position for the toolview, if we are in session restore, this is only a preference + * @param icon icon to use for the toolview + * @param text text to use in addition to icon + * @return created toolview on success or 0 + */ + QWidget *createToolView (const QString &identifier, ToolViewManager::Position pos, const QPixmap &icon, const QString &text); + + /** + * Move the toolview + * @param widget to show, widget given must be widget constructed by createToolView + * @param pos position to move widget to + * @return bool success + */ + bool moveToolView (QWidget *widget, ToolViewManager::Position pos); + + /** + * Show the toolview + * @param widget to show, widget given must be widget constructed by createToolView + * @return bool success + */ + bool showToolView (QWidget *widget); + + /** + * Hide the toolview + * @param widget to hide, widget given must be widget constructed by createToolView + * @return bool success + */ + bool hideToolView (QWidget *widget); + + private: + /** + * REALLY PRIVATE ;) + */ + class PrivateToolViewManager *d; +}; + +} + +#endif diff --git a/kate/interfaces/viewmanager.cpp b/kate/interfaces/viewmanager.cpp new file mode 100644 index 000000000..e2dbd34de --- /dev/null +++ b/kate/interfaces/viewmanager.cpp @@ -0,0 +1,73 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "viewmanager.h" +#include "viewmanager.moc" + +#include "plugin.h" +#include "documentmanager.h" +#include "toolviewmanager.h" +#include "pluginmanager.h" + +#include "../app/kateviewmanager.h" + +namespace Kate +{ + +class PrivateViewManager + { + public: + PrivateViewManager () + { + } + + ~PrivateViewManager () + { + } + + KateViewManager *viewMan; + }; + +ViewManager::ViewManager (void *viewManager) : QObject ((KateViewManager*) viewManager) +{ + d = new PrivateViewManager (); + d->viewMan = (KateViewManager*) viewManager; +} + +ViewManager::~ViewManager () +{ + delete d; +} + +View *ViewManager::activeView() +{ + return d->viewMan->activeView(); +} + +void ViewManager::activateView ( uint documentNumber ) +{ + d->viewMan->activateView( documentNumber ); +} + +void ViewManager::openURL (const KURL &url) +{ + d->viewMan->openURL (url, QString::null, true); +} + +} + diff --git a/kate/interfaces/viewmanager.h b/kate/interfaces/viewmanager.h new file mode 100644 index 000000000..ab7a74ce8 --- /dev/null +++ b/kate/interfaces/viewmanager.h @@ -0,0 +1,89 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KATE_VIEWMANAGER_INCLUDE_ +#define _KATE_VIEWMANAGER_INCLUDE_ + +#include <qobject.h> +#include <kurl.h> + +namespace Kate +{ + +class View; + +/** + * Interface to the viewmanager + */ +class KDE_EXPORT ViewManager : public QObject +{ + friend class PrivateViewManager; + + Q_OBJECT + + public: + /** + * Construtor, should not interest, internal usage + */ + ViewManager (void *viewManager); + + /** + * Desctructor + */ + virtual ~ViewManager (); + + public slots: /*these are slots for kjs*/ + /** + * Returns a pointer to the currently active view + * @return View active view + */ + Kate::View *activeView (); + + /** + * Activates the view with the corresponding documentNumber + * @param documentNumber the document's number + */ + void activateView ( uint documentNumber ); + + /** + * Opens the file pointed to by URL + * @param url url to the file + */ + void openURL (const KURL &url); + + #undef signals + #define signals public + signals: + #undef signals + #define signals protected + + /** + * Active view has changed + */ + void viewChanged (); + + private: + /** + * REALLY PRIVATE ;) + */ + class PrivateViewManager *d; +}; + +} + +#endif |