Salome HOME
Fix bug 12796: Warning missed for the bad file 'test18.med'
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_CreatePatternDlg.h
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 //
4 //  This library is free software; you can redistribute it and/or
5 //  modify it under the terms of the GNU Lesser General Public
6 //  License as published by the Free Software Foundation; either
7 //  version 2.1 of the License.
8 //
9 //  This library is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 //  Lesser General Public License for more details.
13 //
14 //  You should have received a copy of the GNU Lesser General Public
15 //  License along with this library; if not, write to the Free Software
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //
21 //
22 //  File   : SMESHGUI_CreatePatternDlg.h
23 //  Author : Sergey LITONIN
24 //  Module : SMESH
25
26
27 #ifndef SMESHGUI_CreatePatternDlg_H
28 #define SMESHGUI_CreatePatternDlg_H
29
30 #include <qdialog.h>
31
32 // IDL Headers
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(GEOM_Gen)
35 #include CORBA_SERVER_HEADER(SMESH_Mesh)
36 #include CORBA_SERVER_HEADER(SMESH_Pattern)
37
38 class SMESHGUI_PatternWidget;
39 class SALOMEDSClient_SObject;
40
41 class QCloseEvent;
42 class QFrame;
43 class QLineEdit;
44 class SMESHGUI_SpinBox;
45 class QPushButton;
46 class LightApp_SelectionMgr;
47 class QRadioButton;
48 class QCheckBox;
49 class QButtonGroup;
50 class QLabel;
51 class SVTK_ViewWindow;
52 class SVTK_Selector;
53 class SMESHGUI;
54
55 /*!
56  *  Class       : SMESHGUI_CreatePatternDlg
57  *  Description : Dialog to specify filters for VTK viewer
58  */
59
60 class SMESHGUI_CreatePatternDlg : public QDialog
61 {
62   Q_OBJECT
63
64 public:
65   enum { Type_2d, Type_3d };
66
67 public:
68                            SMESHGUI_CreatePatternDlg( SMESHGUI*,
69                                                       const int,
70                                                       const char* = 0);
71   virtual                  ~SMESHGUI_CreatePatternDlg();
72
73   void                     Init(const int);
74   QString                  GetPatternName() const;
75   SMESH::SMESH_Pattern_ptr GetPattern();
76   void                     SetMesh (SMESH::SMESH_Mesh_ptr);
77
78 signals:
79
80   void                     NewPattern();
81   void                     Close();
82
83 private:
84
85   void                     closeEvent (QCloseEvent* e);
86   void                     enterEvent (QEvent*);
87    void                    keyPressEvent(QKeyEvent*);
88
89 private slots:
90
91   void                     onOk();
92   void                     onSave();
93   void                     onClose();
94   void                     onHelp();
95
96   void                     onDeactivate();
97
98   void                     onSelectionDone();
99   void                     onTypeChanged (int);
100   void                     onProject (bool);
101   void                     onSelBtnClicked();
102
103 private:
104
105   QFrame*                  createButtonFrame (QWidget*);
106   QFrame*                  createMainFrame   (QWidget*);
107   void                     displayPreview();
108   void                     erasePreview();
109   void                     activateSelection();
110   QString                  autoExtension (const QString& theFileName) const;
111   bool                     isValid();
112   bool                     loadFromObject (const bool = true);
113   QString                  getDefaultName() const;
114   GEOM::GEOM_Object_ptr    getGeom (SALOMEDSClient_SObject*) const;
115
116 private:
117
118   QPushButton*             myOkBtn;
119   QPushButton*             mySaveBtn;
120   QPushButton*             myCloseBtn;
121   QPushButton*             myHelpBtn;
122
123   QButtonGroup*            myTypeGrp;
124   QRadioButton*            mySwitch2d;
125   QRadioButton*            mySwitch3d;
126   QRadioButton*            mySwitchSMESH_Pattern3d;
127
128   QLineEdit*               myMeshEdit;
129   QLineEdit*               myName;
130
131   SMESHGUI_PatternWidget*  myPicture2d;
132
133   QCheckBox*               myProjectChk;
134
135   SMESHGUI*                mySMESHGUI;
136   SVTK_Selector*           mySelector;
137   LightApp_SelectionMgr*   mySelectionMgr;
138   int                      myNbPoints;
139   int                      myType;
140
141   SMESH::SMESH_Mesh_var    myMesh;
142   SMESH::SMESH_subMesh_var mySubMesh;
143   GEOM::GEOM_Object_var    myGeomObj;
144
145   SMESH::SMESH_Pattern_var myPattern;
146   bool                     myIsLoaded;
147
148   QString                  myHelpFileName;
149 };
150
151 #endif