Salome HOME
Merge branch 'pre/V8_3_BR'
[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
97 protected:
98   virtual void keyPressEvent( QKeyEvent* );
99   virtual void resizeEvent( QResizeEvent* );
100   virtual void paintEvent( QPaintEvent* );
101
102 private:
103   PyEditor_Editor( const PyEditor_Editor& );
104   PyEditor_Editor& operator=( const PyEditor_Editor& );
105 };
106
107 class PyEditor_FindTool : public QWidget
108
109 %TypeHeaderCode
110 #include <PyEditor_FindTool.h>
111 %End
112
113 public:
114   explicit PyEditor_FindTool( PyEditor_Editor* /TransferThis/, QWidget* /TransferThis/ = 0 );
115
116 public slots:
117   void activateFind();
118   void activateReplace();
119
120 private:
121   PyEditor_FindTool( const PyEditor_FindTool& );
122   PyEditor_FindTool& operator=( const PyEditor_FindTool& );
123 };
124
125 class PyEditor_Widget : public QWidget
126
127 %TypeHeaderCode
128 #include <PyEditor_Widget.h>
129 %End
130
131 public:
132   explicit PyEditor_Widget( QWidget* /TransferThis/ = 0 );
133
134   PyEditor_Editor* editor();
135   PyEditor_FindTool* findTool();
136
137   void setSettings( const PyEditor_Settings& );
138   const PyEditor_Settings& settings() const;
139
140   bool isModified();
141
142   QString text() const;
143
144   QStringList keywords() const;
145   void appendKeywords( const QStringList&, int, const QColor& = QColor() );
146   void removeKeywords( const QStringList& );
147
148   int completionPolicy() const;
149   void setCompletionPolicy( int );
150
151 public slots:
152   void find();
153   void replace();
154
155   void undo();
156   void redo();
157   void cut();
158   void copy();
159   void paste();
160   void deleteSelected();
161   void selectAll();
162   void clear();
163
164   void setModified( bool );
165
166   void setText( const QString& );
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 };