Salome HOME
6532da830562543cad82573c32a0d3fdbc17f06e
[modules/gui.git] / src / SALOME_SWIG / SALOMEGUI_Swig.i
1 // Copyright (C) 2007-2023  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
23 //  SALOME SALOMEGUI : implementation of desktop and GUI kernel
24 //  File   : SALOMEGUI_Swig.i
25 //  Author : Paul RASCLE, EDF
26 //
27 %{
28 #include "SALOMEGUI_Swig.hxx"
29 %}
30
31 %include "cpointer.i"
32 %include "std_string.i"
33 %include "std_list.i"
34
35 #if SWIG_VERSION >= 0x010329
36 %template() std::list<std::string>;
37 #endif
38
39 /* Exception handler for all functions */
40 %exception {
41   class PyAllowThreadsGuard {
42    public:
43     // Py_BEGIN_ALLOW_THREADS
44     PyAllowThreadsGuard() { _save = PyEval_SaveThread(); }
45     // Py_END_ALLOW_THREADS
46     ~PyAllowThreadsGuard() { PyEval_RestoreThread( _save ); }
47    private:
48     PyThreadState* _save;
49   };
50
51   PyAllowThreadsGuard guard;
52
53   $action
54 }
55
56 class SALOMEGUI_Swig
57 {
58 public:
59   SALOMEGUI_Swig();
60   virtual ~SALOMEGUI_Swig();
61
62   /* check GUI */
63   bool hasDesktop();
64
65   /* update object browser*/
66   void updateObjBrowser();
67
68   /* get active study */
69   const char *getActiveStudyName();
70
71   /* get component name/username */
72   const char* getComponentName( const char* ComponentUserName );
73   const char* getComponentUserName( const char* ComponentName );
74
75   /* selection processing */
76   int SelectedCount();
77   const char *getSelected(int i);
78   void AddIObject(const char *Entry);
79   void RemoveIObject(const char *Entry);
80   void ClearIObjects();
81
82   /* display/erase */
83   void Display(const char *Entry);
84   void DisplayOnly(const char *Entry);
85   void Erase(const char *Entry);
86   void DisplayAll();
87   void EraseAll();
88   bool IsInCurrentView(const char *Entry);
89   void UpdateView();
90
91   /* view operations */
92   void FitAll();
93   void FitSelection();
94   void FitIObjects(const std::list<std::string>&);
95   void ResetView();
96   void ViewTop();
97   void ViewBottom();
98   void ViewLeft();
99   void ViewRight();
100   void ViewFront();
101   void ViewBack();
102
103   /* view parameters */
104   const char* getViewParameters();
105   void setCameraPosition( double x, double y, double z );
106   void setCameraFocalPoint( double x, double y, double z );
107   void setCameraViewUp( double x, double y, double z );
108   void setViewScale( double parallelScale,double x, double y, double z );
109 };