]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESHGUI/SMESHGUI_Hypotheses.h
Salome HOME
f48062b8ebcb91a68734c80ec6c633cd6c117f5d
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Hypotheses.h
1 //  SMESH SMESHGUI : GUI for SMESH component
2 //
3 //  Copyright (C) 2003  CEA
4 // 
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. 
9 // 
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. 
14 // 
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 
18 // 
19 //  See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
20 //
21 //
22 //
23 //  File   : SMESHGUI_Hypotheses.h
24 //  Author : Julia DOROVSKIKH
25 //  Module : SMESH
26 //  $Header$
27
28 #ifndef SMESHGUI_Hypotheses_HeaderFile
29 #define SMESHGUI_Hypotheses_HeaderFile
30
31 #include <SALOMEconfig.h>
32 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
33
34 #include <QtxDialog.h>
35 #include <qvariant.h>
36
37 class QVBoxLayout;
38 class QPixmap;
39
40 /*!
41  * \brief Auxiliary class for creation of hypotheses
42 */
43 class SMESHGUI_GenericHypothesisCreator : public QObject
44 {
45   Q_OBJECT
46
47 public:
48   SMESHGUI_GenericHypothesisCreator( const QString& );
49   virtual ~SMESHGUI_GenericHypothesisCreator();
50
51           void create( const bool isAlgo, QWidget* );
52           void edit( SMESH::SMESH_Hypothesis_ptr, QWidget* );
53   virtual bool checkParams() const = 0;
54
55   QString                     hypType() const;
56   bool                        isCreation() const;
57
58 protected:
59   typedef struct
60   {
61     QString   myName;
62     QVariant  myValue;
63
64   } StdParam;
65
66   typedef QValueList<StdParam>   ListOfStdParams;
67   typedef QPtrList<QWidget>      ListOfWidgets;
68
69   SMESH::SMESH_Hypothesis_var hypothesis() const;
70   const ListOfWidgets&        widgets() const;
71   ListOfWidgets&              changeWidgets();
72
73   virtual QFrame*  buildFrame    () = 0;
74           QFrame*  buildStdFrame ();
75   virtual void     retrieveParams() const = 0;
76   virtual void     storeParams   () const = 0;
77   virtual bool     stdParams     ( ListOfStdParams& ) const;
78           bool     getStdParamFromDlg( ListOfStdParams& ) const;
79   virtual void     attuneStdWidget( QWidget*, const int ) const;
80   virtual QWidget* getCustomWidget( const StdParam &, QWidget* ) const;
81   virtual bool     getParamFromCustomWidget( StdParam& , QWidget* ) const;
82   virtual QString  caption() const;
83   virtual QPixmap  icon() const;
84   virtual QString  type() const;
85
86 protected slots:
87   virtual void onValueChanged();
88
89 private:
90           bool editHypothesis( SMESH::SMESH_Hypothesis_ptr, QWidget* );
91
92 private:
93   SMESH::SMESH_Hypothesis_var  myHypo;
94   QString                      myHypType;
95   ListOfWidgets                myParamWidgets;
96   bool                         myIsCreate;
97 };
98
99 class SMESHGUI_HypothesisDlg : public QtxDialog
100 {
101   Q_OBJECT
102
103 public:
104   SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator*, QWidget* );
105   virtual ~SMESHGUI_HypothesisDlg();
106
107           void setHIcon( const QPixmap& );
108           void setCustomFrame( QFrame* );
109           void setType( const QString& );
110
111 protected slots:
112   virtual void accept();
113
114 private:
115   SMESHGUI_GenericHypothesisCreator*   myCreator;
116   QVBoxLayout*                         myLayout;
117   QLabel                              *myIconLabel, *myTypeLabel;
118 };
119
120 /*!
121  * \brief Class containing information about hypothesis
122 */
123 class HypothesisData
124 {
125  public:
126   HypothesisData( const QString& thePluginName,
127                   const QString& theServerLibName,
128                   const QString& theClientLibName,
129                   const QString& theLabel,
130                   const QString& theIconId,
131                   const QValueList<int>& theDim,
132                   const bool theIsAux ) 
133 : PluginName( thePluginName ),
134   ServerLibName( theServerLibName ),
135   ClientLibName( theClientLibName ),
136   Label( theLabel ),
137   IconId( theIconId ),
138   Dim( theDim ),
139   IsAux( theIsAux )
140  {};
141
142  QString PluginName;      //!< plugin name
143  QString ServerLibName;   //!< server library name
144  QString ClientLibName;   //!< client library name
145  QString Label;           //!< label
146  QString IconId;          //!< icon identifier
147  QValueList<int> Dim;     //!< list of supported dimensions (see SMESH::Dimension enumeration)
148  bool IsAux;              //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise
149 };
150
151 /*!
152  * \brief Class containing set of hypotheses
153  *
154  * Actually it contains list of hypo types
155  */
156 class HypothesesSet
157 {
158  public:
159   HypothesesSet( const QString& theSetName ) 
160     : HypoSetName( theSetName ) {};
161   HypothesesSet( const QString&     theSetName,
162                  const QStringList& theHypoList,
163                  const QStringList& theAlgoList )
164     : HypoSetName( theSetName ), HypoList(theHypoList), AlgoList(theAlgoList) {};
165   QString     HypoSetName;
166   QStringList HypoList, AlgoList;
167 };
168 #endif