1 // Copyright (C) 2007-2024 CEA, EDF, 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
23 // File : StdMeshersGUI_ObjectReferenceParamWdg.h
24 // Author : Open CASCADE S.A.S.
26 #ifndef STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H
27 #define STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H
30 #include "SMESH_StdMeshersGUI.hxx"
32 #include <SMESH_Type.h>
38 #include <omniORB4/CORBA.h>
40 #include <SALOMEconfig.h>
41 #include CORBA_SERVER_HEADER(SMESH_Mesh)
43 class SUIT_SelectionFilter;
45 class LightApp_SelectionMgr;
50 * \brief Widget controlling hypothesis parameter that is an object reference
52 class STDMESHERSGUI_EXPORT StdMeshersGUI_ObjectReferenceParamWdg : public QWidget
57 StdMeshersGUI_ObjectReferenceParamWdg( SUIT_SelectionFilter* filter,
59 bool multiSelection=false
60 /* ,bool stretch=true*/);
61 StdMeshersGUI_ObjectReferenceParamWdg( SMESH::MeshObjectType objType,
63 bool multiSelection=false);
64 ~StdMeshersGUI_ObjectReferenceParamWdg();
66 void SetObject(CORBA::Object_ptr obj);
68 void SetObjects(SMESH::string_array_var& objEntries);
70 template<class TInterface>
71 typename TInterface::_var_type GetObject(size_t i=0) const {
72 if ( IsObjectSelected(i) ) return TInterface::_narrow(myObjects[i]);
73 return TInterface::_nil();
76 size_t NbObjects() const { return myObjects.size(); }
78 // Return object entries
79 QString GetValue() const { return myParamValue; }
81 bool IsObjectSelected(size_t i=0) const
82 { return i < myObjects.size() && !CORBA::is_nil(myObjects[i]); }
85 * \brief Get the selection status
87 * Useful to know which Object Reference param widget is activated
88 * to be able to activate the next one when the content of this
89 * one has been modified
91 bool IsSelectionActivated() const { return mySelectionActivated; }
93 void AvoidSimultaneousSelection( StdMeshersGUI_ObjectReferenceParamWdg* other);
95 void SetDefaultText(QString defaultText="", QString styleSheet="");
99 * \brief Activates selection (if not yet done), emits selectionActivated()
101 * Useful to deactivate one Object Reference param widget when an other
104 void activateSelection();
105 void deactivateSelection();
109 * \brief Emitted when selection is activated
111 * Useful to deactivate one Object Reference param widget when an other
114 void selectionActivated();
115 void contentModified();
118 void onSelectionDone();
125 bool myMultiSelection;
126 std::vector<CORBA::Object_var> myObjects;
128 SUIT_SelectionFilter* myFilter;
129 bool mySelectionActivated;
130 bool myStretchActivated;
132 SMESHGUI* mySMESHGUI;
133 LightApp_SelectionMgr* mySelectionMgr;
135 QLineEdit* myObjNameLineEdit;
136 QPushButton* mySelButton;
137 QString myParamValue;
139 QString myEmptyStyleSheet;
142 #endif // STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H