1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SalomePyQt.sip
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
34 #include <QtxAction.h>
35 #include <QtxActionSet.h>
36 #include <QtxActionGroup.h>
37 #include <SalomePyQt.h>
38 #include <Plot2d_Curve.h>
41 class SALOME_Selection : QObject
44 #include <SalomePyQt.h>
48 void Clear() /ReleaseGIL/ ;
49 void ClearIObjects() /ReleaseGIL/ ;
50 void ClearFilters() /ReleaseGIL/ ;
53 SALOME_Selection( QObject* /TransferThis/ );
56 void currentSelectionChanged();
116 class QtxAction : QWidgetAction
119 #include <QtxAction.h>
122 %ConvertToSubClassCode
123 if ( qobject_cast<QtxAction*>( sipCpp ) )
124 sipClass = sipClass_QtxAction;
130 explicit QtxAction( QObject* /TransferThis/ = 0, bool = false );
131 QtxAction( const QString&, const QString&, int, QObject* /TransferThis/, bool = false );
132 QtxAction( const QString&, const QIcon&, const QString&, int, QObject* /TransferThis/, bool = false );
133 virtual ~QtxAction();
136 QtxAction( const QtxAction& );
139 class QtxActionSet : QtxAction
142 #include <QtxActionSet.h>
145 %ConvertToSubClassCode
146 if ( qobject_cast<QtxActionSet*>( sipCpp ) )
147 sipClass = sipClass_QtxActionSet;
153 explicit QtxActionSet( QObject* /TransferThis/ = 0 );
154 virtual ~QtxActionSet();
156 QList<QAction*> actions() const;
157 void setActions( const QList<QAction*>& );
159 void insertActions( const QList<QAction*>&, const int = -1 );
161 int insertAction( QAction*, const int id = -1, const int = -1 );
162 int insertAction( const QString&, const int id = -1, const int = -1 );
163 int insertAction( const QString&, const QIcon&, const int id = -1, const int = -1 );
165 void removeAction( QAction* );
166 void removeAction( const int );
171 void triggered( int );
172 void triggered( QAction* );
175 QtxActionSet( const QtxActionSet& );
178 class QtxActionGroup : QtxActionSet
181 #include <QtxActionGroup.h>
184 %ConvertToSubClassCode
185 if ( qobject_cast<QtxActionGroup*>( sipCpp ) )
186 sipClass = sipClass_QtxActionGroup;
192 explicit QtxActionGroup( QObject* /TransferThis/ = 0 );
193 QtxActionGroup( QObject* /TransferThis/, const bool );
194 virtual ~QtxActionGroup();
196 bool isExclusive() const;
197 bool usesDropDown() const;
199 void add( QAction* );
202 void setExclusive( const bool );
203 void setUsesDropDown( const bool );
206 void selected( QAction* );
209 QtxActionGroup( const QtxActionGroup& );
226 #include <Plot2d_Curve.h>
229 %ConvertToSubClassCode
230 if ( dynamic_cast<Plot2d_Curve*>( sipCpp ) )
231 sipClass = sipClass_Plot2d_Curve;
238 virtual ~Plot2d_Curve();
239 void setName( const QString& );
240 void addPoint( double, double );
241 void addPoints(SIP_PYLIST X, SIP_PYLIST Y);
243 int nx = PyList_Size(a0);
244 int ny = PyList_Size(a1);
247 PyErr_Format(PyExc_TypeError,"The dimension of x and y should be the same. It is %d and %d currently.", nx, ny);
253 for (i=0; i<nx; i++) {
254 pX = PyList_GET_ITEM(a0,i);
255 pY = PyList_GET_ITEM(a1,i);
256 double aX = PyFloat_AsDouble(pX);
257 double aY = PyFloat_AsDouble(pY);
258 sipCpp->addPoint(aX, aY);
261 void insertPoint( int, double, double );
262 void deletePoint( int );
263 void clearAllPoints();
264 void setXAxis( Axis );
267 sipCpp->setXAxis(QwtPlot::Axis(ax));
269 Axis getXAxis() const;
271 sipRes = Axis(sipCpp->getXAxis());
273 void setYAxis( Axis );
276 sipCpp->setYAxis(QwtPlot::Axis(ay));
278 Axis getYAxis() const;
280 sipRes = Axis(sipCpp->getYAxis());
295 #include <SalomePyQt.h>
299 /* KeepReference is necessary on method getDesktop with SIP >= 4.15.5 to avoid garbage collection of
300 the Python objects added to the desktop. This causes a small memory leak (the wrapper around desktop
301 object is never garbage collected) but since this object contains only references this is not
302 considered a big problem. With versions < 4.15, it seems that this reference was kept implicitly.
303 No proper solution was found for versions between 4.15 and 4.15.4 (included), so those versions
304 should not be used to compile GUI module.
307 static QWidget* getDesktop() /ReleaseGIL,KeepReference/ ;
310 static QWidget* getDesktop() /ReleaseGIL/ ;
313 static QWidget* getMainFrame() /ReleaseGIL/ ;
314 static QMenuBar* getMainMenuBar() /ReleaseGIL/ ;
315 static QMenu* getPopupMenu( const MenuName ) /ReleaseGIL/ ;
316 static QMenu* getPopupMenu( const QString& ) /ReleaseGIL/ ;
317 static QTreeView* getObjectBrowser() /ReleaseGIL/ ;
318 static SALOME_Selection* getSelection() /Factory,ReleaseGIL/ ;
319 static int getStudyId() /ReleaseGIL/ ;
320 static void putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ;
321 static const QString getActiveComponent() /ReleaseGIL/ ;
322 static SIP_PYOBJECT getActivePythonModule() /ReleaseGIL/ ;
323 static bool activateModule( const QString& ) /ReleaseGIL/ ;
324 static void updateObjBrowser( const int = 0, bool = true ) /ReleaseGIL/ ;
326 static bool isModified() /ReleaseGIL/ ;
327 static void setModified( bool ) /ReleaseGIL/ ;
329 static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ;
330 static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ;
331 static QString getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ;
333 static QString createObject( const QString& = QString("") ) /ReleaseGIL/ ;
334 static QString createObject( const QString&,
337 const QString& = QString("") ) /ReleaseGIL/ ;
339 static void setName(const QString& ,const QString& ) /ReleaseGIL/ ;
340 static void setIcon(const QString& ,const QString& ) /ReleaseGIL/ ;
341 static void setToolTip(const QString& ,const QString& ) /ReleaseGIL/ ;
342 static QString getName(const QString& ) /ReleaseGIL/ ;
343 static QString getToolTip(const QString& ) /ReleaseGIL/ ;
345 static void setVisibilityState( const QString&, VisibilityState );
346 static VisibilityState getVisibilityState( const QString& );
348 static void setObjectPosition( const QString&, int );
349 static int getObjectPosition( const QString& );
351 static void setColor( const QString&, const QColor& ) /ReleaseGIL/ ;
352 static QColor getColor( const QString& ) /ReleaseGIL/ ;
354 static void setReference( const QString& ,const QString& ) /ReleaseGIL/ ;
355 static QString getReference( const QString& ) /ReleaseGIL/ ;
357 static void removeObject(const QString& ) /ReleaseGIL/ ;
358 static void removeChildren(const QString& = QString("") ) /ReleaseGIL/ ;
359 static void removeChild(const QString& = QString("") ) /ReleaseGIL/ ;
360 static QStringList getChildren(const QString&=QString("") , const bool = false) /ReleaseGIL/ ;
362 static QIcon loadIcon( const QString&, const QString& ) /ReleaseGIL/ ;
363 static void helpContext( const QString&, const QString& ) /ReleaseGIL/ ;
365 static bool dumpView( const QString&, const int = 0 ) /ReleaseGIL/ ;
367 static int defaultMenuGroup() /ReleaseGIL/ ;
369 static int createTool( const QString&, const QString& = QString() ) /ReleaseGIL/ ;
370 static int createTool( const int, const int, const int = -1 ) /ReleaseGIL/ ;
371 static int createTool( const int, const QString&, const int = -1 ) /ReleaseGIL/ ;
372 static int createTool( QAction*, const int, const int = -1, const int = -1 ) /ReleaseGIL/ ;
373 static int createTool( QAction*, const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ;
375 static int createMenu( const QString&, const int,
376 const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ;
377 static int createMenu( const QString&, const QString&,
378 const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ;
379 static int createMenu( const int, const int,
380 const int = -1, const int = -1 ) /ReleaseGIL/ ;
381 static int createMenu( const int, const QString&,
382 const int = -1, const int = -1 ) /ReleaseGIL/ ;
383 static int createMenu( QAction*, const int, const int = -1,
384 const int = -1, const int = -1 ) /ReleaseGIL/ ;
385 static int createMenu( QAction*, const QString&, const int = -1,
386 const int = -1, const int = -1 ) /ReleaseGIL/ ;
387 static QAction* createSeparator() /ReleaseGIL/ ;
389 static QAction* createAction( const int, const QString&,
390 const QString& = QString(), const QString& = QString(),
391 const QString& = QString(), const int = 0, const bool = false ) /ReleaseGIL/ ;
393 static QtxActionGroup* createActionGroup( const int, const bool = true ) /ReleaseGIL/ ;
395 static QAction* action( const int ) /ReleaseGIL/ ;
396 static int actionId( const QAction* ) /ReleaseGIL/ ;
398 static void addSetting ( const QString&, const QString&, const double ) /ReleaseGIL/ ;
399 static void addSetting ( const QString&, const QString&, const int /Constrained/ ) /ReleaseGIL/ ;
400 static void addSetting ( const QString&, const QString&, const bool, const int ) /ReleaseGIL/ ;
401 static void addSetting ( const QString&, const QString&, const QString& ) /ReleaseGIL/ ;
402 static void addSetting ( const QString&, const QString&, const QColor& ) /ReleaseGIL/ ;
403 static int integerSetting( const QString&, const QString&, const int = 0 ) /ReleaseGIL/ ;
404 static double doubleSetting ( const QString&, const QString&, const double = 0 ) /ReleaseGIL/ ;
405 static bool boolSetting ( const QString&, const QString&, const bool = false ) /ReleaseGIL/ ;
406 static QString stringSetting ( const QString&, const QString&, const QString& = QString("") ) /ReleaseGIL/ ;
407 static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() ) /ReleaseGIL/ ;
408 static void removeSetting ( const QString&, const QString& ) /ReleaseGIL/ ;
409 static bool hasSetting ( const QString&, const QString& ) /ReleaseGIL/ ;
412 static void addStringSetting( const QString&, const QString&, bool = true ) /ReleaseGIL/ ;
413 static void addIntSetting ( const QString&, const int, bool = true ) /ReleaseGIL/ ;
414 static void addDoubleSetting( const QString&, const double, bool = true ) /ReleaseGIL/ ;
415 static void addBoolSetting ( const QString&, const bool, bool = true ) /ReleaseGIL/ ;
416 static void removeSettings ( const QString& ) /ReleaseGIL/ ;
417 static QString getSetting ( const QString& ) /ReleaseGIL/ ;
419 static int addGlobalPreference( const QString& ) /ReleaseGIL/ ;
420 static int addPreference( const QString& ) /ReleaseGIL/ ;
421 static int addPreference( const QString&,
422 const int, const int = PT_Auto,
423 const QString& = QString(),
424 const QString& = QString() ) /ReleaseGIL/ ;
425 static QVariant preferenceProperty( const int, const QString& ) /ReleaseGIL/ ;
426 static void setPreferenceProperty( const int,
428 const QVariant& ) /ReleaseGIL/ ;
429 static void addPreferenceProperty( const int,
432 const QVariant& ) /ReleaseGIL/ ;
434 static void message( const QString&, bool = true ) /ReleaseGIL/ ;
435 static void clearMessages() /ReleaseGIL/ ;
437 static QList<int> getViews() /ReleaseGIL/ ;
438 static int getActiveView() /ReleaseGIL/ ;
439 static QString getViewType( const int ) /ReleaseGIL/ ;
440 static bool setViewTitle( const int, const QString& ) /ReleaseGIL/ ;
441 static QString getViewTitle( const int ) /ReleaseGIL/ ;
442 static QList<int> findViews( const QString& ) /ReleaseGIL/ ;
443 static bool activateView( const int ) /ReleaseGIL/ ;
444 static int createView( const QString&, bool visible = true, const int width = 0, const int height = 0 ) /ReleaseGIL/ ;
445 static int createView( const QString&, QWidget* ) /ReleaseGIL/ ;
446 static bool closeView( const int ) /ReleaseGIL/ ;
447 static int cloneView( const int ) /ReleaseGIL/ ;
448 static void setViewVisible( const int id, bool visible = true ) /ReleaseGIL/ ;
449 static bool isViewVisible( const int id ) /ReleaseGIL/ ;
450 static void setViewClosable( const int id, const bool ) /ReleaseGIL/ ;
451 static bool isViewClosable( const int id ) /ReleaseGIL/ ;
453 static bool groupAllViews() /ReleaseGIL/ ;
454 static bool splitView( const int, Orientation, Action ) /ReleaseGIL/ ;
455 static bool moveView( const int, const int, const bool ) /ReleaseGIL/ ;
456 static QList<int> neighbourViews( const int ) /ReleaseGIL/ ;
458 static void displayCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
459 static void eraseCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
460 static void eraseCurve(Plot2d_Curve*) /ReleaseGIL/ ;
461 static void updateCurves( const int ) /ReleaseGIL/ ;
462 static QString getPlot2dTitle(const int, ObjectType = MainTitle) /ReleaseGIL/ ;
463 static void setPlot2dTitle(const int, const QString&, ObjectType = MainTitle, bool = true) /ReleaseGIL/ ;
464 static QList<double> getPlot2dFitRangeByCurves(const int) /ReleaseGIL/ ;
465 static QList<double> getPlot2dFitRangeCurrent(const int) /ReleaseGIL/ ;
466 static void setPlot2dFitRange(const int, const double XMin, const double XMax, const double YMin, const double YMax ) /ReleaseGIL/ ;