KTextEditor

mainwindow.h
1 /* SPDX-License-Identifier: LGPL-2.0-or-later
2 
3  Copyright (C) 2013 Christoph Cullmann <[email protected]>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
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 KTEXTEDITOR_MAINWINDOW_H
22 #define KTEXTEDITOR_MAINWINDOW_H
23 
24 #include <ktexteditor_export.h>
25 
26 #include <QObject>
27 
28 class QEvent;
29 class QIcon;
30 class QUrl;
31 class QWidget;
32 
33 class KXMLGUIFactory;
34 
35 namespace KTextEditor
36 {
37 class Plugin;
38 class Document;
39 class View;
40 
57 class KTEXTEDITOR_EXPORT MainWindow : public QObject
58 {
59  Q_OBJECT
60 
61 public:
68  MainWindow(QObject *parent);
69 
73  virtual ~MainWindow();
74 
75  //
76  // Accessors to some window properties and contents
77  //
78 public:
83  QWidget *window();
84 
89  KXMLGUIFactory *guiFactory();
90 
91  //
92  // Signals related to the main window
93  //
94 Q_SIGNALS:
99  void unhandledShortcutOverride(QEvent *e);
100 
101  //
102  // View access and manipulation interface
103  //
104 public:
110 
115  KTextEditor::View *activeView();
116 
124  KTextEditor::View *activateView(KTextEditor::Document *document);
125 
135  KTextEditor::View *openUrl(const QUrl &url, const QString &encoding = QString());
136 
142  bool closeView(KTextEditor::View *view);
143 
148  void splitView(Qt::Orientation orientation);
149 
155  bool closeSplitView(KTextEditor::View *view);
156 
161  bool viewsInSameSplitView(KTextEditor::View *view1, KTextEditor::View *view2);
162 
163  //
164  // Signals related to view handling
165  //
166 Q_SIGNALS:
171  void viewChanged(KTextEditor::View *view);
172 
177  void viewCreated(KTextEditor::View *view);
178 
179  //
180  // Interface to allow view bars to be constructed in a central place per window
181  //
182 public:
188  QWidget *createViewBar(KTextEditor::View *view);
189 
194  void deleteViewBar(KTextEditor::View *view);
195 
201  void addWidgetToViewBar(KTextEditor::View *view, QWidget *bar);
202 
207  void showViewBar(KTextEditor::View *view);
208 
213  void hideViewBar(KTextEditor::View *view);
214 
215  //
216  // ToolView stuff, here all stuff belong which allows to
217  // add/remove and manipulate the toolview of this main windows
218  //
219 public:
225  Left = 0,
226  Right = 1,
227  Top = 2,
228  Bottom = 3
229  };
230 
243  QWidget *createToolView(KTextEditor::Plugin *plugin, const QString &identifier, KTextEditor::MainWindow::ToolViewPosition pos, const QIcon &icon, const QString &text);
244 
253 
261  bool showToolView(QWidget *widget);
262 
269  bool hideToolView(QWidget *widget);
270 
271  //
272  // Application plugin accessors
273  //
274 public:
282  bool showPluginConfigPage(KTextEditor::Plugin *plugin, int page);
283 
290  QObject *pluginView(const QString &name);
291 
292  //
293  // Signals related to application plugins
294  //
295 Q_SIGNALS:
302  void pluginViewCreated(const QString &name, QObject *pluginView);
303 
313  void pluginViewDeleted(const QString &name, QObject *pluginView);
314 
315 private:
319  friend class MainWindowPrivate;
320 
324  class MainWindowPrivate *const d;
325 };
326 
327 } // namespace KTextEditor
328 
329 #endif
ToolViewPosition
Toolview position.
Definition: mainwindow.h:224
Left
QWidget * widget() override
A KParts derived class representing a text document.
Definition: document.h:199
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Top
KTextEditor Plugin interface.
Definition: plugin.h:92
Orientation
A text widget with KXMLGUIClient that represents a Document.
Definition: view.h:155
This class allows the application that embeds the KTextEditor component to allow it to access parts o...
Definition: mainwindow.h:57
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 4 2020 22:56:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.