Salome HOME
0fa872b2d18fd1e27e35e48b70b5af70031a28bd
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_StricklerTableDlg.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROGUI_STRICKLERTABLEDLG_H
20 #define HYDROGUI_STRICKLERTABLEDLG_H
21
22 #include "HYDROGUI_InputPanel.h"
23
24 class HYDROData_StricklerTable;
25
26 class QGroupBox;
27 class QLineEdit;
28 class QToolButton;
29 class QTableWidget;
30 class QtxFilePath;
31
32 class HYDROGUI_StricklerTableDlg : public HYDROGUI_InputPanel
33 {
34     Q_OBJECT
35
36 public:
37     struct StricklerCoefficient
38     {
39         QString myType;
40         double  myCoefficient;
41
42         StricklerCoefficient(  const QString& theType,
43             double theCoefficient )
44             : myType( theType ), myCoefficient( theCoefficient ) {}
45     };
46     typedef QList<StricklerCoefficient> StricklerCoefficientList;
47
48     enum { Edit, Import, Export };
49
50 public:
51     HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModule, const QString& theTitle, int theType );
52     virtual ~HYDROGUI_StricklerTableDlg();
53
54     void                       reset();
55
56     QString                    getFileName() const;
57     void                       setFileName( const QString& theName );
58
59     void                       setTableName( const QString& theName );
60     QString                    getTableName() const;
61
62     bool                       isTableNameReadOnly() const;
63     void                       setTableNameReadOnly( bool );
64
65     StricklerCoefficientList   getData() const;
66     void                       setData(const StricklerCoefficientList& theData);
67
68 protected:
69     void                       updateControls();
70     void                       removeRows( const QList<int> theRows );
71
72 protected Q_SLOTS:
73     void                       onBrowse();
74
75     void                       onAddCoefficient();
76     void                       onRemoveCoefficient();
77     void                       onClearCoefficients();
78
79     void                       onSelectionChanged();
80
81 Q_SIGNALS:
82     void                       fileSelected( const QString& theFileName );
83
84 private:
85     int                        myType;
86     QLineEdit*                 myFileName;   //!< Source Strickler table file name input field
87     QLineEdit*                 myName;       //!< The Strickler table name input field
88     QTableWidget*              myTable;      //!< The table of Strickler coefficients
89     QToolButton*               myAddBtn;     //!< The add Strickler coefficient button
90     QToolButton*               myRemoveBtn;  //!< The remove Strickler coefficient button
91     QToolButton*               myClearBtn;   //!< The clear all Strickler coefficients button
92 };
93
94 #endif