1 // Copyright (C) 2007-2010 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.
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>
40 #include CORBA_SERVER_HEADER(SMESH_Mesh)
42 class SUIT_SelectionFilter;
44 class LightApp_SelectionMgr;
49 * \brief Widget controlling hypothesis parameter that is an object reference
51 class STDMESHERSGUI_EXPORT StdMeshersGUI_ObjectReferenceParamWdg : public QWidget
56 StdMeshersGUI_ObjectReferenceParamWdg( SUIT_SelectionFilter* filter,
58 bool multiSelection=false);
59 StdMeshersGUI_ObjectReferenceParamWdg( MeshObjectType objType,
61 bool multiSelection=false);
62 ~StdMeshersGUI_ObjectReferenceParamWdg();
64 void SetObject(CORBA::Object_ptr obj);
66 void SetObjects(SMESH::string_array_var& objEntries);
68 template<class TInterface>
69 typename TInterface::_var_type GetObject(unsigned i=0) const {
70 if ( IsObjectSelected(i) ) return TInterface::_narrow(myObjects[i]);
71 return TInterface::_nil();
74 int NbObjects() const { return myObjects.size(); }
76 QString GetValue() const { return myParamValue; }
78 bool IsObjectSelected(unsigned i=0) const
79 { return i < myObjects.size() && !CORBA::is_nil(myObjects[i]); }
81 void AvoidSimultaneousSelection( StdMeshersGUI_ObjectReferenceParamWdg* other);
83 void SetDefaultText(QString defaultText="", QString styleSheet="");
87 * \brief Activates selection (if not yet done), emits selectionActivated()
89 * Useful to deactivate one Object Reference param widget when an other
92 void activateSelection();
93 void deactivateSelection();
97 * \brief Emitted when selection is activated
99 * Useful to deactivate one Object Reference param widget when an other
102 void selectionActivated();
103 void contentModified();
106 void onSelectionDone();
113 bool myMultiSelection;
114 std::vector<CORBA::Object_var> myObjects;
116 SUIT_SelectionFilter* myFilter;
117 bool mySelectionActivated;
119 SMESHGUI* mySMESHGUI;
120 LightApp_SelectionMgr* mySelectionMgr;
122 QLineEdit* myObjNameLineEdit;
123 QPushButton* mySelButton;
124 QString myParamValue;
126 QString myEmptyStyleSheet;
129 #endif // STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H