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 
55 class KTEXTEDITOR_EXPORT MainWindow : public QObject
56 {
57  Q_OBJECT
58 
59 public:
66  MainWindow(QObject *parent);
67 
71  virtual ~MainWindow();
72 
73  //
74  // Accessors to some window properties and contents
75  //
76 public:
81  QWidget *window();
82 
87  KXMLGUIFactory *guiFactory();
88 
89  //
90  // Signals related to the main window
91  //
92 Q_SIGNALS:
97  void unhandledShortcutOverride(QEvent *e);
98 
99  //
100  // View access and manipulation interface
101  //
102 public:
108 
113  KTextEditor::View *activeView();
114 
122  KTextEditor::View *activateView(KTextEditor::Document *document);
123 
133  KTextEditor::View *openUrl(const QUrl &url, const QString &encoding = QString());
134 
140  bool closeView(KTextEditor::View *view);
141 
146  void splitView(Qt::Orientation orientation);
147 
153  bool closeSplitView(KTextEditor::View *view);
154 
159  bool viewsInSameSplitView(KTextEditor::View *view1, KTextEditor::View *view2);
160 
161  //
162  // Signals related to view handling
163  //
164 Q_SIGNALS:
169  void viewChanged(KTextEditor::View *view);
170 
175  void viewCreated(KTextEditor::View *view);
176 
177  //
178  // Interface to allow view bars to be constructed in a central place per window
179  //
180 public:
186  QWidget *createViewBar(KTextEditor::View *view);
187 
192  void deleteViewBar(KTextEditor::View *view);
193 
199  void addWidgetToViewBar(KTextEditor::View *view, QWidget *bar);
200 
205  void showViewBar(KTextEditor::View *view);
206 
211  void hideViewBar(KTextEditor::View *view);
212 
213  //
214  // ToolView stuff, here all stuff belong which allows to
215  // add/remove and manipulate the toolview of this main windows
216  //
217 public:
223  Left = 0,
224  Right = 1,
225  Top = 2,
226  Bottom = 3
227  };
228 
241  QWidget *createToolView(KTextEditor::Plugin *plugin, const QString &identifier, KTextEditor::MainWindow::ToolViewPosition pos, const QIcon &icon, const QString &text);
242 
251 
259  bool showToolView(QWidget *widget);
260 
267  bool hideToolView(QWidget *widget);
268 
269  //
270  // Application plugin accessors
271  //
272 public:
280  bool showPluginConfigPage(KTextEditor::Plugin *plugin, int page);
281 
288  QObject *pluginView(const QString &name);
289 
290  //
291  // Signals related to application plugins
292  //
293 Q_SIGNALS:
300  void pluginViewCreated(const QString &name, QObject *pluginView);
301 
311  void pluginViewDeleted(const QString &name, QObject *pluginView);
312 
313 private:
317  friend class MainWindowPrivate;
318 
322  class MainWindowPrivate *const d;
323 };
324 
325 } // namespace KTextEditor
326 
327 #endif
ToolViewPosition
Toolview position.
Definition: mainwindow.h:222
Left
QWidget * widget() override
A KParts derived class representing a text document.
Definition: document.h:197
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Top
KTextEditor Plugin interface.
Definition: plugin.h:90
A text widget with KXMLGUIClient that represents a Document.
Definition: view.h:153
This class allows the application that embeds the KTextEditor component to allow it to access parts o...
Definition: mainwindow.h:55
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun May 24 2020 23:10:51 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.