Salome HOME
Fix compilation problem with OCCT 6.7.0
[modules/hexablock.git] / src / HEXABLOCKGUI / HEXABLOCKGUI_DocumentDelegate.hxx
1 // Copyright (C) 2009-2013  CEA/DEN, EDF 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 __HEXABLOCKGUI_DOCUMENTDELEGATE_HXX_
20 #define __HEXABLOCKGUI_DOCUMENTDELEGATE_HXX_
21
22
23 // QEvent * event, QAbstractItemModel 
24
25 #include <QEvent>
26 #include <QItemDelegate>
27 #include <QModelIndex>
28 #include <QObject>
29 #include <QSize>
30 #include <QSpinBox>
31
32 #include <QDockWidget>
33
34
35 #include "HEXABLOCKGUI_DocumentModel.hxx"
36 #include "HEXABLOCKGUI_DocumentSelectionModel.hxx"
37 #include "HEXABLOCKGUI_DocumentItem.hxx"
38 #include "HEXABLOCKGUI_DocumentPanel.hxx"
39
40 #include "hexa_base.hxx"
41
42 namespace HEXABLOCK
43 {
44   namespace GUI
45   {
46       class HexaExport DocumentDelegate : public QItemDelegate
47       {
48           Q_OBJECT
49       
50       public:
51           /// close the editor
52           void closeDialog();
53
54           DocumentDelegate( QDockWidget *dw, QObject *parent = 0);
55
56           /// create the editor
57           QWidget *createEditor( QWidget *parent,
58                                  const QStyleOptionViewItem &option,
59                                  const QModelIndex &index) const;
60
61           /// set editor's data
62           void setEditorData( QWidget *editor, const QModelIndex &index) const;
63
64           /// set the editor's model
65           void setModelData( QWidget            *editor,
66                              QAbstractItemModel *model,
67                              const QModelIndex  &index ) const {};
68
69           virtual void updateEditorGeometry( QWidget *editor,
70                                      const QStyleOptionViewItem &option,
71                                      const QModelIndex &index ) const {};
72
73       protected:
74           mutable QWidget* _currentEditor;
75           virtual bool editorEvent ( QEvent * event,
76                           QAbstractItemModel * model,
77                           const QStyleOptionViewItem & option, const QModelIndex & index );
78           virtual bool  eventFilter ( QObject * editor, QEvent * event );
79
80       private:
81           QDockWidget* _dw; // creator's container
82
83       private slots:
84           void commitEditor();
85
86       };
87   }
88 }
89
90 #endif