1 // Copyright (C) 2015 OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // File : PyEditor_Editor.h
20 // Author : Maxim GLIBIN, Open CASCADE S.A.S. (maxim.glibin@opencascade.com)
23 #ifndef PYEDITOR_EDITOR_H
24 #define PYEDITOR_EDITOR_H
26 #include <QPlainTextEdit>
29 class PyEditor_PyHighlighter;
30 class PyEditor_Settings;
33 class PYEDITOR_EXPORT PyEditor_Editor : public QPlainTextEdit
38 PyEditor_Editor( bool isSingle = false, QtxResourceMgr* = 0, QWidget* = 0 );
39 virtual ~PyEditor_Editor();
41 void lineNumberAreaPaintEvent( QPaintEvent* );
42 int lineNumberAreaWidth();
44 void updateStatement();
45 PyEditor_Settings* settings();
48 void deleteSelected();
49 void append ( const QString & );
50 void setText ( const QString & text );
52 virtual void keyPressEvent( QKeyEvent* );
53 virtual void resizeEvent( QResizeEvent* );
54 virtual void paintEvent( QPaintEvent* );
57 void updateHighlightCurrentLine();
58 void matchParentheses();
60 void updateLineNumberAreaWidth( int );
61 void updateLineNumberArea( const QRect&, int );
64 bool matchLeftParenthesis( const QTextBlock&, int, int );
65 bool matchRightParenthesis( const QTextBlock&, int, int );
66 void createParenthesisSelection( int );
67 bool isLeftBrackets( QChar );
68 bool isRightBrackets( QChar );
70 void handleHome( bool );
72 void tabIndentation( bool );
73 void indentSelection( bool );
75 int findFirstNonSpace( const QString& );
77 QWidget* my_LineNumberArea;
78 PyEditor_PyHighlighter* my_SyntaxHighlighter;
79 PyEditor_Settings* my_Settings;
82 #endif // PYEDITOR_EDITOR_H