]> SALOME platform Git repositories - modules/visu.git/blob - src/GUITOOLS/VisuGUI_TableDlg.h
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[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 #include "VisuGUITools.h"
37
38 class VISU_GUITOOLS_EXPORT VisuGUI_TableDlg : public QDialog
39
40   Q_OBJECT
41
42 public:
43
44   enum { ttNone, ttInt, ttReal, ttBoth, ttAuto };
45
46   VisuGUI_TableDlg( QWidget* parent, 
47                     _PTR(SObject) obj, 
48                     bool edit = false,
49                     int which = ttAuto, 
50                     Orientation orient = Horizontal,
51                     bool showColumnTitles = true );
52   ~VisuGUI_TableDlg();
53
54 private:
55   void keyPressEvent( QKeyEvent* e );
56
57 public slots:
58   void onOK();
59   void onHelp(); 
60
61 private:
62   void initDlg();
63
64 private:
65   VisuGUI_TableWidget*   myIntTable;
66   VisuGUI_TableWidget*   myRealTable;
67   QPushButton*           myOKBtn;
68   QPushButton*           myCancelBtn;
69   QPushButton*           myHelpBtn;
70
71   _PTR(SObject) myObject;
72 };
73  
74 class VisuGUI_TableWidget : public QWidget
75 {
76   Q_OBJECT
77 public:
78   VisuGUI_TableWidget( QWidget* parent = 0, 
79                        const char* name = 0, 
80                        bool edit = false, 
81                        Orientation orient = Horizontal,
82                        bool showColumnTitles = true );
83   ~VisuGUI_TableWidget();
84
85   void    setTableTitle( const QString& title );
86   QString getTableTitle();
87   void    setNumRows( const int num );
88   int     getNumRows();
89   void    setNumCols( const int num );
90   int     getNumCols();
91   void    setRowTitles( QStringList& tlts );
92   void    getRowTitles( QStringList& tlts );
93   void    setColTitles( QStringList& tlts );
94   void    getColTitles( QStringList& tlts );
95   void    setUnitsTitle( const QString& tlt );
96   void    setUnits( QStringList& units );
97   void    getUnits( QStringList& units );
98   void    setRowData( int row, QStringList& data );
99   void    getRowData( int row, QStringList& data );
100
101   VisuGUI_Table*   getTable()     { return myTable; } 
102   QLineEdit*       getTitleEdit() { return myTitleEdit; }
103
104   bool    eventFilter( QObject* o, QEvent* e);
105
106 public slots:
107   void updateButtonsState();
108   void addRow();
109   void addCol();
110   void delRow();
111   void delCol();
112   void adjustTable();
113   void selectAll();
114   void clearTable();
115
116 private:
117   QLineEdit*       myTitleEdit;
118   VisuGUI_Table*   myTable;
119   QPushButton*     myAddRowBtn;
120   QPushButton*     myAddColBtn;
121   QPushButton*     myDelRowBtn;
122   QPushButton*     myDelColBtn;
123   QPushButton*     myAdjustBtn;
124   QPushButton*     mySelectAllBtn;
125   QPushButton*     myClearBtn;
126   Orientation      myOrientation;
127 };
128
129 #endif // VisuGUI_TABLE_DLG_H
130