Salome HOME
488a09a6db52ab39cf785d2d479c9fee2cf91b0a
[modules/geom.git] / src / GroupGUI / GroupGUI_GroupDlg.h
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, 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 //  GEOM GEOMGUI : GUI for Geometry component
24 //  File   : GroupGUI_GroupDlg.h
25 //  Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
26
27 #ifndef GROUPGUI_GROUPDLG_H
28 #define GROUPGUI_GROUPDLG_H
29
30 #include <GEOMBase_Skeleton.h>
31
32 #include <TopAbs_ShapeEnum.hxx>
33 #include <TColStd_DataMapOfIntegerInteger.hxx>
34 #include <TColStd_IndexedMapOfInteger.hxx>
35
36 class QCheckBox;
37 class QComboBox;
38 class QPushButton;
39 class QGroupBox;
40 class QLineEdit;
41 class QListWidget;
42 class QButtonGroup;
43 class SalomeApp_DoubleSpinBox;
44
45 //=================================================================================
46 // class    : GroupGUI_GroupDlg
47 // purpose  :
48 //=================================================================================
49 class GroupGUI_GroupDlg : public GEOMBase_Skeleton
50 {
51   Q_OBJECT
52
53 public:
54   typedef enum {
55     CreateGroup,
56     EditGroup
57   } Mode;
58
59   GroupGUI_GroupDlg (Mode mode, GeometryGUI*, QWidget* parent = 0);
60   ~GroupGUI_GroupDlg();
61
62 protected:
63   // redefined from GEOMBase_Helper
64   virtual GEOM::GEOM_IOperations_ptr  createOperation();
65   virtual bool                        isValid (QString&);
66   virtual bool                        execute (ObjectList&);
67   virtual GEOM::GEOM_Object_ptr       getFather (GEOM::GEOM_Object_ptr);
68   virtual QList<GEOM::GeomObjPtr>     getSourceObjects();
69
70   void                                closeEvent (QCloseEvent*);
71
72 private slots:
73   void                                ClickOnOk();
74   bool                                ClickOnApply();
75   void                                ActivateThisDialog();
76   void                                SelectionIntoArgument();
77   void                                SetEditCurrentArgument();
78   void                                ConstructorsClicked(int);
79
80   void                                selectAllSubShapes();
81   void                                add();
82   void                                remove();
83   void                                showOnlySelected();
84   void                                selectionChanged();
85   void                                ClickOnOkFilter();
86 #ifndef DISABLE_PLOT2DVIEWER
87   void                                ClickOnPlot();
88 #endif
89   void                                MeasureToggled();
90
91 private:
92   void                                Init();
93   void                                enterEvent (QEvent*);
94
95   int                                 subSelectionWay() const;
96   TopAbs_ShapeEnum                    getShapeType() const;
97   void                                setShapeType (const TopAbs_ShapeEnum);
98   void                                activateSelection();
99   void                                updateState (bool isAdd = false);
100   void                                highlightSubShapes();
101   void                                onGetInPlace();
102   void                                setInPlaceObj (GEOM::GEOM_Object_var, const bool isVisible=1);
103   int                                 getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex);
104
105 private:
106   Mode                                myMode;
107   bool                                myBusy;
108   bool                                myIsShapeType;
109   bool                                myIsHiddenMain;
110   bool                                myWasHiddenMain;
111   GEOM::GEOM_Object_var               myMainObj;
112   GEOM::GEOM_Object_var               myGroup;
113   GEOM::GEOM_Object_var               myInPlaceObj;
114   int                                 myInPlaceObjSelectState;
115   TColStd_DataMapOfIntegerInteger     myMain2InPlaceIndices;
116   QList<int>                          myGroupIdList;
117   int                                 myDmMode;
118   bool                                myIsAccept;
119
120   QPushButton*                        mySelBtn;
121   QLineEdit*                          myMainName;
122   QPushButton*                        mySelBtn2;
123   QLineEdit*                          myShape2Name;
124   QGroupBox*                          myRestrictGroupBox;
125   QButtonGroup*                       myRestrictGroup;
126   QPushButton*                        mySelAllBtn;
127   QPushButton*                        myAddBtn;
128   QPushButton*                        myRemBtn;
129   QPushButton*                        myShowOnlyBtn;
130   QPushButton*                        myHideSelBtn;
131   QPushButton*                        myShowAllBtn;
132   QListWidget*                        myIdList;
133   QCheckBox*                          myLessFilterCheck;
134   QCheckBox*                          myGreaterFilterCheck;
135   QComboBox*                          myLessFilterCombo;
136   QComboBox*                          myGreaterFilterCombo;
137   SalomeApp_DoubleSpinBox*            myLessFilterSpin;
138   SalomeApp_DoubleSpinBox*            myGreaterFilterSpin;
139   QPushButton*                        myApplyFilterButton;
140   QPushButton*                        myPlotDistributionButton;
141   QGroupBox*                          myFilterGrp;
142 };
143
144 #endif