1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 CEA
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : SMESHGUI_Hypotheses.h
24 // Author : Julia DOROVSKIKH
28 #ifndef SMESHGUI_Hypotheses_HeaderFile
29 #define SMESHGUI_Hypotheses_HeaderFile
31 #include <SALOMEconfig.h>
32 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
34 #include <QtxDialog.h>
41 * \brief Auxiliary class for creation of hypotheses
43 class SMESHGUI_GenericHypothesisCreator : public QObject
48 SMESHGUI_GenericHypothesisCreator( const QString& theHypType );
49 virtual ~SMESHGUI_GenericHypothesisCreator();
51 void create( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*);
52 void create( bool isAlgo, const QString&, QWidget*);
53 void edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*);
55 virtual bool checkParams() const = 0;
56 virtual void onReject();
58 QString hypType() const;
59 QString hypName() const;
60 bool isCreation() const;
70 typedef QValueList<StdParam> ListOfStdParams;
71 typedef QPtrList<QWidget> ListOfWidgets;
73 SMESH::SMESH_Hypothesis_var hypothesis() const;
74 SMESH::SMESH_Hypothesis_var initParamsHypothesis() const;
75 const ListOfWidgets& widgets() const;
76 ListOfWidgets& changeWidgets();
77 QtxDialog* dlg() const { return myDlg; }
79 virtual QFrame* buildFrame () = 0;
80 QFrame* buildStdFrame ();
81 virtual void retrieveParams() const = 0;
82 virtual QString storeParams () const = 0;
83 virtual bool stdParams ( ListOfStdParams& ) const;
84 bool getStdParamFromDlg( ListOfStdParams& ) const;
85 static QString stdParamValues( const ListOfStdParams& );
86 virtual void attuneStdWidget( QWidget*, const int ) const;
87 virtual QWidget* getCustomWidget( const StdParam &, QWidget*, const int ) const;
88 virtual bool getParamFromCustomWidget( StdParam& , QWidget* ) const;
89 virtual QString caption() const;
90 virtual QPixmap icon() const;
91 virtual QString type() const;
94 virtual void onValueChanged();
97 bool editHypothesis( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget* );
100 SMESH::SMESH_Hypothesis_var myHypo, myInitParamsHypo;
103 ListOfWidgets myParamWidgets;
108 class SMESHGUI_HypothesisDlg : public QtxDialog
113 SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator*, QWidget* );
114 virtual ~SMESHGUI_HypothesisDlg();
116 void setHIcon( const QPixmap& );
117 void setCustomFrame( QFrame* );
118 void setType( const QString& );
121 virtual void accept();
122 virtual void reject();
126 SMESHGUI_GenericHypothesisCreator* myCreator;
127 QVBoxLayout* myLayout;
130 QString myHelpFileName;
134 * \brief Class containing information about hypothesis
139 HypothesisData( const QString& theTypeName,
140 const QString& thePluginName,
141 const QString& theServerLibName,
142 const QString& theClientLibName,
143 const QString& theLabel,
144 const QString& theIconId,
145 const QValueList<int>& theDim,
147 const QStringList& theNeededHypos,
148 const QStringList& theOptionalHypos,
149 const QStringList& theInputTypes,
150 const QStringList& theOutputTypes)
151 : TypeName( theTypeName ),
152 PluginName( thePluginName ),
153 ServerLibName( theServerLibName ),
154 ClientLibName( theClientLibName ),
159 NeededHypos( theNeededHypos ), OptionalHypos( theOptionalHypos ),
160 InputTypes( theInputTypes ), OutputTypes( theOutputTypes )
163 QString TypeName; //!< hypothesis type name
164 QString PluginName; //!< plugin name
165 QString ServerLibName; //!< server library name
166 QString ClientLibName; //!< client library name
167 QString Label; //!< label
168 QString IconId; //!< icon identifier
169 QValueList<int> Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration)
170 bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise
172 // for algorithm only: dependencies algo <-> algo and algo -> hypos
173 QStringList NeededHypos; //!< list of obligatory hypotheses
174 QStringList OptionalHypos;//!< list of optional hypotheses
175 QStringList InputTypes; //!< list of element types required as a prerequisite
176 QStringList OutputTypes; //!< list of types of generated elements
180 * \brief Class containing set of hypotheses
182 * Actually it contains list of hypo types
187 HypothesesSet( const QString& theSetName )
188 : HypoSetName( theSetName ) {};
189 HypothesesSet( const QString& theSetName,
190 const QStringList& theHypoList,
191 const QStringList& theAlgoList )
192 : HypoSetName( theSetName ), HypoList(theHypoList), AlgoList(theAlgoList) {};
194 QStringList HypoList, AlgoList;