Changeset View
Changeset View
Standalone View
Standalone View
kwrite/kwriteapplication.h
- This file was added.
1 | /* This file is part of the KDE project | ||||
---|---|---|---|---|---|
2 | Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> | ||||
3 | Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> | ||||
4 | Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk> | ||||
5 | | ||||
6 | This library is free software; you can redistribute it and/or | ||||
7 | modify it under the terms of the GNU Library General Public | ||||
8 | License version 2 as published by the Free Software Foundation. | ||||
9 | | ||||
10 | This library is distributed in the hope that it will be useful, | ||||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
13 | Library General Public License for more details. | ||||
14 | | ||||
15 | You should have received a copy of the GNU Library General Public License | ||||
16 | along with this library; see the file COPYING.LIB. If not, write to | ||||
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
18 | Boston, MA 02110-1301, USA. | ||||
19 | */ | ||||
20 | | ||||
21 | #ifndef KWRITE_APPLICATION_H | ||||
22 | #define KWRITE_APPLICATION_H | ||||
23 | | ||||
24 | #include <ktexteditor/view.h> | ||||
25 | #include <ktexteditor/document.h> | ||||
26 | #include <ktexteditor/application.h> | ||||
27 | #include <ktexteditor/editor.h> | ||||
28 | | ||||
29 | class KWrite; | ||||
30 | | ||||
31 | class KWriteApplication : public QObject | ||||
32 | { | ||||
33 | Q_OBJECT | ||||
34 | | ||||
35 | public: | ||||
36 | KWriteApplication(); | ||||
37 | ~KWriteApplication(); | ||||
38 | | ||||
39 | void addDocument(KTextEditor::Document *doc) { m_documents.append(doc); } | ||||
40 | void removeDocument(KTextEditor::Document *doc) { m_documents.removeAll(doc); } | ||||
41 | void removeWindow(KWrite *kwrite) { m_kwrites.removeAll(kwrite); } | ||||
42 | | ||||
43 | bool noWindows() { return m_kwrites.isEmpty(); } | ||||
44 | | ||||
45 | KWrite *newWindow(KTextEditor::Document *doc = nullptr); | ||||
46 | | ||||
47 | void restore(); | ||||
48 | void saveProperties(KConfig *config); | ||||
49 | | ||||
50 | public Q_SLOTS: | ||||
51 | QList<KTextEditor::Document *> documents() { return m_documents; } | ||||
52 | bool quit(); | ||||
53 | KTextEditor::MainWindow *activeMainWindow(); | ||||
54 | QList<KTextEditor::MainWindow *> mainWindows(); | ||||
55 | bool closeDocument(KTextEditor::Document *document); | ||||
56 | | ||||
57 | private: | ||||
58 | KTextEditor::Application *m_application; | ||||
59 | QList<KTextEditor::Document *> m_documents; | ||||
60 | QList<KWrite *> m_kwrites; | ||||
61 | }; | ||||
62 | | ||||
63 | #endif |