Salome HOME
Merge from BR_DEBUG_3_2_0b1
[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
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