Salome HOME
Merge V9_dev branch into master
[modules/gui.git] / tools / PyEditor / src / python / PyEditorPy.sip
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : SalomePyQt.sip
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
24 //
25
26 %Module PyEditorPy
27
28 %Import QtCore/QtCoremod.sip
29 %Import QtGui/QtGuimod.sip
30 %If (Qt_5_0_0 -)
31 %Import QtWidgets/QtWidgetsmod.sip
32 %End
33
34 class PyEditor_Settings
35 {
36 %TypeHeaderCode
37 #include <PyEditor_Settings.h>
38 %End
39
40 public:
41   PyEditor_Settings();
42
43   void setHighlightCurrentLine( bool );
44   bool highlightCurrentLine() const;
45
46   void setTextWrapping( bool );
47   bool textWrapping() const;
48
49   void setCenterCursorOnScroll( bool );
50   bool centerCursorOnScroll() const;
51
52   void setLineNumberArea( bool );
53   bool lineNumberArea() const;
54
55   void setVerticalEdge( bool );
56   bool verticalEdge() const;
57
58   void setNumberColumns( int );
59   int numberColumns() const;
60
61   void setTabSpaceVisible( bool );
62   bool tabSpaceVisible() const;
63
64   void setTabSize( int );
65   int tabSize() const;
66
67   void setFont( const QFont& );
68   QFont font() const;
69
70   void setCompletionPolicy( int );
71   int completionPolicy() const;
72 };
73
74 class PyEditor_Editor : QPlainTextEdit
75
76 %TypeHeaderCode
77 #include <PyEditor_Editor.h>
78 %End
79
80 public:
81   explicit PyEditor_Editor( QWidget* /TransferThis/ = 0 );
82   virtual ~PyEditor_Editor();
83
84   void setSettings( const PyEditor_Settings& );
85   const PyEditor_Settings& settings() const;
86   QString text() const;
87
88   QStringList keywords() const;
89   void        appendKeywords( const QStringList&, int, const QColor& = QColor() );
90   void        removeKeywords( const QStringList& );
91
92 public slots:
93   void deleteSelected();
94   void append( const QString& );  
95   void setText( const QString& text );
96   void setCurrentLine( int );
97
98 protected:
99   virtual void keyPressEvent( QKeyEvent* );
100   virtual void resizeEvent( QResizeEvent* );
101   virtual void paintEvent( QPaintEvent* );
102
103 private:
104   PyEditor_Editor( const PyEditor_Editor& );
105   PyEditor_Editor& operator=( const PyEditor_Editor& );
106 };
107
108 class PyEditor_FindTool : public QWidget
109
110 %TypeHeaderCode
111 #include <PyEditor_FindTool.h>
112 %End
113
114 public:
115   explicit PyEditor_FindTool( PyEditor_Editor* /TransferThis/, QWidget* /TransferThis/ = 0 );
116
117 public slots:
118   void activateFind();
119   void activateReplace();
120
121 private:
122   PyEditor_FindTool( const PyEditor_FindTool& );
123   PyEditor_FindTool& operator=( const PyEditor_FindTool& );
124 };
125
126 class PyEditor_Widget : public QWidget
127
128 %TypeHeaderCode
129 #include <PyEditor_Widget.h>
130 %End
131
132 public:
133   explicit PyEditor_Widget( QWidget* /TransferThis/ = 0 );
134
135   PyEditor_Editor* editor();
136   PyEditor_FindTool* findTool();
137
138   void setSettings( const PyEditor_Settings& );
139   const PyEditor_Settings& settings() const;
140
141   bool isModified();
142
143   QString text() const;
144
145   QStringList keywords() const;
146   void appendKeywords( const QStringList&, int, const QColor& = QColor() );
147   void removeKeywords( const QStringList& );
148
149   int completionPolicy() const;
150   void setCompletionPolicy( int );
151
152 public slots:
153   void find();
154   void replace();
155
156   void undo();
157   void redo();
158   void cut();
159   void copy();
160   void paste();
161   void deleteSelected();
162   void selectAll();
163   void clear();
164
165   void setModified( bool );
166
167   void setText( const QString& );
168
169   void setCurrentLine( int );
170
171 signals:
172   void modificationChanged( bool );
173   void undoAvailable( bool );
174   void redoAvailable( bool );
175   void copyAvailable( bool );
176   void selectionChanged();
177   void textChanged();
178   void cursorPositionChanged();
179
180 private:
181   PyEditor_Widget( const PyEditor_Widget& );
182   PyEditor_Widget& operator=( const PyEditor_Widget& );
183 };