Salome HOME
Update copyright information
[modules/filter.git] / src / FILTERGUI / FILTERGUI_Utils.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
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.
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 #ifndef FILTERGUI_Utils_HeaderFile
20 #define FILTERGUI_Utils_HeaderFile
21
22 #include <CORBA.h>
23
24 #include "SALOMEDSClient_definitions.hxx"
25 #include "SALOME_InteractiveObject.hxx"
26 #include "LightApp_DataOwner.h"
27
28 class QString;
29
30 class SUIT_ViewWindow;
31 class SUIT_Desktop;
32 class SUIT_Study;
33 class SUIT_ResourceMgr;
34
35 class CAM_Module;
36
37 class SALOMEDSClient_Study;
38 class SALOMEDSClient_SObject;
39
40 class SalomeApp_Study;
41 class SalomeApp_Module;
42 class LightApp_SelectionMgr;
43
44 namespace FILTER {
45
46   SUIT_Desktop*
47   GetDesktop(const CAM_Module* theModule);
48
49   LightApp_SelectionMgr*
50   GetSelectionMgr(const SalomeApp_Module* theModule);
51
52   SalomeApp_Study*
53   GetAppStudy(const CAM_Module* theModule);
54
55   SUIT_ResourceMgr*
56   GetResourceMgr( const SalomeApp_Module* );
57   
58   _PTR(Study)
59   GetCStudy(const SalomeApp_Study* theStudy);
60
61   CORBA::Object_var DataOwnerToObject(const LightApp_DataOwnerPtr& theOwner);
62
63   template<class TInterface> typename TInterface::_var_type
64     DataOwnerToInterface(const LightApp_DataOwnerPtr& theDataOwner)
65     {
66       CORBA::Object_var anObj = DataOwnerToObject(theDataOwner);
67       if(!CORBA::is_nil(anObj))
68         return TInterface::_narrow(anObj);
69       return TInterface::_nil();
70     }
71
72
73   SUIT_Study* GetActiveStudy();
74
75   SUIT_ViewWindow* GetActiveWindow();
76
77   _PTR(Study) GetActiveStudyDocument();
78
79   _PTR(SObject) FindSObject(CORBA::Object_ptr theObject);
80
81   void SetName  (_PTR(SObject) theSObject, const char* theName);
82   void SetValue (_PTR(SObject) theSObject, const char* theValue);
83   void setFileType (_PTR(SObject) theSObject, const char* theValue);
84   void setFileName (_PTR(SObject) theSObject, const char* theValue);
85
86   CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject,
87                                      _PTR(Study) theStudy);
88
89   CORBA::Object_var SObjectToObject(_PTR(SObject) theSObject);
90
91   template<class TInterface> typename TInterface::_var_type
92     SObjectToInterface(_PTR(SObject) theSObject)
93     {
94       CORBA::Object_var anObj = SObjectToObject(theSObject);
95       if(!CORBA::is_nil(anObj))
96         return TInterface::_narrow(anObj);
97       return TInterface::_nil();
98     }
99
100   CORBA::Object_var IObjectToObject(const Handle(SALOME_InteractiveObject)& theIO);
101
102   template<class TInterface> typename TInterface::_var_type
103     IObjectToInterface(const Handle(SALOME_InteractiveObject)& theIO)
104     {
105       CORBA::Object_var anObj = IObjectToObject(theIO);
106       if(!CORBA::is_nil(anObj))
107         return TInterface::_narrow(anObj);
108       return TInterface::_nil();
109     }
110
111   CORBA::Object_var IORToObject(const char* theIOR);
112
113   template<class TInterface> typename TInterface::_var_type
114     IORToInterface(const char* theIOR)
115     {
116       CORBA::Object_var anObj = IORToObject(theIOR);
117       if(!CORBA::is_nil(anObj))
118         return TInterface::_narrow(anObj);
119       return TInterface::_nil();
120     }
121
122   int GetNameOfSelectedIObjects (LightApp_SelectionMgr*, QString& theName);
123
124 //  void UpdateObjBrowser (bool);
125 }
126
127 #endif