Salome HOME
LOT 15
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_StricklerTableDlg.h
index fef70326d6f887f42ab82dee11f99874eee8ddb7..11704db432d2c253edc8ce99ee5509c53326df41 100644 (file)
@@ -20,6 +20,8 @@
 #define HYDROGUI_STRICKLERTABLEDLG_H
 
 #include "HYDROGUI_InputPanel.h"
+#include <QAbstractItemDelegate>
+#include <Standard_Type.hxx>
 
 class HYDROData_StricklerTable;
 
@@ -27,67 +29,82 @@ class QGroupBox;
 class QLineEdit;
 class QToolButton;
 class QTableWidget;
+class QtxFilePath;
 
 class HYDROGUI_StricklerTableDlg : public HYDROGUI_InputPanel
 {
-  Q_OBJECT
+    Q_OBJECT
 
 public:
-  struct StricklerCoefficient
-  {
-    QString myType;
-       double  myCoefficient;
-
-    StricklerCoefficient(  const QString& theType,
-                           double theCoefficient )
-      : myType( theType ), myCoefficient( theCoefficient ) {}
-  };
-  typedef QList<StricklerCoefficient> StricklerCoefficientList;
+    enum { Edit, Import, Export };
 
 public:
-  HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModule, const QString& theTitle );
-  virtual ~HYDROGUI_StricklerTableDlg();
+    HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModule, const QString& theTitle, int theType );
+    virtual ~HYDROGUI_StricklerTableDlg();
+
+    void                       reset();
 
-  void                       setIsEdit( const bool theIsEdit );
-  void                       reset();
+    QString                    getFileName() const;
+    void                       setFileName( const QString& theName );
 
-  QString                    getFileName() const;
-  void                       setFileName( const QString& theName );
+    void                       setTableName( const QString& theName );
+    QString                    getTableName() const;
 
-  void                       setStricklerTableName( const QString& theName );
-  QString                    getStricklerTableName() const;
+    bool                       isTableNameReadOnly() const;
+    void                       setTableNameReadOnly( bool );
 
-  void                       setData(const StricklerCoefficientList& theData);
+    void                       getGuiData( Handle(HYDROData_StricklerTable)& theTable ) const;
+    void                       setGuiData( const Handle(HYDROData_StricklerTable)& theTable );
 
 protected:
-  void                       updateControls();
-  void                       removeRows( const QList<int> theRows );
+    void                       updateControls();
+    void                       removeRows( const QList<int> theRows );
 
-protected slots:
-  void                       onBrowse();
+protected Q_SLOTS:
+    void                       onBrowse();
 
-  void                       onAddCoefficient();
-  void                       onRemoveCoefficient();
-  void                       onClearCoefficients();
+    void                       onAddCoefficient();
+    void                       onRemoveCoefficient();
+    void                       onClearCoefficients();
 
-  void                       onSelectionChanged();
+    void                       onSelectionChanged();
 
-signals:
-  void                       fileSelected( const QString& theFileName );
+Q_SIGNALS:
+    void                       fileSelected( const QString& theFileName );
 
 private:
-  QGroupBox*                 myFileNameGroup;    //!< The group for the source Strickler table file selection
-  QLineEdit*                 myFileName;         //!< Source Strickler table file name input field
-  QToolButton*               myBrowseBtn;
+  friend class test_HYDROData_StricklerTable;
 
-  QGroupBox*                 myNameGroup;   //!< The group for the Strickler table name input field
-  QLineEdit*                 myName;        //!< The Strickler table name input field
-
-  QGroupBox*                 myTableGroup; //!< The group for the Strickler table table control and buttons
+private:
+  int                        myType;
+  QLineEdit*                 myFileName;   //!< Source Strickler table file name input field
+  QLineEdit*                 myName;       //!< The Strickler table name input field
+  QLineEdit*                 myAttrName;   //!< The Strickler table attribute's name input field
   QTableWidget*              myTable;      //!< The table of Strickler coefficients
   QToolButton*               myAddBtn;     //!< The add Strickler coefficient button
   QToolButton*               myRemoveBtn;  //!< The remove Strickler coefficient button
   QToolButton*               myClearBtn;   //!< The clear all Strickler coefficients button
 };
 
+class HYDROGUI_ColorDelegate : public QAbstractItemDelegate
+{
+public:
+  HYDROGUI_ColorDelegate( QWidget* theParent );
+  virtual ~HYDROGUI_ColorDelegate();
+
+  virtual void paint( QPainter* thePainter, const QStyleOptionViewItem& theOption,
+                      const QModelIndex& theIndex ) const;
+
+  virtual QWidget* createEditor( QWidget* theParent,
+                                 const QStyleOptionViewItem& theOption,
+                                 const QModelIndex& theIndex ) const;
+
+  virtual void setEditorData( QWidget* theEditor, const QModelIndex& theIndex ) const;
+
+  virtual void setModelData( QWidget* theEditor, QAbstractItemModel* theModel,
+                             const QModelIndex& theIndex ) const;
+
+  virtual QSize        sizeHint( const QStyleOptionViewItem& theOption, const QModelIndex& theIndex ) const;
+};
+
 #endif