Salome HOME
Update copyright information
[modules/geom.git] / src / GroupGUI / GroupGUI_GroupDlg.h
1 //  Copyright (C) 2007-2008  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.
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 //  GEOM GEOMGUI : GUI for Geometry component
23 //  File   : GroupGUI_GroupDlg.h
24 //  Author : Sergey ANIKIN
25 //  Module : GEOM
26 //
27 #ifndef GROUPGUI_GROUPDLG_H
28 #define GROUPGUI_GROUPDLG_H
29
30 #include "GEOMBase_Skeleton.h"
31 #include <qcheckbox.h>
32 #include <TopAbs_ShapeEnum.hxx>
33 #include <TColStd_DataMapOfIntegerInteger.hxx>
34
35 class QGroupBox;
36 class QLineEdit;
37 class QListBox;
38
39 //class QRadioButton;
40 class QButtonGroup;
41
42 //=================================================================================
43 // class    : GroupGUI_GroupDlg
44 // purpose  :
45 //=================================================================================
46 class GroupGUI_GroupDlg : public GEOMBase_Skeleton
47 {
48     Q_OBJECT
49
50 public:
51     typedef enum {
52       CreateGroup,
53       EditGroup
54     } Mode;
55
56     GroupGUI_GroupDlg(Mode mode, GeometryGUI*, QWidget* parent = 0);
57     ~GroupGUI_GroupDlg();
58
59 protected:
60     // redefined from GEOMBase_Helper
61     virtual GEOM::GEOM_IOperations_ptr  createOperation();
62     virtual bool                        isValid( QString& msg );
63     virtual bool                        execute( ObjectList& objects );
64     virtual GEOM::GEOM_Object_ptr       getFather( GEOM::GEOM_Object_ptr theObj );
65
66     void                                closeEvent(QCloseEvent* e);
67
68 private slots:
69     void                                ClickOnOk();
70     bool                                ClickOnApply();
71     void                                ActivateThisDialog();
72     void                                LineEditReturnPressed();
73     void                                SelectionIntoArgument();
74     void                                SetEditCurrentArgument();
75     void                                ConstructorsClicked( int constructorId );
76
77     void                                selectAllSubShapes();
78     void                                add();
79     void                                remove();
80     void                                selectionChanged();
81
82 private:
83     void                                Init();
84     void                                enterEvent( QEvent* e );
85     int                                 getConstructorId() const;    
86     int                                 subSelectionWay() const;    
87     TopAbs_ShapeEnum                    getShapeType() const;
88     void                                setShapeType( const TopAbs_ShapeEnum );
89     void                                activateSelection();
90     void                                updateState();
91     void                                highlightSubShapes();
92     void                                onGetInPlace();
93     void                                setInPlaceObj( GEOM::GEOM_Object_var theObj );
94
95 private:
96   Mode                            myMode;
97   bool                            myBusy;
98   GEOM::GEOM_Object_var           myMainObj;
99   GEOM::GEOM_Object_var           myGroup;
100   GEOM::GEOM_Object_var           myInPlaceObj;
101   int                             myInPlaceObjSelectWay;
102   TColStd_DataMapOfIntegerInteger myMain2InPlaceIndices;
103
104   QPushButton*                    mySelBtn;
105   QLineEdit*                      myMainName;
106   QPushButton*                    mySelBtn2;
107   QLineEdit*                      myShape2Name;
108   QButtonGroup*                   mySelectionWayGroup;
109   QPushButton*                    mySelAllBtn;
110   QPushButton*                    myAddBtn;
111   QPushButton*                    myRemBtn;
112   QListBox*                       myIdList;
113 };
114
115 #endif