X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_aParameter.h;h=5bb79a04ae36d866d537b5c356446e210d68595f;hp=8613b50dd1a8a2ef1b7a6891e566d56bcb73aa7a;hb=ffd567ddfa3eae0e41303e5c462c3bbe66065e32;hpb=61be698c0d2d886ce88ad99c43ede52fd0e4cd2b diff --git a/src/SMESHGUI/SMESHGUI_aParameter.h b/src/SMESHGUI/SMESHGUI_aParameter.h index 8613b50dd..5bb79a04a 100644 --- a/src/SMESHGUI/SMESHGUI_aParameter.h +++ b/src/SMESHGUI/SMESHGUI_aParameter.h @@ -17,7 +17,7 @@ // 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 // // // @@ -47,7 +47,9 @@ typedef boost::shared_ptr SMESHGUI_aParameterPtr; 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 }; @@ -59,15 +61,18 @@ public: 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; }; /*! @@ -79,7 +84,8 @@ public: 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; } @@ -93,7 +99,7 @@ public: virtual QString sigValueChanged() const; -private: +protected: int _top, _bottom; int _initValue, _newValue; }; @@ -109,7 +115,8 @@ public: 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; } @@ -125,7 +132,7 @@ public: virtual QString sigValueChanged() const; -private: +protected: double _top, _bottom, _step; double _initValue, _newValue; int _decimals; @@ -138,7 +145,8 @@ class SMESHGUI_strParameter: public SMESHGUI_aParameter { 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; @@ -150,7 +158,7 @@ public: virtual QString sigValueChanged() const; -private: +protected: QString _initValue, _newValue; }; @@ -171,7 +179,7 @@ public: 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(); @@ -192,7 +200,8 @@ public: */ 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(); /*! @@ -211,7 +220,7 @@ public: virtual QString sigValueChanged() const; -private: +protected: int myInitValue, myValue; QStringList myValues; }; @@ -224,7 +233,8 @@ class SMESHGUI_boolParameter: public SMESHGUI_dependParameter { public: SMESHGUI_boolParameter( const bool = false, - const QString& = QString::null ); + const QString& = QString::null, + const bool = false ); virtual ~SMESHGUI_boolParameter(); bool& InitValue() { return myInitValue; } @@ -238,12 +248,14 @@ public: 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 @@ -254,7 +266,7 @@ class SMESHGUI_Table : public QTable 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(); /*! @@ -278,6 +290,14 @@ public: 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; }; @@ -295,7 +315,7 @@ public: 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; @@ -324,6 +344,7 @@ signals: * this object resize table ( returned by table() ) automatically */ void toEdit( SMESHGUI_TableFrame::Button, int ); + void valueChanged( int, int ); private: QButton *myAddColumn, *myRemoveColumn, *myAddRow, *myRemoveRow; @@ -345,7 +366,8 @@ public: * 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; @@ -356,6 +378,8 @@ public: 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 */ @@ -416,6 +440,7 @@ public: 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; @@ -437,6 +462,9 @@ private: ValidatorsMap myValidators; bool myEditCols, myEditRows; QMap< int, QString > myColNames; + + friend class SMESHGUI_Table; }; #endif // SMESHGUI_aParameter.h +