Debian Codegraph @

src/scripttools/debugging/qscriptedit_p.h

raw symbols SCIP
1 /****************************************************************************
2 **
3 ** Copyright (C) 2018 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtSCriptTools module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39
40 #ifndef QSCRIPTEDIT_P_H
41 #define QSCRIPTEDIT_P_H
42
43 //
44 // W A R N I N G
45 // -------------
46 //
47 // This file is not part of the Qt API. It exists purely as an
48 // implementation detail. This header file may change from version to
49 // version without notice, or even be removed.
50 //
51 // We mean it.
52 //
53
54 #include <QtWidgets/qplaintextedit.h>
55
56 #include <QtCore/qhash.h>
57 #include <QtCore/qset.h>
58
59 QT_BEGIN_NAMESPACE
60
61 class QScriptEditExtraArea;
62
63 class Q_AUTOTEST_EXPORT QScriptEdit : public QPlainTextEdit
64 {
65 Q_OBJECT
66 public:
67 QScriptEdit(QWidget *parent = 0);
68 ~QScriptEdit();
69
70 int baseLineNumber() const;
71 void setBaseLineNumber(int base);
72
73 int executionLineNumber() const;
74 void setExecutionLineNumber(int lineNumber, bool error);
75 void setExecutableLineNumbers(const QSet<int> &lineNumbers);
76 bool isExecutableLine(int lineNumber) const;
77
78 int currentLineNumber() const;
79 void gotoLine(int lineNumber);
80
81 void setBreakpoint(int lineNumber);
82 void setBreakpointEnabled(int lineNumber, bool enable);
83 void deleteBreakpoint(int lineNumber);
84
85 int extraAreaWidth() const;
86
87 signals:
88 void breakpointToggleRequest(int lineNumber, bool on);
89 void breakpointEnableRequest(int lineNumber, bool enable);
90
91 protected:
92 void paintEvent(QPaintEvent *e);
93 void resizeEvent(QResizeEvent *e);
94
95 void extraAreaPaintEvent(QPaintEvent *e);
96 void extraAreaMouseEvent(QMouseEvent *e);
97 bool extraAreaEvent(QEvent *e);
98
99 private slots:
100 void updateExtraAreaWidth();
101 void updateExtraArea(const QRect &, int);
102 void highlightCurrentLine();
103
104 private:
105 QTextEdit::ExtraSelection currentLineSelection() const;
106 QTextEdit::ExtraSelection currentExecutionLineSelection() const;
107 void updateExtraSelections();
108
109 private:
110 QScriptEditExtraArea *m_extraArea;
111 int m_baseLineNumber;
112 int m_executionLineNumber;
113 QSet<int> m_executableLineNumbers;
114 bool m_executionLineNumberHasError;
115 int m_extraAreaToggleBlockNumber;
116
117 struct BreakpointData {
118 BreakpointData() : enabled(true) {}
119 bool enabled;
120 };
121 QHash<int, BreakpointData> m_breakpoints;
122
123 private:
124 Q_DISABLE_COPY(QScriptEdit)
125 friend class QScriptEditExtraArea;
126 };
127
128 QT_END_NAMESPACE
129
130 #endif