Salome HOME
Copyright update 2022
[modules/gui.git] / tools / PyEditor / src / PyEditor_Widget.h
1 // Copyright (C) 2015-2022  OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // File   : PyEditor_Widget.h
20 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
21 //
22
23 #ifndef PYEDITOR_WIDGET_H
24 #define PYEDITOR_WIDGET_H
25
26 #include "PyEditor.h"
27 #include "PyEditor_Settings.h"
28
29 #include <QWidget>
30
31 class PyEditor_Editor;
32 class PyEditor_FindTool;
33
34 class PYEDITOR_EXPORT PyEditor_Widget : public QWidget
35 {
36   Q_OBJECT
37
38 public:
39   PyEditor_Widget( QWidget* = 0 );
40
41   PyEditor_Editor* editor();
42   PyEditor_FindTool* findTool();
43
44   void setSettings( const PyEditor_Settings& );
45   const PyEditor_Settings& settings() const;
46
47   bool isModified();
48
49   QString text() const;
50
51   QStringList keywords() const;
52   void appendKeywords( const QStringList&, int, const QColor& = QColor() );
53   void removeKeywords( const QStringList& );
54
55   int completionPolicy() const;
56   void setCompletionPolicy( int );
57
58 public slots:
59   void find();
60   void replace();
61
62   void undo();
63   void redo();
64   void cut();
65   void copy();
66   void paste();
67   void deleteSelected();
68   void selectAll();
69   void clear();
70
71   void setModified( bool );
72
73   void setText( const QString& );
74
75   void setCurrentLine( int );
76
77 signals:
78   void modificationChanged( bool );
79   void undoAvailable( bool );
80   void redoAvailable( bool );
81   void copyAvailable( bool );
82   void selectionChanged();
83   void textChanged();
84   void cursorPositionChanged();
85
86 private:
87   PyEditor_Editor* myEditor;
88   PyEditor_FindTool* myFindTool;
89 };
90
91 #endif // PYEDITOR_WIDGET_H