// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class SMESHGUI_aParameter
{
public:
- SMESHGUI_aParameter(const QString& label):_label(label) {}
+ typedef bool (*VALIDATION_FUNC)( SMESHGUI_aParameter* );
+
+ SMESHGUI_aParameter(const QString& label, const bool = false );
virtual ~SMESHGUI_aParameter();
enum Type { INT, DOUBLE, STRING, ENUM, BOOL, TABLE };
virtual QWidget* CreateWidget( QWidget* ) const = 0;
virtual void InitializeWidget( QWidget* ) const = 0;
+ bool needPreview() const;
+
/*!
* \brief Returns string representation of signal emitted when value in corrsponding widget is changed
*/
virtual QString sigValueChanged() const;
- QString & Label() { return _label; }
+ QString & Label();
-private:
+protected:
QString _label;
+ bool _needPreview;
};
/*!
SMESHGUI_intParameter(const int initValue = 0,
const QString& label = QString::null,
const int bottom = 0,
- const int top = 1000);
+ const int top = 1000,
+ const bool = false );
int & InitValue() { return _initValue; }
int & Top() { return _top; }
int & Bottom() { return _bottom; }
virtual QString sigValueChanged() const;
-private:
+protected:
int _top, _bottom;
int _initValue, _newValue;
};
const double bottom = -1E6,
const double top = +1E6,
const double step = 1.0,
- const int decimals = 3);
+ const int decimals = 3,
+ const bool = false);
double & InitValue() { return _initValue; }
double & Top() { return _top; }
double & Bottom() { return _bottom; }
virtual QString sigValueChanged() const;
-private:
+protected:
double _top, _bottom, _step;
double _initValue, _newValue;
int _decimals;
{
public:
SMESHGUI_strParameter( const QString& initValue = "",
- const QString& label = QString::null);
+ const QString& label = QString::null,
+ const bool = false );
QString& InitValue() { return _initValue; }
virtual Type GetType() const;
virtual bool GetNewInt( int & Value ) const;
virtual QString sigValueChanged() const;
-private:
+protected:
QString _initValue, _newValue;
};
typedef QMap< int, IntList > ShownMap;
public:
- SMESHGUI_dependParameter( const QString& = QString::null );
+ SMESHGUI_dependParameter( const QString& = QString::null, const bool = false );
const ShownMap& shownMap() const;
ShownMap& shownMap();
*/
SMESHGUI_enumParameter( const QStringList& values,
const int init = 0,
- const QString& label = QString::null );
+ const QString& label = QString::null,
+ const bool = false );
virtual ~SMESHGUI_enumParameter();
/*!
virtual QString sigValueChanged() const;
-private:
+protected:
int myInitValue, myValue;
QStringList myValues;
};
{
public:
SMESHGUI_boolParameter( const bool = false,
- const QString& = QString::null );
+ const QString& = QString::null,
+ const bool = false );
virtual ~SMESHGUI_boolParameter();
bool& InitValue() { return myInitValue; }
virtual QString sigValueChanged() const;
-private:
+protected:
bool myInitValue, myValue;
};
class QButton;
+class SMESHGUI_tableParameter;
+
/*!
* \brief This class represents custom table. It has only double values and
Q_OBJECT
public:
- SMESHGUI_Table( int numRows, int numCols, QWidget* = 0, const char* = 0 );
+ SMESHGUI_Table( const SMESHGUI_tableParameter*, int numRows, int numCols, QWidget* = 0, const char* = 0 );
virtual ~SMESHGUI_Table();
/*!
void setValidator( const double, const double, const int,
const int rmin = -1, const int rmax = -1,
const int cmin = -1, const int cmax = -1 );
+
+protected:
+ virtual void keyPressEvent( QKeyEvent* );
+ virtual bool eventFilter( QObject*, QEvent* );
+ virtual QWidget* createEditor( int, int, bool ) const;
+
+private:
+ SMESHGUI_tableParameter* myParam;
};
typedef enum { ADD_COLUMN, REMOVE_COLUMN, ADD_ROW, REMOVE_ROW } Button;
public:
- SMESHGUI_TableFrame( QWidget* );
+ SMESHGUI_TableFrame( const SMESHGUI_tableParameter*, QWidget* );
~SMESHGUI_TableFrame();
SMESHGUI_Table* table() const;
* this object resize table ( returned by table() ) automatically
*/
void toEdit( SMESHGUI_TableFrame::Button, int );
+ void valueChanged( int, int );
private:
QButton *myAddColumn, *myRemoveColumn, *myAddRow, *myRemoveRow;
* and if new column or row is added then it is filled with default value
*/
SMESHGUI_tableParameter( const double init = 0.0,
- const QString& label = QString::null );
+ const QString& label = QString::null,
+ const bool preview = false );
virtual ~SMESHGUI_tableParameter();
virtual Type GetType() const;
virtual void InitializeWidget( QWidget* ) const;
virtual void TakeValue( QWidget* );
+ static void sortData( SMESH::double_array& );
+
/*!
* \brief Updates look of widget in accordance with all parameters of this object
*/
private slots:
void onEdit( SMESHGUI_TableFrame::Button, int );
+ void onEdit( SMESHGUI_Table*, SMESHGUI_TableFrame::Button, int );
private:
void setItems( QWidget*, int = -1, int = -1, int = -1, int = -1 ) const;
ValidatorsMap myValidators;
bool myEditCols, myEditRows;
QMap< int, QString > myColNames;
+
+ friend class SMESHGUI_Table;
};
#endif // SMESHGUI_aParameter.h
+