]> SALOME platform Git repositories - modules/gui.git/blob - src/QDS/QDS_Table.h
Salome HOME
c7d33abf95fd0b300f0fed189251dd5d6246e623
[modules/gui.git] / src / QDS / QDS_Table.h
1 // Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef QDS_TABLE_H
20 #define QDS_TABLE_H
21
22 #include "QDS_Datum.h"
23
24 #include <QtxTable.h>
25
26 #include <qmap.h>
27 #include <qptrvector.h>
28
29 class QDS_EXPORT QDS_Table : public QtxTable
30 {
31   class DeleteFilter;
32
33   Q_OBJECT
34
35   Q_PROPERTY( bool KeepEditors READ isKeepEditors WRITE setKeepEditors )
36
37 public:
38   QDS_Table( QWidget* = 0, const char* = 0 );
39   QDS_Table( int, int, QWidget* = 0, const char* = 0 );
40   virtual ~QDS_Table();
41
42   QDS_Datum*       verticalHeaderEditor() const;
43   QDS_Datum*       horizontalHeaderEditor() const;
44   QDS_Datum*       headerEditor( const Orientation ) const;
45
46   void             setVerticalHeaderEditor( QDS_Datum* );
47   void             setHorizontalHeaderEditor( QDS_Datum* );
48
49   void             setHeaderEditor( QDS_Datum* );
50   virtual void     setHeaderEditor( const Orientation, QDS_Datum* );
51
52   QDS_Datum*       tableEditor() const;
53   virtual void     setTableEditor( QDS_Datum* );
54
55   QDS_Datum*       rowEditor( const int ) const;
56   QDS_Datum*       columnEditor( const int ) const;
57
58   virtual void     setRowEditor( const int, QDS_Datum* );
59   virtual void     setColumnEditor( const int, QDS_Datum* );
60
61   QDS_Datum*       cellEditor( const int, const int ) const;
62   virtual void     setCellEditor( const int, const int, QDS_Datum* );
63
64   QDS_Datum*       actualCellEditor( const int, const int ) const;
65
66   virtual void     setNumRows( int );
67   virtual void     setNumCols( int );
68   virtual void     clearCellWidget( int, int );
69
70   bool             isKeepEditors() const;
71   void             setKeepEditors( const bool );
72
73 protected:
74   virtual QWidget* createHeaderEditor( QHeader*, const int, const bool = true );
75   virtual QWidget* createEditor( int, int, bool ) const;
76   virtual void     endEdit( int, int, bool, bool );
77   virtual void     setCellContentFromEditor( int, int );
78   virtual void     setHeaderContentFromEditor( QHeader*, const int, QWidget* );
79
80 private:
81   void             initEditor( QDS_Datum* );
82   QDS_Datum*       datum( const QWidget* ) const;
83
84 private:
85   typedef QPtrVector<QDS_Datum>       DatumVector;
86   typedef QMap<int, QDS_Datum*>       DatumMap;
87   typedef QMap<int, DatumMap>         CellMap;
88
89 private:
90   QDS_Datum*       myHorEdit;
91   QDS_Datum*       myVerEdit;
92   DatumVector      myRowEdit;
93   DatumVector      myColEdit;
94   CellMap          myCellEdit;
95   QDS_Datum*       myTableEdit;
96   bool             myKeepEdits;
97 };
98
99 #endif