Salome HOME
Bug 0020378: Gui of SMESH hypothesis not multi-study ?
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_CreatePatternDlg.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 //  File   : SMESHGUI_CreatePatternDlg.h
23 //  Author : Sergey LITONIN
24 //  Module : SMESH
25 //
26 #ifndef SMESHGUI_CreatePatternDlg_H
27 #define SMESHGUI_CreatePatternDlg_H
28
29 #include "SMESH_SMESHGUI.hxx"
30
31 #include <qdialog.h>
32
33 // IDL Headers
34 #include <SALOMEconfig.h>
35 #include CORBA_SERVER_HEADER(GEOM_Gen)
36 #include CORBA_SERVER_HEADER(SMESH_Mesh)
37 #include CORBA_SERVER_HEADER(SMESH_Pattern)
38
39 class SMESHGUI_PatternWidget;
40 class SALOMEDSClient_SObject;
41
42 class QCloseEvent;
43 class QFrame;
44 class QLineEdit;
45 class SMESHGUI_SpinBox;
46 class QPushButton;
47 class LightApp_SelectionMgr;
48 class QRadioButton;
49 class QCheckBox;
50 class QButtonGroup;
51 class QLabel;
52 class SVTK_ViewWindow;
53 class SVTK_Selector;
54 class SMESHGUI;
55
56 /*!
57  *  Class       : SMESHGUI_CreatePatternDlg
58  *  Description : Dialog to specify filters for VTK viewer
59  */
60
61 class SMESHGUI_EXPORT SMESHGUI_CreatePatternDlg : public QDialog
62 {
63   Q_OBJECT
64
65 public:
66   enum { Type_2d, Type_3d };
67
68 public:
69                            SMESHGUI_CreatePatternDlg( SMESHGUI*,
70                                                       const int,
71                                                       const char* = 0);
72   virtual                  ~SMESHGUI_CreatePatternDlg();
73
74   void                     Init(const int);
75   QString                  GetPatternName() const;
76   SMESH::SMESH_Pattern_ptr GetPattern();
77   void                     SetMesh (SMESH::SMESH_Mesh_ptr);
78
79 signals:
80
81   void                     NewPattern();
82   void                     Close();
83
84 private:
85
86   void                     closeEvent (QCloseEvent* e);
87   void                     enterEvent (QEvent*);
88    void                    keyPressEvent(QKeyEvent*);
89
90 private slots:
91
92   void                     onOk();
93   void                     onSave();
94   void                     onClose();
95   void                     onHelp();
96
97   void                     onDeactivate();
98
99   void                     onSelectionDone();
100   void                     onTypeChanged (int);
101   void                     onProject (bool);
102   void                     onSelBtnClicked();
103
104 private:
105
106   QFrame*                  createButtonFrame (QWidget*);
107   QFrame*                  createMainFrame   (QWidget*);
108   void                     displayPreview();
109   void                     erasePreview();
110   void                     activateSelection();
111   QString                  autoExtension (const QString& theFileName) const;
112   bool                     isValid();
113   bool                     loadFromObject (const bool = true);
114   QString                  getDefaultName() const;
115   GEOM::GEOM_Object_ptr    getGeom (SALOMEDSClient_SObject*) const;
116
117 private:
118
119   QPushButton*             myOkBtn;
120   QPushButton*             mySaveBtn;
121   QPushButton*             myCloseBtn;
122   QPushButton*             myHelpBtn;
123
124   QButtonGroup*            myTypeGrp;
125   QRadioButton*            mySwitch2d;
126   QRadioButton*            mySwitch3d;
127   QRadioButton*            mySwitchSMESH_Pattern3d;
128
129   QLineEdit*               myMeshEdit;
130   QLineEdit*               myName;
131
132   SMESHGUI_PatternWidget*  myPicture2d;
133
134   QCheckBox*               myProjectChk;
135
136   SMESHGUI*                mySMESHGUI;
137   SVTK_Selector*           mySelector;
138   LightApp_SelectionMgr*   mySelectionMgr;
139   int                      myNbPoints;
140   int                      myType;
141
142   SMESH::SMESH_Mesh_var    myMesh;
143   SMESH::SMESH_subMesh_var mySubMesh;
144   GEOM::GEOM_Object_var    myGeomObj;
145
146   SMESH::SMESH_Pattern_var myPattern;
147   bool                     myIsLoaded;
148
149   QString                  myHelpFileName;
150 };
151
152 #endif