Salome HOME
8c585372bfa0cd5042fbb48a4abfc07019b1fe92
[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 // File   : SMESHGUI_CreatePatternDlg.h
21 // Author : Sergey LITONIN, Open CASCADE S.A.S.
22 //
23
24 #ifndef SMESHGUI_CREATEPATTERNDLG_H
25 #define SMESHGUI_CREATEPATTERNDLG_H
26
27 // SMESH includes
28 #include "SMESH_SMESHGUI.hxx"
29
30 // Qt includes
31 #include <QDialog>
32
33 // IDL includes
34 #include <SALOMEconfig.h>
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 QLineEdit;
42 class QRadioButton;
43 class QCheckBox;
44 class QButtonGroup;
45 class SVTK_Selector;
46 class LightApp_SelectionMgr;
47 class SMESHGUI;
48
49 /*!
50  *  Class       : SMESHGUI_CreatePatternDlg
51  *  Description : Dialog to specify filters for VTK viewer
52  */
53
54 class SMESHGUI_EXPORT SMESHGUI_CreatePatternDlg : public QDialog
55 {
56   Q_OBJECT
57
58 public:
59   enum { Type_2d, Type_3d };
60
61 public:
62   SMESHGUI_CreatePatternDlg( SMESHGUI*, const int );
63   virtual ~SMESHGUI_CreatePatternDlg();
64
65   void                     Init( const int );
66   QString                  GetPatternName() const;
67   SMESH::SMESH_Pattern_ptr GetPattern();
68   void                     SetMesh( SMESH::SMESH_Mesh_ptr );
69
70 signals:
71   void                     NewPattern();
72   void                     Close();
73
74 private:
75   void                     closeEvent( QCloseEvent* );
76   void                     enterEvent( QEvent* );
77   void                     keyPressEvent( QKeyEvent* );
78  
79 private slots:
80   void                     onOk();
81   void                     onSave();
82   void                     onClose();
83   void                     onHelp();
84
85   void                     onDeactivate();
86
87   void                     onSelectionDone();
88   void                     onTypeChanged( int );
89   void                     onProject( bool );
90   void                     onSelBtnClicked();
91
92 private:
93   QWidget*                 createButtonFrame( QWidget* );
94   QWidget*                 createMainFrame( QWidget* );
95   void                     displayPreview();
96   void                     erasePreview();
97   void                     activateSelection();
98   QString                  autoExtension( const QString& ) const;
99   bool                     isValid();
100   bool                     loadFromObject( const bool = true );
101   QString                  getDefaultName() const;
102   GEOM::GEOM_Object_ptr    getGeom( SALOMEDSClient_SObject* ) const;
103
104 private:
105   QButtonGroup*            myTypeGrp;
106   QRadioButton*            mySwitch2d;
107   QRadioButton*            mySwitch3d;
108
109   QLineEdit*               myMeshEdit;
110   QLineEdit*               myName;
111
112   SMESHGUI_PatternWidget*  myPicture2d;
113
114   QCheckBox*               myProjectChk;
115
116   SMESHGUI*                mySMESHGUI;
117   SVTK_Selector*           mySelector;
118   LightApp_SelectionMgr*   mySelectionMgr;
119   int                      myType;
120
121   SMESH::SMESH_Mesh_var    myMesh;
122   SMESH::SMESH_subMesh_var mySubMesh;
123   GEOM::GEOM_Object_var    myGeomObj;
124
125   SMESH::SMESH_Pattern_var myPattern;
126   bool                     myIsLoaded;
127
128   QString                  myHelpFileName;
129 };
130
131 #endif // SMESHGUI_CREATEPATTERNDLG_H