00001 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE 00002 // 00003 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 00005 // 00006 // This library is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 // 00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00021 // 00022 00023 // SMESH SMESHGUI : GUI for SMESH component 00024 // File : SMESHGUI_GroupDlg.h 00025 // Author : Natalia KOPNOVA, Open CASCADE S.A.S. 00026 // 00027 #ifndef SMESHGUI_GROUPDLG_H 00028 #define SMESHGUI_GROUPDLG_H 00029 00030 // SMESH includes 00031 #include "SMESH_SMESHGUI.hxx" 00032 00033 // Qt includes 00034 #include <QDialog> 00035 #include <QList> 00036 #include <QMap> 00037 00038 // IDL includes 00039 #include <SALOMEconfig.h> 00040 #include CORBA_SERVER_HEADER(SMESH_Mesh) 00041 #include CORBA_SERVER_HEADER(SMESH_Group) 00042 00043 class QGroupBox; 00044 class QLabel; 00045 class QLineEdit; 00046 class QButtonGroup; 00047 class QListWidget; 00048 class QMenu; 00049 class QPushButton; 00050 class QToolButton; 00051 class QCheckBox; 00052 class QStackedWidget; 00053 class QAction; 00054 class SMESHGUI; 00055 class SMESH_Actor; 00056 class SMESHGUI_FilterDlg; 00057 class SMESHGUI_ShapeByMeshOp; 00058 class QtxColorButton; 00059 class SUIT_Operation; 00060 class SVTK_Selector; 00061 class SUIT_SelectionFilter; 00062 class LightApp_SelectionMgr; 00063 00064 //================================================================================= 00065 // class : SMESHGUI_GroupDlg 00066 // purpose : 00067 //================================================================================= 00068 class SMESHGUI_EXPORT SMESHGUI_GroupDlg : public QDialog 00069 { 00070 Q_OBJECT 00071 00072 public: 00073 SMESHGUI_GroupDlg( SMESHGUI*, 00074 SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() ); 00075 SMESHGUI_GroupDlg( SMESHGUI*, 00076 SMESH::SMESH_GroupBase_ptr, 00077 const bool theIsConvert = false ); 00078 ~SMESHGUI_GroupDlg(); 00079 00080 static QString GetDefaultName( const QString& ); 00081 00082 public slots: 00083 void onAdd(); 00084 void onRemove(); 00085 00086 private slots: 00087 void onTypeChanged( int ); 00088 void onGrpTypeChanged( int ); 00089 void onColorChanged( QColor ); 00090 00091 void onOK(); 00092 void onClose(); 00093 bool onApply(); 00094 void onHelp(); 00095 void onDeactivate(); 00096 void onVisibilityChanged(); 00097 00098 void onListSelectionChanged(); 00099 void onObjectSelectionChanged(); 00100 00101 void onSelectAll(); 00102 void onSelectSubMesh( bool ); 00103 void onSelectGroup( bool ); 00104 void onSelectGeomGroup( bool ); 00105 void setCurrentSelection(); 00106 00107 void setFilters(); 00108 void onSort(); 00109 00110 void onNameChanged( const QString& ); 00111 void onFilterAccepted(); 00112 00113 void onGeomPopup( QAction* ); 00114 void onGeomSelectionButton( bool ); 00115 00116 void onPublishShapeByMeshDlg( SUIT_Operation* ); 00117 void onCloseShapeByMeshDlg( SUIT_Operation* ); 00118 00119 private: 00120 void initDialog( bool ); 00121 void init( SMESH::SMESH_Mesh_ptr ); 00122 void init( SMESH::SMESH_GroupBase_ptr, 00123 const bool theIsConvert = false ); 00124 void closeEvent( QCloseEvent* ); 00125 void enterEvent( QEvent* ); 00126 void hideEvent( QHideEvent* ); /* ESC key */ 00127 void keyPressEvent( QKeyEvent* ); 00128 void setSelectionMode( int ); 00129 void updateButtons(); 00130 void updateGeomPopup(); 00131 bool SetAppropriateActor(); 00132 void setShowEntityMode(); 00133 void restoreShowEntityMode(); 00134 00135 bool IsActorVisible( SMESH_Actor* ); 00136 00137 void setGroupColor( const SALOMEDS::Color& ); 00138 SALOMEDS::Color getGroupColor() const; 00139 00140 void setGroupQColor( const QColor& ); 00141 QColor getGroupQColor() const; 00142 00143 void setDefaultGroupColor(); 00144 00145 void setIsApplyAndClose( const bool theFlag ); 00146 bool isApplyAndClose() const; 00147 00148 SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ 00149 LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ 00150 int myGrpTypeId; /* Current group type id : standalone or group on geometry */ 00151 int myTypeId; /* Current type id = radio button id */ 00152 int myStoredShownEntity; /* Store ShowEntity mode of myMesh */ 00153 QLineEdit* myCurrentLineEdit; /* Current LineEdit */ 00154 SVTK_Selector* mySelector; 00155 00156 QPushButton* myMeshGroupBtn; 00157 QLineEdit* myMeshGroupLine; 00158 00159 QButtonGroup* myTypeGroup; 00160 QLineEdit* myName; 00161 QString myOldName; 00162 00163 QButtonGroup* myGrpTypeGroup; 00164 00165 QStackedWidget* myWGStack; 00166 QCheckBox* mySelectAll; 00167 QLabel* myElementsLab; 00168 QListWidget* myElements; 00169 QPushButton* myFilter; 00170 QPushButton* myAddBtn; 00171 QPushButton* myRemoveBtn; 00172 QPushButton* mySortBtn; 00173 00174 QGroupBox* mySelectBox; 00175 QCheckBox* mySelectSubMesh; 00176 QPushButton* mySubMeshBtn; 00177 QLineEdit* mySubMeshLine; 00178 QCheckBox* mySelectGroup; 00179 QPushButton* myGroupBtn; 00180 QLineEdit* myGroupLine; 00181 00182 QtxColorButton* myColorBtn; 00183 00184 QCheckBox* mySelectGeomGroup; 00185 QToolButton* myGeomGroupBtn; 00186 QLineEdit* myGeomGroupLine; 00187 QMenu* myGeomPopup; 00188 00189 QPushButton* myOKBtn; 00190 QPushButton* myApplyBtn; 00191 QPushButton* myCloseBtn; 00192 QPushButton* myHelpBtn; 00193 00194 SMESHGUI_ShapeByMeshOp* myShapeByMeshOp; 00195 00196 SMESH::SMESH_Mesh_var myMesh; 00197 QList<SMESH_Actor*> myActorsList; 00198 SMESH::SMESH_Group_var myGroup; 00199 SMESH::SMESH_GroupOnGeom_var myGroupOnGeom; 00200 QList<int> myIdList; 00201 GEOM::ListOfGO_var myGeomObjects; 00202 00203 int mySelectionMode; 00204 //Handle(SMESH_TypeFilter) myMeshFilter; 00205 //Handle(SMESH_TypeFilter) mySubMeshFilter; 00206 //Handle(SMESH_TypeFilter) myGroupFilter; 00207 SUIT_SelectionFilter* myMeshFilter; 00208 SUIT_SelectionFilter* mySubMeshFilter; 00209 SUIT_SelectionFilter* myGroupFilter; 00210 SUIT_SelectionFilter* myGeomFilter; 00211 00212 SMESHGUI_FilterDlg* myFilterDlg; 00213 00214 bool myCreate, myIsBusy; 00215 00216 QString myHelpFileName; 00217 00218 QMap<QAction*, int> myActions; 00219 00220 bool myNameChanged; //added by skl for IPAL19574 00221 00222 QString myObjectToSelect; 00223 bool myIsApplyAndClose; 00224 }; 00225 00226 #endif // SMESHGUI_GROUPDLG_H