Salome HOME
7c7d9d34fc58978cfec0b35a411e076b95c0f99e
[modules/gui.git] / tools / PyEditor / src / python / PyEditorPy.sip
1 // Copyright (C) 2007-2023  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   : SalomePyQt.sip
20 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
21 //
22
23 %Module PyEditorPy
24
25 %Import QtCore/QtCoremod.sip
26 %Import QtGui/QtGuimod.sip
27 %If (Qt_5_0_0 -)
28 %Import QtWidgets/QtWidgetsmod.sip
29 %End
30
31 class PyEditor_Settings
32 {
33 %TypeHeaderCode
34 #include <PyEditor_Settings.h>
35 %End
36
37 public:
38   PyEditor_Settings();
39
40   void setHighlightCurrentLine( bool );
41   bool highlightCurrentLine() const;
42
43   void setTextWrapping( bool );
44   bool textWrapping() const;
45
46   void setCenterCursorOnScroll( bool );
47   bool centerCursorOnScroll() const;
48
49   void setLineNumberArea( bool );
50   bool lineNumberArea() const;
51
52   void setVerticalEdge( bool );
53   bool verticalEdge() const;
54
55   void setNumberColumns( int );
56   int numberColumns() const;
57
58   void setTabSpaceVisible( bool );
59   bool tabSpaceVisible() const;
60
61   void setTabSize( int );
62   int tabSize() const;
63
64   void setFont( const QFont& );
65   QFont font() const;
66
67   void setCompletionPolicy( int );
68   int completionPolicy() const;
69 };
70
71 class PyEditor_Editor : QPlainTextEdit
72
73 %TypeHeaderCode
74 #include <PyEditor_Editor.h>
75 %End
76
77 public:
78   explicit PyEditor_Editor( QWidget* /TransferThis/ = 0 );
79   virtual ~PyEditor_Editor();
80
81   void setSettings( const PyEditor_Settings& );
82   const PyEditor_Settings& settings() const;
83   QString text() const;
84
85   QStringList keywords() const;
86   void        appendKeywords( const QStringList&, int, const QColor& = QColor() );
87   void        removeKeywords( const QStringList& );
88
89 public slots:
90   void deleteSelected();
91   void append( const QString& );  
92   void setText( const QString& text );
93   void setCurrentLine( int );
94
95 protected:
96   virtual void keyPressEvent( QKeyEvent* );
97   virtual void resizeEvent( QResizeEvent* );
98   virtual void paintEvent( QPaintEvent* );
99
100 private:
101   PyEditor_Editor( const PyEditor_Editor& );
102   PyEditor_Editor& operator=( const PyEditor_Editor& );
103 };
104
105 class PyEditor_FindTool : public QWidget
106
107 %TypeHeaderCode
108 #include <PyEditor_FindTool.h>
109 %End
110
111 public:
112   explicit PyEditor_FindTool( PyEditor_Editor* /TransferThis/, QWidget* /TransferThis/ = 0 );
113
114 public slots:
115   void activateFind();
116   void activateReplace();
117
118 private:
119   PyEditor_FindTool( const PyEditor_FindTool& );
120   PyEditor_FindTool& operator=( const PyEditor_FindTool& );
121 };
122
123 class PyEditor_Widget : public QWidget
124
125 %TypeHeaderCode
126 #include <PyEditor_Widget.h>
127 %End
128
129 public:
130   explicit PyEditor_Widget( QWidget* /TransferThis/ = 0 );
131
132   PyEditor_Editor* editor();
133   PyEditor_FindTool* findTool();
134
135   void setSettings( const PyEditor_Settings& );
136   const PyEditor_Settings& settings() const;
137
138   bool isModified();
139
140   QString text() const;
141
142   QStringList keywords() const;
143   void appendKeywords( const QStringList&, int, const QColor& = QColor() );
144   void removeKeywords( const QStringList& );
145
146   int completionPolicy() const;
147   void setCompletionPolicy( int );
148
149 public slots:
150   void find();
151   void replace();
152
153   void undo();
154   void redo();
155   void cut();
156   void copy();
157   void paste();
158   void deleteSelected();
159   void selectAll();
160   void clear();
161
162   void setModified( bool );
163
164   void setText( const QString& );
165
166   void setCurrentLine( int );
167
168 signals:
169   void modificationChanged( bool );
170   void undoAvailable( bool );
171   void redoAvailable( bool );
172   void copyAvailable( bool );
173   void selectionChanged();
174   void textChanged();
175   void cursorPositionChanged();
176
177 private:
178   PyEditor_Widget( const PyEditor_Widget& );
179   PyEditor_Widget& operator=( const PyEditor_Widget& );
180 };