1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_aParameter.h
28 #ifndef SMESHGUI_aParameter_H
29 #define SMESHGUI_aParameter_H
31 #include <boost/shared_ptr.hpp>
35 class SMESHGUI_aParameter;
37 typedef boost::shared_ptr<SMESHGUI_aParameter> SMESHGUI_aParameterPtr;
39 //=================================================================================
40 // class : SMESHGUI_aParameter
42 //=================================================================================
43 class SMESHGUI_aParameter
46 SMESHGUI_aParameter(const QString& label):_label(label) {}
47 virtual ~SMESHGUI_aParameter();
49 enum Type { INT, DOUBLE, TEXT };
50 virtual Type GetType() const = 0;
51 virtual bool GetNewInt( int & Value ) const = 0;
52 virtual bool GetNewDouble( double & Value ) const = 0;
53 virtual bool GetNewText( QString & Value ) const = 0;
54 virtual void InitializeWidget( QWidget* ) const = 0;
55 virtual void TakeValue( QWidget* ) = 0;
57 QString & Label() { return _label; }
63 //=================================================================================
64 // class : SMESHGUI_intParameter
66 //=================================================================================
67 class SMESHGUI_intParameter: public SMESHGUI_aParameter
70 SMESHGUI_intParameter(const int initValue = 0,
71 const QString& label = QString::null,
73 const int top = 1000);
74 int & InitValue() { return _initValue; }
75 int & Top() { return _top; }
76 int & Bottom() { return _bottom; }
77 virtual Type GetType() const;
78 virtual bool GetNewInt( int & Value ) const;
79 virtual bool GetNewDouble( double & Value ) const;
80 virtual bool GetNewText( QString & Value ) const;
81 virtual void InitializeWidget( QWidget* ) const;
82 virtual void TakeValue( QWidget* );
86 int _initValue, _newValue;
89 //=================================================================================
90 // class : SMESHGUI_doubleParameter
92 //=================================================================================
93 class SMESHGUI_doubleParameter: public SMESHGUI_aParameter
96 SMESHGUI_doubleParameter(const double initValue = 0.0,
97 const QString& label = QString::null,
98 const double bottom = -1E6,
99 const double top = +1E6,
100 const double step = 1.0,
101 const int decimals = 3);
102 double & InitValue() { return _initValue; }
103 double & Top() { return _top; }
104 double & Bottom() { return _bottom; }
105 double & Step() { return _step; }
106 int & Decimals() { return _decimals; }
107 virtual Type GetType() const;
108 virtual bool GetNewInt( int & Value ) const;
109 virtual bool GetNewDouble( double & Value ) const;
110 virtual bool GetNewText( QString & Value ) const;
111 virtual void InitializeWidget( QWidget* ) const;
112 virtual void TakeValue( QWidget* );
115 double _top, _bottom, _step;
116 double _initValue, _newValue;
121 //=================================================================================
122 // class : SMESHGUI_strParameter
124 //=================================================================================
125 class SMESHGUI_strParameter: public SMESHGUI_aParameter
128 SMESHGUI_strParameter(const QString& initValue = "",
129 const QString& label = QString::null);
130 QString InitValue() { return _initValue; }
131 virtual Type GetType() const;
132 virtual bool GetNewInt( int & Value ) const;
133 virtual bool GetNewDouble( double & Value ) const;
134 virtual bool GetNewText( QString & Value ) const;
135 virtual void InitializeWidget( QWidget* ) const;
136 virtual void TakeValue( QWidget* );
139 QString _initValue, _newValue;
142 #endif // SMESHGUI_aParameter.h