| 1 | #cxx . . $ `<file>/include/internal/QCodeEditor.hpp`/pragma once |
| 2 | |
| 3 | // Qt |
| 4 | #include <QTextEdit> // Required for inheritance |
| 5 | |
| 6 | class QCompletercxx . . $ QCompleter#; |
| 7 | class QLineNumberAreacxx . . $ QLineNumberArea#; |
| 8 | class QSyntaxStylecxx . . $ QSyntaxStyle#; |
| 9 | class QStyleSyntaxHighlightercxx . . $ QStyleSyntaxHighlighter#; |
| 10 | class QFramedTextAttributecxx . . $ QFramedTextAttribute#; |
| 11 | |
| 12 | /** |
| 13 | * @brief Class, that describes code editor. |
| 14 | */ |
| 15 | class QCodeEditorcxx . . $ QCodeEditor# : public QTextEditcxx . . $ QTextEdit# |
| 16 | { |
| 17 | Q_OBJECTcxx . . $ QCodeEditor#staticMetaObject. |
| 18 | |
| 19 | public: |
| 20 | /** |
| 21 | * @brief Constructor. |
| 22 | * @param widget Pointer to parent widget. |
| 23 | */ |
| 24 | explicit QCodeEditorcxx . . $ QCodeEditor#QCodeEditor(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* widget=nullptr); |
| 25 | |
| 26 | // Disable copying |
| 27 | QCodeEditorcxx . . $ QCodeEditor#QCodeEditor(db732219dfa9f35c).(const QCodeEditorcxx . . $ QCodeEditor#&) = delete; |
| 28 | QCodeEditorcxx . . $ QCodeEditor#& operatorcxx . . $ QCodeEditor#`operator=`(390186663adea493).=(const QCodeEditorcxx . . $ QCodeEditor#&) = delete; |
| 29 | |
| 30 | /** |
| 31 | * @brief Method for getting first visible block |
| 32 | * index. |
| 33 | * @return Index. |
| 34 | */ |
| 35 | int getFirstVisibleBlockcxx . . $ QCodeEditor#getFirstVisibleBlock(b126dc7c1de90089).(); |
| 36 | |
| 37 | /** |
| 38 | * @brief Method for setting highlighter. |
| 39 | * @param highlighter Pointer to syntax highlighter. |
| 40 | */ |
| 41 | void setHighlightercxx . . $ QCodeEditor#setHighlighter(c4055cb90adcfbb5).(QStyleSyntaxHighlightercxx . . $ QStyleSyntaxHighlighter#* highlighter); |
| 42 | |
| 43 | /** |
| 44 | * @brief Method for setting syntax sty.e. |
| 45 | * @param style Pointer to syntax style. |
| 46 | */ |
| 47 | void setSyntaxStylecxx . . $ QCodeEditor#setSyntaxStyle(1fc7b27a9b6cc29c).(QSyntaxStylecxx . . $ QSyntaxStyle#* style); |
| 48 | |
| 49 | /** |
| 50 | * @brief Method setting auto parentheses enabled. |
| 51 | */ |
| 52 | void setAutoParenthesescxx . . $ QCodeEditor#setAutoParentheses(b45ddcbc8423892c).(bool enabled); |
| 53 | |
| 54 | /** |
| 55 | * @brief Method for getting is auto parentheses enabled. |
| 56 | * Default value: true |
| 57 | */ |
| 58 | bool autoParenthesescxx . . $ QCodeEditor#autoParentheses(50ce9a9e25b4a850).() const; |
| 59 | |
| 60 | /** |
| 61 | * @brief Method for setting tab replacing |
| 62 | * enabled. |
| 63 | */ |
| 64 | void setTabReplacecxx . . $ QCodeEditor#setTabReplace(b45ddcbc8423892c).(bool enabled); |
| 65 | |
| 66 | /** |
| 67 | * @brief Method for getting is tab replacing enabled. |
| 68 | * Default value: true |
| 69 | */ |
| 70 | bool tabReplacecxx . . $ QCodeEditor#tabReplace(50ce9a9e25b4a850).() const; |
| 71 | |
| 72 | /** |
| 73 | * @brief Method for setting amount of spaces, that will |
| 74 | * replace tab. |
| 75 | * @param val Number of spaces. |
| 76 | */ |
| 77 | void setTabReplaceSizecxx . . $ QCodeEditor#setTabReplaceSize(d4f767463ce0a6b3).(int val); |
| 78 | |
| 79 | /** |
| 80 | * @brief Method for getting number of spaces, that will |
| 81 | * replace tab if `tabReplace` is true. |
| 82 | * Default: 4 |
| 83 | */ |
| 84 | int tabReplaceSizecxx . . $ QCodeEditor#tabReplaceSize(455f465bc33b4cdf).() const; |
| 85 | |
| 86 | /** |
| 87 | * @brief Method for setting auto indentation enabled. |
| 88 | */ |
| 89 | void setAutoIndentationcxx . . $ QCodeEditor#setAutoIndentation(b45ddcbc8423892c).(bool enabled); |
| 90 | |
| 91 | /** |
| 92 | * @brief Method for getting is auto indentation enabled. |
| 93 | * Default: true |
| 94 | */ |
| 95 | bool autoIndentationcxx . . $ QCodeEditor#autoIndentation(50ce9a9e25b4a850).() const; |
| 96 | |
| 97 | /** |
| 98 | * @brief Method for setting completer. |
| 99 | * @param completer Pointer to completer object. |
| 100 | */ |
| 101 | void setCompletercxx . . $ QCodeEditor#setCompleter(638321c80ff6aea).(QCompletercxx . . $ QCompleter#* completer); |
| 102 | |
| 103 | /** |
| 104 | * @brief Method for getting completer. |
| 105 | * @return Pointer to completer. |
| 106 | */ |
| 107 | QCompletercxx . . $ QCompleter#* completercxx . . $ QCodeEditor#completer(2f221150cdd0896).() const; |
| 108 | |
| 109 | public Q_SLOTScxx . . $ `<external>/1208926524888476972/qobjectdefs.h:92:10`!: |
| 110 | |
| 111 | /** |
| 112 | * @brief Slot, that performs insertion of |
| 113 | * completion info into code. |
| 114 | * @param s Data. |
| 115 | */ |
| 116 | void insertCompletioncxx . . $ QCodeEditor#insertCompletion(7df51288a9ebd664).(QStringcxx . . $ QString# s); |
| 117 | |
| 118 | /** |
| 119 | * @brief Slot, that performs update of |
| 120 | * internal editor viewport based on line |
| 121 | * number area width. |
| 122 | */ |
| 123 | void updateLineNumberAreaWidthcxx . . $ QCodeEditor#updateLineNumberAreaWidth(d4f767463ce0a6b3).(int); |
| 124 | |
| 125 | /** |
| 126 | * @brief Slot, that performs update of some |
| 127 | * part of line number area. |
| 128 | * @param rect Area that has to be updated. |
| 129 | */ |
| 130 | void updateLineNumberAreacxx . . $ QCodeEditor#updateLineNumberArea(22ba0428947158b).(const QRectcxx . . $ QRect#& rect); |
| 131 | |
| 132 | /** |
| 133 | * @brief Slot, that will proceed extra selection |
| 134 | * for current cursor position. |
| 135 | */ |
| 136 | void updateExtraSelectioncxx . . $ QCodeEditor#updateExtraSelection(49f6e7a06ebc5aa8).(); |
| 137 | |
| 138 | /** |
| 139 | * @brief Slot, that will update editor style. |
| 140 | */ |
| 141 | void updateStylecxx . . $ QCodeEditor#updateStyle(49f6e7a06ebc5aa8).(); |
| 142 | |
| 143 | /** |
| 144 | * @brief Slot, that will be called on selection |
| 145 | * change. |
| 146 | */ |
| 147 | void onSelectionChangedcxx . . $ QCodeEditor#onSelectionChanged(49f6e7a06ebc5aa8).(); |
| 148 | |
| 149 | protected: |
| 150 | /** |
| 151 | * @brief Method, that's called on any text insertion of |
| 152 | * mimedata into editor. If it's text - it inserts text |
| 153 | * as plain text. |
| 154 | */ |
| 155 | void insertFromMimeDatacxx . . $ QCodeEditor#insertFromMimeData(9f04b6fd1efe3797).(const QMimeDatacxx . . $ QMimeData#* source) override; |
| 156 | |
| 157 | /** |
| 158 | * @brief Method, that's called on editor painting. This |
| 159 | * method if overloaded for line number area redraw. |
| 160 | */ |
| 161 | void paintEventcxx . . $ QCodeEditor#paintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent#* e) override; |
| 162 | |
| 163 | /** |
| 164 | * @brief Method, that's called on any widget resize. |
| 165 | * This method if overloaded for line number area |
| 166 | * resizing. |
| 167 | */ |
| 168 | void resizeEventcxx . . $ QCodeEditor#resizeEvent(eeeec21cf8dc0387).(QResizeEventcxx . . $ QResizeEvent#* e) override; |
| 169 | |
| 170 | /** |
| 171 | * @brief Method, that's called on any key press, posted |
| 172 | * into code editor widget. This method is overloaded for: |
| 173 | * |
| 174 | * 1. Completion |
| 175 | * 2. Tab to spaces |
| 176 | * 3. Low indentation |
| 177 | * 4. Auto parenthesis |
| 178 | */ |
| 179 | void keyPressEventcxx . . $ QCodeEditor#keyPressEvent(c92999c1b6b09cc0).(QKeyEventcxx . . $ QKeyEvent#* e) override; |
| 180 | |
| 181 | /** |
| 182 | * @brief Method, that's called on focus into widget. |
| 183 | * It's required for setting this widget to set |
| 184 | * completer. |
| 185 | */ |
| 186 | void focusInEventcxx . . $ QCodeEditor#focusInEvent(897a5ce4b6676619).(QFocusEventcxx . . $ QFocusEvent# *e) override; |
| 187 | |
| 188 | private: |
| 189 | |
| 190 | /** |
| 191 | * @brief Method for initializing document |
| 192 | * layout handlers. |
| 193 | */ |
| 194 | void initDocumentLayoutHandlerscxx . . $ QCodeEditor#initDocumentLayoutHandlers(49f6e7a06ebc5aa8).(); |
| 195 | |
| 196 | /** |
| 197 | * @brief Method for initializing default |
| 198 | * monospace font. |
| 199 | */ |
| 200 | void initFontcxx . . $ QCodeEditor#initFont(49f6e7a06ebc5aa8).(); |
| 201 | |
| 202 | /** |
| 203 | * @brief Method for performing connection |
| 204 | * of objects. |
| 205 | */ |
| 206 | void performConnectionscxx . . $ QCodeEditor#performConnections(49f6e7a06ebc5aa8).(); |
| 207 | |
| 208 | /** |
| 209 | * @brief Method, that performs selection |
| 210 | * frame selection. |
| 211 | */ |
| 212 | void handleSelectionQuerycxx . . $ QCodeEditor#handleSelectionQuery(2dee62e7021fdd8c).(QTextCursorcxx . . $ QTextCursor# cursor); |
| 213 | |
| 214 | /** |
| 215 | * @brief Method for updating geometry of line number area. |
| 216 | */ |
| 217 | void updateLineGeometrycxx . . $ QCodeEditor#updateLineGeometry(49f6e7a06ebc5aa8).(); |
| 218 | |
| 219 | /** |
| 220 | * @brief Method, that performs completer processing. |
| 221 | * Returns true if event has to be dropped. |
| 222 | * @param e Pointer to key event. |
| 223 | * @return Shall event be dropped. |
| 224 | */ |
| 225 | bool proceedCompleterBegincxx . . $ QCodeEditor#proceedCompleterBegin(654f5f472df72c38).(QKeyEventcxx . . $ QKeyEvent# *e); |
| 226 | void proceedCompleterEndcxx . . $ QCodeEditor#proceedCompleterEnd(c92999c1b6b09cc0).(QKeyEventcxx . . $ QKeyEvent#* e); |
| 227 | |
| 228 | /** |
| 229 | * @brief Method for getting character under |
| 230 | * cursor. |
| 231 | * @param offset Offset to cursor. |
| 232 | */ |
| 233 | QCharcxx . . $ QChar# charUnderCursorcxx . . $ QCodeEditor#charUnderCursor(fee70a7e000c558e).(int offset = 0) const; |
| 234 | |
| 235 | /** |
| 236 | * @brief Method for getting word under |
| 237 | * cursor. |
| 238 | * @return Word under cursor. |
| 239 | */ |
| 240 | QStringcxx . . $ QString# wordUnderCursorcxx . . $ QCodeEditor#wordUnderCursor(6ef7b6c27b00b43d).() const; |
| 241 | |
| 242 | /** |
| 243 | * @brief Method, that adds highlighting of |
| 244 | * currently selected line to extra selection list. |
| 245 | */ |
| 246 | void highlightCurrentLinecxx . . $ QCodeEditor#highlightCurrentLine(756a146a09cbd9d6).(QListcxx . . $ QList#<QTextEditcxx . . $ QTextEdit#::ExtraSelectioncxx . . $ QTextEdit#ExtraSelection#>& extraSelection); |
| 247 | |
| 248 | /** |
| 249 | * @brief Method, that adds highlighting of |
| 250 | * parenthesis if available. |
| 251 | */ |
| 252 | void highlightParenthesiscxx . . $ QCodeEditor#highlightParenthesis(756a146a09cbd9d6).(QListcxx . . $ QList#<QTextEditcxx . . $ QTextEdit#::ExtraSelectioncxx . . $ QTextEdit#ExtraSelection#>& extraSelection); |
| 253 | |
| 254 | /** |
| 255 | * @brief Method for getting number of indentation |
| 256 | * spaces in current line. Tabs will be treated |
| 257 | * as `tabWidth / spaceWidth` |
| 258 | */ |
| 259 | int getIndentationSpacescxx . . $ QCodeEditor#getIndentationSpaces(b126dc7c1de90089).(); |
| 260 | |
| 261 | QStyleSyntaxHighlightercxx . . $ QStyleSyntaxHighlighter#* m_highlightercxx . . $ QCodeEditor#m_highlighter.; |
| 262 | QSyntaxStylecxx . . $ QSyntaxStyle#* m_syntaxStylecxx . . $ QCodeEditor#m_syntaxStyle.; |
| 263 | QLineNumberAreacxx . . $ QLineNumberArea#* m_lineNumberAreacxx . . $ QCodeEditor#m_lineNumberArea.; |
| 264 | QCompletercxx . . $ QCompleter#* m_completercxx . . $ QCodeEditor#m_completer.; |
| 265 | |
| 266 | QFramedTextAttributecxx . . $ QFramedTextAttribute#* m_framedAttributecxx . . $ QCodeEditor#m_framedAttribute.; |
| 267 | |
| 268 | bool m_autoIndentationcxx . . $ QCodeEditor#m_autoIndentation.; |
| 269 | bool m_autoParenthesescxx . . $ QCodeEditor#m_autoParentheses.; |
| 270 | bool m_replaceTabcxx . . $ QCodeEditor#m_replaceTab.; |
| 271 | QStringcxx . . $ QString# m_tabReplacecxx . . $ QCodeEditor#m_tabReplace.; |
| 272 | }; |
| 273 |