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