Salome HOME
NRI : Add message (GUI lib not found).
[modules/kernel.git] / src / SALOMEGUI / SALOMEGUI_TableDlg.h
1 //  File      : SALOMEGUI_TableDlg.h
2 //  Created   : Wed Dec 25 12:00:00 2002
3 //  Descr     : Dialog box for displaying/editing of table
4
5 //  Author    : Vadim SANDLER
6 //  Project   : SALOME for ALLIANCES
7 //  Module    : SALOMEGUI
8 //  Copyright : Open CASCADE
9 //  $Header$
10
11 #ifndef SALOMEGUI_TABLE_DLG_H
12 #define SALOMEGUI_TABLE_DLG_H
13
14 #include <qdialog.h>
15 #include <qlineedit.h>
16 #include <qpushbutton.h>
17
18 class SALOMEGUI_Table;
19 class SALOMEGUI_TableWidget;
20
21 #include <SALOMEconfig.h>
22 #include CORBA_SERVER_HEADER(SALOMEDS)
23 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
24
25 class SALOMEGUI_TableDlg : public QDialog
26
27   Q_OBJECT
28
29 public:
30
31   enum { ttNone, ttInt, ttReal, ttBoth, ttAuto };
32
33   SALOMEGUI_TableDlg( QWidget* parent, 
34                       SALOMEDS::SObject_var obj, 
35                       bool edit = false,
36                       int which = ttAuto, 
37                       Orientation orient = Horizontal,
38                       bool showColumnTitles = true );
39   ~SALOMEGUI_TableDlg();
40
41 public slots:
42   void onOK();
43
44 private:
45   void initDlg();
46
47 private:
48   SALOMEGUI_TableWidget* myIntTable;
49   SALOMEGUI_TableWidget* myRealTable;
50   QPushButton*           myOKBtn;
51   QPushButton*           myCancelBtn;
52
53   SALOMEDS::SObject_var myObject;
54 };
55  
56 class SALOMEGUI_TableWidget : public QWidget
57 {
58   Q_OBJECT
59 public:
60   SALOMEGUI_TableWidget( QWidget* parent = 0, 
61                          const char* name = 0, 
62                          bool edit = false, 
63                          Orientation orient = Horizontal,
64                          bool showColumnTitles = true );
65   ~SALOMEGUI_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   SALOMEGUI_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   SALOMEGUI_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 // SALOMEGUI_TABLE_DLG_H
112