Version: 9.12.0
StdMeshersGUI_ObjectReferenceParamWdg.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, 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 // File : StdMeshersGUI_ObjectReferenceParamWdg.h
24 // Author : Open CASCADE S.A.S.
25 //
26 #ifndef STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H
27 #define STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H
28 
29 // SMESH includes
30 #include "SMESH_StdMeshersGUI.hxx"
31 
32 #include <SMESH_Type.h>
33 
34 // Qt includes
35 #include <QWidget>
36 
37 // CORBA includes
38 #include <omniORB4/CORBA.h>
39 
40 #include <SALOMEconfig.h>
41 #include CORBA_SERVER_HEADER(SMESH_Mesh)
42 
44 class SMESHGUI;
45 class LightApp_SelectionMgr;
46 class QLineEdit;
47 class QPushButton;
48 
53 {
54  Q_OBJECT
55 
56  public:
58  QWidget* parent,
59  bool multiSelection=false
60  /* ,bool stretch=true*/);
62  QWidget* parent,
63  bool multiSelection=false);
65 
66  void SetObject(CORBA::Object_ptr obj);
67 
68  void SetObjects(SMESH::string_array_var& objEntries);
69 
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();
74  }
75 
76  size_t NbObjects() const { return myObjects.size(); }
77 
78  // Return object entries
79  QString GetValue() const { return myParamValue; }
80 
81  bool IsObjectSelected(size_t i=0) const
82  { return i < myObjects.size() && !CORBA::is_nil(myObjects[i]); }
83 
91  bool IsSelectionActivated() const { return mySelectionActivated; }
92 
93  void AvoidSimultaneousSelection( StdMeshersGUI_ObjectReferenceParamWdg* other);
94 
95  void SetDefaultText(QString defaultText="", QString styleSheet="");
96 
97  public slots:
104  void activateSelection();
105  void deactivateSelection();
106 
107  signals:
116 
117  private slots:
118  void onSelectionDone();
119 
120  private:
121  void init();
122 
123  private:
124 
126  std::vector<CORBA::Object_var> myObjects;
127 
131 
133  LightApp_SelectionMgr* mySelectionMgr;
134 
135  QLineEdit* myObjNameLineEdit;
136  QPushButton* mySelButton;
137  QString myParamValue;
138  QString myEmptyText;
140 };
141 
142 #endif // STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H
#define STDMESHERSGUI_EXPORT
Definition: SMESH_StdMeshersGUI.hxx:36
Definition: SMESHGUI.h:84
Widget controlling hypothesis parameter that is an object reference.
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:53
SUIT_SelectionFilter * myFilter
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:128
bool mySelectionActivated
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:129
QString myEmptyStyleSheet
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:139
bool myStretchActivated
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:130
bool IsSelectionActivated() const
Get the selection status.
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:91
bool myMultiSelection
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:125
QString myEmptyText
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:138
size_t NbObjects() const
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:76
LightApp_SelectionMgr * mySelectionMgr
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:133
SMESHGUI * mySMESHGUI
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:132
QString GetValue() const
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:79
bool IsObjectSelected(size_t i=0) const
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:81
std::vector< CORBA::Object_var > myObjects
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:126
QString myParamValue
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:137
TInterface::_var_type GetObject(size_t i=0) const
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:71
QPushButton * mySelButton
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:136
QLineEdit * myObjNameLineEdit
Definition: StdMeshersGUI_ObjectReferenceParamWdg.h:135
void selectionActivated()
Emitted when selection is activated.
MeshObjectType
Definition: SMESH_Type.h:43