Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/visu.git] / src / GUITOOLS / VisuGUI_TableDlg.h
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
4 //  This library is free software; you can redistribute it and/or 
5 //  modify it under the terms of the GNU Lesser General Public 
6 //  License as published by the Free Software Foundation; either 
7 //  version 2.1 of the License. 
8 // 
9 //  This library is distributed in the hope that it will be useful, 
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 //  Lesser General Public License for more details. 
13 // 
14 //  You should have received a copy of the GNU Lesser General Public 
15 //  License along with this library; if not, write to the Free Software 
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 // 
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //  File   : VisuGUI_TableDlg.h
21 //  Author : Vadim SANDLER
22 //  Module : VISU
23
24 #ifndef VisuGUI_TABLE_DLG_H
25 #define VisuGUI_TABLE_DLG_H
26
27 #include <qdialog.h>
28 #include <qlineedit.h>
29 #include <qpushbutton.h>
30
31 class VisuGUI_Table;
32 class VisuGUI_TableWidget;
33
34 #include <SALOMEDSClient_SObject.hxx>
35
36 class VisuGUI_TableDlg : public QDialog
37
38   Q_OBJECT
39
40 public:
41
42   enum { ttNone, ttInt, ttReal, ttBoth, ttAuto };
43
44   VisuGUI_TableDlg( QWidget* parent, 
45                     _PTR(SObject) obj, 
46                     bool edit = false,
47                     int which = ttAuto, 
48                     Orientation orient = Horizontal,
49                     bool showColumnTitles = true );
50   ~VisuGUI_TableDlg();
51
52 public slots:
53   void onOK();
54   void onHelp(); 
55
56 private:
57   void initDlg();
58
59 private:
60   VisuGUI_TableWidget*   myIntTable;
61   VisuGUI_TableWidget*   myRealTable;
62   QPushButton*           myOKBtn;
63   QPushButton*           myCancelBtn;
64   QPushButton*           myHelpBtn;
65
66   _PTR(SObject) myObject;
67 };
68  
69 class VisuGUI_TableWidget : public QWidget
70 {
71   Q_OBJECT
72 public:
73   VisuGUI_TableWidget( QWidget* parent = 0, 
74                        const char* name = 0, 
75                        bool edit = false, 
76                        Orientation orient = Horizontal,
77                        bool showColumnTitles = true );
78   ~VisuGUI_TableWidget();
79
80   void    setTableTitle( const QString& title );
81   QString getTableTitle();
82   void    setNumRows( const int num );
83   int     getNumRows();
84   void    setNumCols( const int num );
85   int     getNumCols();
86   void    setRowTitles( QStringList& tlts );
87   void    getRowTitles( QStringList& tlts );
88   void    setColTitles( QStringList& tlts );
89   void    getColTitles( QStringList& tlts );
90   void    setUnitsTitle( const QString& tlt );
91   void    setUnits( QStringList& units );
92   void    getUnits( QStringList& units );
93   void    setRowData( int row, QStringList& data );
94   void    getRowData( int row, QStringList& data );
95
96   VisuGUI_Table*   getTable()     { return myTable; } 
97   QLineEdit*       getTitleEdit() { return myTitleEdit; }
98
99   bool    eventFilter( QObject* o, QEvent* e);
100
101 public slots:
102   void updateButtonsState();
103   void addRow();
104   void addCol();
105   void delRow();
106   void delCol();
107   void adjustTable();
108   void selectAll();
109   void clearTable();
110
111 private:
112   QLineEdit*       myTitleEdit;
113   VisuGUI_Table*   myTable;
114   QPushButton*     myAddRowBtn;
115   QPushButton*     myAddColBtn;
116   QPushButton*     myDelRowBtn;
117   QPushButton*     myDelColBtn;
118   QPushButton*     myAdjustBtn;
119   QPushButton*     mySelectAllBtn;
120   QPushButton*     myClearBtn;
121   Orientation      myOrientation;
122 };
123
124 #endif // VisuGUI_TABLE_DLG_H
125