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& theHypType );
51 virtual ~SMESHGUI_GenericHypothesisCreator();
53 void create( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*);
54 void create( bool isAlgo, const QString&, QWidget*);
55 void edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*);
57 virtual bool checkParams() const = 0;
58 virtual void onReject();
59 virtual QString helpPage() const;
61 QString hypType() const;
62 QString hypName() const;
63 bool isCreation() const;
73 typedef QValueList<StdParam> ListOfStdParams;
74 typedef QPtrList<QWidget> ListOfWidgets;
76 SMESH::SMESH_Hypothesis_var hypothesis() const;
77 SMESH::SMESH_Hypothesis_var initParamsHypothesis() const;
78 const ListOfWidgets& widgets() const;
79 ListOfWidgets& changeWidgets();
80 QtxDialog* dlg() const { return myDlg; }
82 virtual QFrame* buildFrame () = 0;
83 QFrame* buildStdFrame ();
84 virtual void retrieveParams() const = 0;
85 virtual QString storeParams () const = 0;
86 virtual bool stdParams ( ListOfStdParams& ) const;
87 bool getStdParamFromDlg( ListOfStdParams& ) const;
88 static QString stdParamValues( const ListOfStdParams& );
89 virtual void attuneStdWidget( QWidget*, const int ) const;
90 virtual QWidget* getCustomWidget( const StdParam &, QWidget*, const int ) const;
91 virtual bool getParamFromCustomWidget( StdParam& , QWidget* ) const;
92 virtual QString caption() const;
93 virtual QPixmap icon() const;
94 virtual QString type() const;
97 virtual void onValueChanged();
100 bool editHypothesis( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget* );
103 SMESH::SMESH_Hypothesis_var myHypo, myInitParamsHypo;
106 ListOfWidgets myParamWidgets;
111 class SMESHGUI_HypothesisDlg : public QtxDialog
116 SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator*, QWidget* );
117 virtual ~SMESHGUI_HypothesisDlg();
119 void setHIcon( const QPixmap& );
120 void setCustomFrame( QFrame* );
121 void setType( const QString& );
124 virtual void accept();
125 virtual void reject();
129 SMESHGUI_GenericHypothesisCreator* myCreator;
130 QVBoxLayout* myLayout;
133 QString myHelpFileName;
137 * \brief Class containing information about hypothesis
142 HypothesisData( const QString& theTypeName,
143 const QString& thePluginName,
144 const QString& theServerLibName,
145 const QString& theClientLibName,
146 const QString& theLabel,
147 const QString& theIconId,
148 const QValueList<int>& theDim,
150 const QStringList& theNeededHypos,
151 const QStringList& theOptionalHypos,
152 const QStringList& theInputTypes,
153 const QStringList& theOutputTypes,
154 const bool theIsNeedGeometry = true)
155 : TypeName( theTypeName ),
156 PluginName( thePluginName ),
157 ServerLibName( theServerLibName ),
158 ClientLibName( theClientLibName ),
163 NeededHypos( theNeededHypos ), OptionalHypos( theOptionalHypos ),
164 InputTypes( theInputTypes ), OutputTypes( theOutputTypes ),
165 IsNeedGeometry( theIsNeedGeometry )
168 QString TypeName; //!< hypothesis type name
169 QString PluginName; //!< plugin name
170 QString ServerLibName; //!< server library name
171 QString ClientLibName; //!< client library name
172 QString Label; //!< label
173 QString IconId; //!< icon identifier
174 QValueList<int> Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration)
175 bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise
176 bool IsNeedGeometry; //!< TRUE if for given hypothesis need shape, FALSE otherwise
178 // for algorithm only: dependencies algo <-> algo and algo -> hypos
179 QStringList NeededHypos; //!< list of obligatory hypotheses
180 QStringList OptionalHypos;//!< list of optional hypotheses
181 QStringList InputTypes; //!< list of element types required as a prerequisite
182 QStringList OutputTypes; //!< list of types of generated elements
186 * \brief Class containing set of hypotheses
188 * Actually it contains list of hypo types
193 HypothesesSet( const QString& theSetName )
194 : HypoSetName( theSetName ) {};
195 HypothesesSet( const QString& theSetName,
196 const QStringList& theHypoList,
197 const QStringList& theAlgoList )
198 : HypoSetName( theSetName ), HypoList(theHypoList), AlgoList(theAlgoList) {};
200 QStringList HypoList, AlgoList;