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 version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18
19#ifndef _KATE_APPLICATION_INCLUDE_
20#define _KATE_APPLICATION_INCLUDE_
21
22#include <kate_export.h>
23
24#include <QtCore/QObject>
25
26#include <kurl.h>
27
28namespace KTextEditor
29{
30 class Editor;
31}
32
33/**
34 * \brief Namespace for Kate application interfaces.
35 *
36 * This namespace contains interfaces for plugin developers for the Kate
37 * application.
38 */
39namespace Kate
40{
41
42 class DocumentManager;
43 class PluginManager;
44 class MainWindow;
45
46 /**
47 * \brief Central interface to the application.
48 *
49 * The class Application is central as it provides access to the core
50 * application, which includes the
51 * - document manager, access it with documentManager()
52 * - plugin manager, access it with pluginManager()
53 * - main windows, access a main window with mainWindow() or activeMainWindow()
54 * - used editor component, access it with editor().
55 *
56 * To access the application use the global accessor function application().
57 * You should never have to create an instance of this class yourself.
58 *
59 * \author Christoph Cullmann \<cullmann@kde.org\>
60 */
61 class KATEINTERFACES_EXPORT Application : public QObject
62 {
63 friend class PrivateApplication;
64
65 Q_OBJECT
66
67 public:
68 /**
69 * Construtor.
70 *
71 * The constructor is internally used by the Kate application, so it is
72 * of no interest for plugin developers. Plugin developers should use the
73 * global accessor application() instead.
74 *
75 * \internal
76 */
77 Application (void *application);
78
79 /**
80 * Virtual desctructor.
81 */
82 virtual ~Application ();
83
84 public:
85 /**
86 * Accessor to the document manager.
87 * There is always an document manager, so it is not necessary
88 * to test the returned value for NULL.
89 * \return a pointer to the document manager
90 */
91 Kate::DocumentManager *documentManager ();
92
93 /**
94 * Accessor to the plugin manager.
95 * There is always an plugin manager, so it is not necessary
96 * to test the returned value for NULL.
97 * \return a pointer to the plugin manager
98 */
99 Kate::PluginManager *pluginManager ();
100
101 /**
102 * Accessor to the global editor part.
103 * There is always an editor part, so it is not necessary
104 * to test the returned value for NULL.
105 * \return KTextEditor component
106 */
107 KTextEditor::Editor *editor();
108
109 /**
110 * Accessor to the active mainwindow.
111 * There is always an active mainwindow, so it is not necessary
112 * to test the returned value for NULL.
113 * \return a pointer to the active mainwindow
114 */
115 Kate::MainWindow *activeMainWindow ();
116
117 /**
118 * Get a list of all mainwindows. At least one entry, always.
119 * @return all mainwindows
120 * @see activeMainWindow()
121 */
122 const QList<Kate::MainWindow*> &mainWindows () const;
123
124 private:
125 class PrivateApplication *d;
126 };
127
128 /**
129 * Global accessor to the application object. Always existing during
130 * lifetime of a plugin.
131 * \return application object
132 */
133 KATEINTERFACES_EXPORT Application *application ();
134
135}
136
137#endif
138// kate: space-indent on; indent-width 2; replace-tabs on;
139
140