1 // Copyright (C) 2007-2013 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 // GEOM GEOMGUI : GUI for Geometry component
24 // File : EntityGUI_FieldDlg.h
26 #ifndef EntityGUI_FieldDlg_H
27 #define EntityGUI_FieldDlg_H
29 #include <GEOMBase_Skeleton.h>
31 #include <TopAbs_ShapeEnum.hxx>
32 #include <TColStd_DataMapOfIntegerInteger.hxx>
33 #include <TColStd_IndexedMapOfInteger.hxx>
34 #include <TopTools_IndexedMapOfShape.hxx>
39 #include <QTableWidget>
45 class SalomeApp_IntSpinBox;
47 //=================================================================================
48 // class : EntityGUI_FieldDlg
50 //=================================================================================
51 class EntityGUI_FieldDlg : public GEOMBase_Skeleton
63 EntityGUI_FieldDlg (GeometryGUI* theGeometryGUI,
64 GEOM::GEOM_Field_ptr theField, int stepID=0,
66 bool modal=false, Qt::WindowFlags fl=0);
67 ~EntityGUI_FieldDlg();
70 // redefined from GEOMBase_Helper
71 virtual GEOM::GEOM_IOperations_ptr createOperation();
72 virtual bool isValid (QString&);
73 virtual bool execute ();
78 void ActivateThisDialog();
79 void SelectionIntoArgument();
80 void SetEditCurrentArgument();
89 void onNbCompsChange();
91 void highlightSubShapes();
95 void enterEvent (QEvent*);
96 void activateSelection();
98 TopAbs_ShapeEnum getShapeType(int* dim=0) const;
100 int getDataType() const;
101 int getCurStepID() const;
102 int getNbComps() const;
103 void updateShapeIDs();
104 void updateDims(int curDim=-1);
105 int getSelectedSubshapes (TColStd_IndexedMapOfInteger& map);
110 GEOM::GEOM_Field_var myField;
111 GEOM::GEOM_Object_var myShape;
112 QVector< int > myShapeIDs;
113 TopTools_IndexedMapOfShape myShapeMap;
116 StepTable* myCurStepTable;
117 QMap< int, StepTable* > myStepTables;
118 QSet< int > myRemovedSteps;
123 QList<int> myHiddenFieldStepIds;
125 QPushButton* myShapeSelBtn;
126 QLineEdit* myShapeName;
127 QComboBox* myTypeCombo;
128 QComboBox* myDimCombo;
129 QPushButton* myPrevStepBtn;
130 QPushButton* myNextStepBtn;
131 QPushButton* myRmStepBtn;
133 SalomeApp_IntSpinBox* myNbCompsSpin;
134 QWidget* mySwitchTableWdg;
135 QComboBox* myStepsCombo;
136 SalomeApp_IntSpinBox* myStampSpin;
141 Class : EntityGUI_FieldDlg::StepTable
142 Description : Table widget
145 class EntityGUI_FieldDlg::StepTable : public QTableWidget
152 GEOM::GEOM_FieldStep_var myStep;
155 QTableWidgetItem * newDefaultItem();
157 StepTable( int stepID, int dataType, int nbRows, int nbColumns,
158 QString shapeName, QStringList headers,
159 GEOM::GEOM_FieldStep_ptr stepVar, QWidget* = 0 );
160 virtual ~StepTable();
162 QSize minimumSizeHint() const;
164 void setEditable( bool, int, int );
165 bool isEditable( int, int ) const;
167 void setReadOnly( bool );
168 bool isReadOnly() const;
170 void insertRows( int, int = 1 );
171 QString text( int, int );
173 QList<int> selectedRows();
174 void selectRows(const QList<int>& rows);
176 void setDim( int nbRows, QString shapeName, bool setDefault=true );
177 void setNbComps( int nbComps );
178 void setDataType( int dataType );
179 void setStamp( int stamp ) { myStamp = stamp; }
180 int getStamp() { return myStamp; }
181 int getStepID() { return myStepID; }
182 QStringList getHeaders();
183 void setHeaders(const QStringList& headers);
184 GEOM::GEOM_FieldStep_var getStep() { return myStep; }
185 void setValues(GEOM::GEOM_FieldStep_var& step);
187 void setIsChanged() { myIsChanged = true; }