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