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 "SMESH_SMESHGUI.hxx"
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
36 #include <QtxDialog.h>
43 * \brief Auxiliary class for creation of hypotheses
45 class SMESHGUI_EXPORT SMESHGUI_GenericHypothesisCreator : public QObject
50 SMESHGUI_GenericHypothesisCreator( const QString& );
51 virtual ~SMESHGUI_GenericHypothesisCreator();
53 void create( const bool isAlgo, QWidget* );
54 void edit( SMESH::SMESH_Hypothesis_ptr, QWidget* );
55 void create( SMESH::SMESH_Hypothesis_ptr, QWidget* );
57 virtual bool checkParams() const = 0;
58 virtual void onReject();
60 QString hypType() const;
61 bool isCreation() const;
71 typedef QValueList<StdParam> ListOfStdParams;
72 typedef QPtrList<QWidget> ListOfWidgets;
74 SMESH::SMESH_Hypothesis_var hypothesis() const;
75 SMESH::SMESH_Hypothesis_var initParamsHypothesis() const;
76 const ListOfWidgets& widgets() const;
77 ListOfWidgets& changeWidgets();
78 QtxDialog* dlg() const { return myDlg; }
80 virtual QFrame* buildFrame () = 0;
81 QFrame* buildStdFrame ();
82 virtual void retrieveParams() const = 0;
83 virtual QString storeParams () const = 0;
84 virtual bool stdParams ( ListOfStdParams& ) const;
85 bool getStdParamFromDlg( ListOfStdParams& ) const;
86 static QString stdParamValues( const ListOfStdParams& );
87 virtual void attuneStdWidget( QWidget*, const int ) const;
88 virtual QWidget* getCustomWidget( const StdParam &, QWidget*, const int ) const;
89 virtual bool getParamFromCustomWidget( StdParam& , QWidget* ) const;
90 virtual QString caption() const;
91 virtual QPixmap icon() const;
92 virtual QString type() const;
95 virtual void onValueChanged();
98 bool editHypothesis( SMESH::SMESH_Hypothesis_ptr, QWidget* );
101 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;
128 QLabel *myIconLabel, *myTypeLabel;
129 QString myHelpFileName;
133 * \brief Class containing information about hypothesis
138 HypothesisData( const QString& theTypeName,
139 const QString& thePluginName,
140 const QString& theServerLibName,
141 const QString& theClientLibName,
142 const QString& theLabel,
143 const QString& theIconId,
144 const QValueList<int>& theDim,
146 const QStringList& theNeededHypos,
147 const QStringList& theOptionalHypos,
148 const QStringList& theInputTypes,
149 const QStringList& theOutputTypes)
150 : TypeName( theTypeName ),
151 PluginName( thePluginName ),
152 ServerLibName( theServerLibName ),
153 ClientLibName( theClientLibName ),
158 NeededHypos( theNeededHypos ), OptionalHypos( theOptionalHypos ),
159 InputTypes( theInputTypes ), OutputTypes( theOutputTypes )
162 QString TypeName; //!< hypothesis type name
163 QString PluginName; //!< plugin name
164 QString ServerLibName; //!< server library name
165 QString ClientLibName; //!< client library name
166 QString Label; //!< label
167 QString IconId; //!< icon identifier
168 QValueList<int> Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration)
169 bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise
171 // for algorithm only: dependencies algo <-> algo and algo -> hypos
172 QStringList NeededHypos; //!< list of obligatory hypotheses
173 QStringList OptionalHypos;//!< list of optional hypotheses
174 QStringList InputTypes; //!< list of element types required as a prerequisite
175 QStringList OutputTypes; //!< list of types of generated elements
179 * \brief Class containing set of hypotheses
181 * Actually it contains list of hypo types
186 HypothesesSet( const QString& theSetName )
187 : HypoSetName( theSetName ) {};
188 HypothesesSet( const QString& theSetName,
189 const QStringList& theHypoList,
190 const QStringList& theAlgoList )
191 : HypoSetName( theSetName ), HypoList(theHypoList), AlgoList(theAlgoList) {};
193 QStringList HypoList, AlgoList;