Warning, file /graphics/tikzkit/src/app/TikzKit.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the TikZKit project 0002 * 0003 * Copyright (C) 2013-2014 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This program is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 2 or the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 * Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program; If not, see <http://www.gnu.org/licenses/>. 0017 */ 0018 #ifndef TIKZKIT_APPLICATION_H 0019 #define TIKZKIT_APPLICATION_H 0020 0021 #include <QObject> 0022 #include <QVector> 0023 0024 class QUrl; 0025 0026 namespace tikz { 0027 namespace ui { 0028 class Application; 0029 class MainWindow; 0030 class Document; 0031 class View; 0032 } 0033 } 0034 0035 class DocumentManager; 0036 class MainWindow; 0037 0038 class TikzKit : public QObject 0039 { 0040 Q_OBJECT 0041 0042 public: 0043 /** 0044 * Accessor to the instance. 0045 */ 0046 static TikzKit * self(); 0047 0048 public: 0049 /** 0050 * Default constructor. 0051 */ 0052 TikzKit(); 0053 0054 /** 0055 * Virtual destructor. 0056 */ 0057 virtual ~TikzKit(); 0058 0059 // 0060 // 0061 // 0062 public: 0063 /** 0064 * Return the document manager singleton. 0065 */ 0066 DocumentManager * documentManager(); 0067 0068 /** 0069 * Create a new main window. 0070 */ 0071 MainWindow * createMainWindow(); 0072 0073 /** 0074 * Called by the MainWindow to register @p mainWin on construction. 0075 */ 0076 void registerMainWindow(MainWindow * mainWin); 0077 0078 /** 0079 * Called by the MainWindow to unregister @p mainWin on destruction. 0080 */ 0081 void unregisterMainWindow(MainWindow * mainWin); 0082 0083 // 0084 // MainWindow related accessors 0085 // 0086 public Q_SLOTS: 0087 /** 0088 * Get a list of all main windows. 0089 * @return all main windows 0090 */ 0091 QList<tikz::ui::MainWindow *> mainWindows(); 0092 0093 /** 0094 * Accessor to the active main window. 0095 * \return a pointer to the active mainwindow 0096 */ 0097 tikz::ui::MainWindow *activeMainWindow(); 0098 0099 // 0100 // Document related accessors 0101 // 0102 public Q_SLOTS: 0103 /** 0104 * Get a list of all documents that are managed by the application. 0105 * This might contain less documents than the editor has in his documents () list. 0106 * @return all documents the application manages 0107 */ 0108 QVector<tikz::ui::Document *> documents(); 0109 0110 /** 0111 * Get the document with the URL \p url. 0112 * if multiple documents match the searched url, return the first found one... 0113 * \param url the document's URL 0114 * \return the document with the given \p url or NULL, if none found 0115 */ 0116 tikz::ui::Document *findUrl(const QUrl &url); 0117 0118 /** 0119 * Open the document \p url. 0120 * if the url is empty, a new empty document will be created 0121 * \param url the document's url 0122 * \return a pointer to the created document 0123 */ 0124 tikz::ui::Document * openUrl(const QUrl &url); 0125 0126 /** 0127 * Close the given \p document. If the document is modified, user will be asked if he wants that. 0128 * \param document the document to be closed 0129 * \return \e true on success, otherwise \e false 0130 */ 0131 bool closeDocument(tikz::ui::Document *document); 0132 0133 Q_SIGNALS: 0134 /** 0135 * This signal is emitted when the \p document was created. 0136 * 0137 * @param document document that was created 0138 */ 0139 void documentCreated(tikz::ui::Document *document); 0140 0141 /** 0142 * This signal is emitted before a \p document which should be closed is deleted 0143 * The document is still accessible and usable, but it will be deleted 0144 * after this signal was send. 0145 * 0146 * @param document document that will be deleted 0147 */ 0148 void aboutToDeleteDocument(tikz::ui::Document *document); 0149 0150 /** 0151 * This signal is emitted when the \p document has been deleted. 0152 * 0153 * Warning !!! DO NOT ACCESS THE DATA REFERENCED BY THE POINTER, IT IS ALREADY INVALID 0154 * Use the pointer only to remove mappings in hash or maps 0155 * 0156 * @param document document that is deleted 0157 */ 0158 void documentDeleted(tikz::ui::Document *document); 0159 0160 private: 0161 tikz::ui::Application * m_wrapper; 0162 DocumentManager * m_docManager; 0163 0164 QVector<MainWindow *> m_mainWindows; 0165 }; 0166 0167 #endif // TIKZKIT_APPLICATION_H 0168 0169 // kate: indent-width 4; replace-tabs on;