KTextEditor

katescriptview.h
1 /*
2  SPDX-FileCopyrightText: 2008 Paul Giannaros <[email protected]>
3  SPDX-FileCopyrightText: 2008 Christoph Cullmann <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KATE_SCRIPT_VIEW_H
9 #define KATE_SCRIPT_VIEW_H
10 
11 #include <QJSValue>
12 #include <QObject>
13 
14 #include <ktexteditor_export.h>
15 
16 #include <ktexteditor/cursor.h>
17 #include <ktexteditor/range.h>
18 
19 namespace KTextEditor
20 {
21 class ViewPrivate;
22 }
23 class QJSEngine;
31 class KTEXTEDITOR_EXPORT KateScriptView : public QObject
32 {
34  Q_OBJECT
35 
36 public:
37  explicit KateScriptView(QJSEngine *, QObject *parent = nullptr);
38  void setView(KTextEditor::ViewPrivate *view);
39  KTextEditor::ViewPrivate *view();
40 
41  Q_INVOKABLE QJSValue cursorPosition();
46  Q_INVOKABLE void setCursorPosition(int line, int column);
47  Q_INVOKABLE void setCursorPosition(const QJSValue &cursor);
48 
49  Q_INVOKABLE QJSValue virtualCursorPosition();
50  Q_INVOKABLE void setVirtualCursorPosition(int line, int column);
51  Q_INVOKABLE void setVirtualCursorPosition(const QJSValue &cursor);
52 
53  Q_INVOKABLE QString selectedText();
54  Q_INVOKABLE bool hasSelection();
55  Q_INVOKABLE QJSValue selection();
56  Q_INVOKABLE void setSelection(const QJSValue &range);
57  Q_INVOKABLE void removeSelectedText();
58  Q_INVOKABLE void selectAll();
59  Q_INVOKABLE void clearSelection();
60 
61  Q_INVOKABLE void align(const QJSValue &range);
62 
63  Q_INVOKABLE QJSValue executeCommand(const QString &command, const QString &args = QString(), const QJSValue &jsrange = QJSValue());
64 
65 private:
66  KTextEditor::ViewPrivate *m_view;
67  QJSEngine *m_engine;
68 };
69 
70 #endif
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Thinish wrapping around KTextEditor::ViewPrivate, exposing the methods we want exposed and adding som...
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:58:29 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.