Salome HOME
Updated copyright comment
[modules/gui.git] / src / Qtx / QtxTable.h
1 // Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 // File:      QtxTable.h
24 // Author:    Sergey TELKOV
25 //
26 #ifndef QTXTABLE_H
27 #define QTXTABLE_H
28
29 #include "Qtx.h"
30
31 #include <qtable.h>
32
33 #ifndef QT_NO_TABLE
34
35 class QHeader;
36
37 class QTX_EXPORT QtxTable : public QTable
38 {
39   Q_OBJECT
40
41   class HeaderEditor;
42
43 public:
44   QtxTable( QWidget* = 0, const char* = 0 );
45   QtxTable( int, int, QWidget* = 0, const char* = 0 );
46   virtual ~QtxTable();
47
48   bool             headerEditable( Orientation ) const;
49
50   bool             editHeader( Orientation, const int );
51   void             endEditHeader( const bool = true );
52
53   virtual bool     eventFilter( QObject*, QEvent* );
54
55 signals:
56   void             headerEdited( QHeader*, int );
57   void             headerEdited( Orientation, int );
58
59 public slots:
60   virtual void     hide();
61   virtual void     setHeaderEditable( Orientation, bool );
62
63 private slots:
64   void             onScrollBarMoved( int );
65   void             onHeaderSizeChange( int, int, int );
66
67 protected:
68   virtual void     resizeEvent( QResizeEvent* );
69
70   virtual bool     beginHeaderEdit( Orientation, const int );
71   virtual void     endHeaderEdit( const bool = true );
72   bool             isHeaderEditing() const;
73   virtual QWidget* createHeaderEditor( QHeader*, const int, const bool = true );
74   virtual void     setHeaderContentFromEditor( QHeader*, const int, QWidget* );
75
76   QHeader*         header( Orientation o ) const;
77
78 private:
79   void             updateHeaderEditor();
80   void             beginHeaderEdit( Orientation, const QPoint& );
81   QRect            headerSectionRect( QHeader*, const int ) const;
82
83 private:
84   QWidget*         myHeaderEditor;
85   QHeader*         myEditedHeader;
86   int              myEditedSection;
87   QMap<int, bool>  myHeaderEditable;
88 };
89
90 #endif
91
92 #endif // QTXTABLE_H