Salome HOME
CreateStdHypothesisDlg dialog is modal now
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_CreateStdHypothesisDlg.cxx
1 //  SMESH StdMeshersGUI : GUI for StdMeshers plugin
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : StdMeshersGUI_CreateStdHypothesisDlg.cxx
25 //           Moved here from SMESHGUI_CreateStdHypothesisDlg.cxx
26 //  Author : Nicolas REJNERI
27 //  Module : SMESH
28 //  $Header$
29
30 using namespace std;
31 #include "StdMeshersGUI_CreateStdHypothesisDlg.h"
32 #include "StdMeshersGUI_Parameters.h"
33 #include "SMESHGUI.h"
34 #include "SMESHGUI_Hypotheses.h"
35
36 #include "utilities.h"
37
38 #include "SUIT_MessageBox.h"
39 #include "SUIT_ResourceMgr.h"
40 #include "SUIT_OverrideCursor.h"
41 #include "SUIT_Desktop.h"
42
43 //=================================================================================
44 // class    : StdMeshersGUI_CreateStdHypothesisDlg()
45 // purpose  : 
46 //=================================================================================
47 StdMeshersGUI_CreateStdHypothesisDlg::StdMeshersGUI_CreateStdHypothesisDlg (const QString& hypType,
48                                                                             QWidget* parent,
49                                                                             const char* name,
50                                                                             bool /*modal*/,
51                                                                             WFlags fl)
52      : StdMeshersGUI_CreateHypothesisDlg (hypType, parent, name, true, fl)
53 {
54   QString hypTypeStr;
55   if (hypType.compare("LocalLength") == 0)
56     hypTypeStr = "LOCAL_LENGTH";
57   else if (hypType.compare("NumberOfSegments") == 0)
58     hypTypeStr = "NB_SEGMENTS";
59   else if (hypType.compare("MaxElementArea") == 0)
60     hypTypeStr = "MAX_ELEMENT_AREA";
61   else if (hypType.compare("MaxElementVolume") == 0)
62     hypTypeStr = "MAX_ELEMENT_VOLUME";
63   else if (hypType.compare("StartEndLength") == 0)
64     hypTypeStr = "START_END_LENGTH";
65   else if (hypType.compare("Deflection1D") == 0)
66     hypTypeStr = "DEFLECTION1D";
67   else if (hypType.compare("Arithmetic1D") == 0)
68     hypTypeStr = "ARITHMETIC_1D";
69   else
70     return;
71
72   QString caption( tr ( QString( "SMESH_%1_TITLE" ).arg( hypTypeStr )));
73   QString hypTypeName( tr ( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeStr )));
74   QString hypIconName( tr ( QString( "ICON_DLG_%1" ).arg( hypTypeStr )));
75
76   CreateDlgLayout(caption,
77                   SMESHGUI::resourceMgr()->loadPixmap( "SMESH", hypIconName ),
78                   hypTypeName);
79 }
80
81 //=================================================================================
82 // function : ~StdMeshersGUI_CreateStdHypothesisDlg()
83 // purpose  : Destroys the object and frees any allocated resources
84 //=================================================================================
85 StdMeshersGUI_CreateStdHypothesisDlg::~StdMeshersGUI_CreateStdHypothesisDlg()
86 {
87     // no need to delete child widgets, Qt does it all for us
88 }
89 //=================================================================================
90 // function : FillParameters()
91 // purpose  :
92 //=================================================================================
93 void StdMeshersGUI_CreateStdHypothesisDlg::GetParameters
94   (const QString &                     hypType,
95    std::list<SMESHGUI_aParameterPtr> & params)
96 {
97   StdMeshersGUI_Parameters::GetParameters( hypType, params );
98 }
99
100 //=================================================================================
101 // function : SetParameters()
102 // purpose  :
103 //=================================================================================
104 bool StdMeshersGUI_CreateStdHypothesisDlg::SetParameters
105   (SMESH::SMESH_Hypothesis_ptr theHyp, const list<SMESHGUI_aParameterPtr> & params)
106 {
107   StdMeshersGUI_Parameters::SetParameters( theHyp, params );
108   return true;
109 }