]> SALOME platform Git repositories - modules/visu.git/blob - src/GUITOOLS/VisuGUI_TableDlg.h
Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/visu.git] / src / GUITOOLS / VisuGUI_TableDlg.h
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : VisuGUI_TableDlg.h
8 //  Author : Vadim SANDLER
9 //  Module : VISU
10
11 #ifndef VisuGUI_TABLE_DLG_H
12 #define VisuGUI_TABLE_DLG_H
13
14 #include <qdialog.h>
15 #include <qlineedit.h>
16 #include <qpushbutton.h>
17
18 class VisuGUI_Table;
19 class VisuGUI_TableWidget;
20
21 #include <SALOMEDSClient_SObject.hxx>
22
23 class VisuGUI_TableDlg : public QDialog
24
25   Q_OBJECT
26
27 public:
28
29   enum { ttNone, ttInt, ttReal, ttBoth, ttAuto };
30
31   VisuGUI_TableDlg( QWidget* parent, 
32                     _PTR(SObject) obj, 
33                     bool edit = false,
34                     int which = ttAuto, 
35                     Orientation orient = Horizontal,
36                     bool showColumnTitles = true );
37   ~VisuGUI_TableDlg();
38
39 public slots:
40   void onOK();
41   void onHelp(); 
42
43 private:
44   void initDlg();
45
46 private:
47   VisuGUI_TableWidget*   myIntTable;
48   VisuGUI_TableWidget*   myRealTable;
49   QPushButton*           myOKBtn;
50   QPushButton*           myCancelBtn;
51   QPushButton*           myHelpBtn;
52
53   _PTR(SObject) myObject;
54 };
55  
56 class VisuGUI_TableWidget : public QWidget
57 {
58   Q_OBJECT
59 public:
60   VisuGUI_TableWidget( QWidget* parent = 0, 
61                        const char* name = 0, 
62                        bool edit = false, 
63                        Orientation orient = Horizontal,
64                        bool showColumnTitles = true );
65   ~VisuGUI_TableWidget();
66
67   void    setTableTitle( const QString& title );
68   QString getTableTitle();
69   void    setNumRows( const int num );
70   int     getNumRows();
71   void    setNumCols( const int num );
72   int     getNumCols();
73   void    setRowTitles( QStringList& tlts );
74   void    getRowTitles( QStringList& tlts );
75   void    setColTitles( QStringList& tlts );
76   void    getColTitles( QStringList& tlts );
77   void    setUnitsTitle( const QString& tlt );
78   void    setUnits( QStringList& units );
79   void    getUnits( QStringList& units );
80   void    setRowData( int row, QStringList& data );
81   void    getRowData( int row, QStringList& data );
82
83   VisuGUI_Table*   getTable()     { return myTable; } 
84   QLineEdit*       getTitleEdit() { return myTitleEdit; }
85
86   bool    eventFilter( QObject* o, QEvent* e);
87
88 public slots:
89   void updateButtonsState();
90   void addRow();
91   void addCol();
92   void delRow();
93   void delCol();
94   void adjustTable();
95   void selectAll();
96   void clearTable();
97
98 private:
99   QLineEdit*       myTitleEdit;
100   VisuGUI_Table*   myTable;
101   QPushButton*     myAddRowBtn;
102   QPushButton*     myAddColBtn;
103   QPushButton*     myDelRowBtn;
104   QPushButton*     myDelColBtn;
105   QPushButton*     myAdjustBtn;
106   QPushButton*     mySelectAllBtn;
107   QPushButton*     myClearBtn;
108   Orientation      myOrientation;
109 };
110
111 #endif // VisuGUI_TABLE_DLG_H
112