Salome HOME
8ebc45530fff5a2cf9fe53f5405188756285e4bf
[modules/yacs.git] / src / genericgui / SchemaItem.hxx
1 //  Copyright (C) 2006-2008  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 _SCHEMAITEM_HXX_
20 #define _SCHEMAITEM_HXX_
21
22 #include "SchemaModel.hxx"
23
24 namespace YACS
25 {
26   namespace ENGINE
27   {
28     class Node;
29   }
30
31   namespace HMI
32   {
33     class ItemMimeData;
34
35     class SchemaItem: public QObject, public GuiObserver
36     {
37       Q_OBJECT
38
39     public:
40       SchemaItem(SchemaItem *parent, QString label, Subject* subject);
41       virtual ~SchemaItem();
42       
43       virtual void appendChild(SchemaItem *child);
44       virtual void removeChild(SchemaItem *child);
45       virtual void insertChild(int row, SchemaItem *child);
46       
47       virtual SchemaItem *child(int row);
48       virtual int childCount() const;
49       virtual int columnCount() const;
50       virtual QVariant data(int column, int role) const;
51       virtual Qt::ItemFlags flags(const QModelIndex &index);
52       virtual int row() const;
53       virtual SchemaItem *parent();
54       virtual Subject* getSubject();
55       virtual void update(GuiEvent event, int type, Subject* son);
56       virtual void select(bool isSelected);
57       virtual void toggleState();
58       QModelIndex modelIndex(int column = 0);
59       virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
60       virtual ItemMimeData* mimeData(ItemMimeData *mime);
61       virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action);
62       virtual void reparent(SchemaItem *parent);
63       virtual void setCaseValue();
64
65     protected:
66       virtual QVariant editionToolTip(int column) const;
67       virtual QVariant runToolTip(int column) const;
68       virtual QVariant editionWhatsThis(int column) const;
69       virtual QVariant runWhatsThis(int column) const;
70       virtual QString getMimeFormat();
71       virtual void setExecState(int execState);
72       QList<SchemaItem*> _childItems;
73       QList<QVariant> _itemData;
74       QList<QVariant> _itemDeco;
75       QList<QVariant> _itemForeground;
76       QList<QVariant> _itemBackground;
77       QList<QVariant> _itemCheckState;
78       QList<QVariant> _itemToolTip;
79       QList<QVariant> _itemWhatsThis;
80       QString _label;
81       SchemaItem *_parentItem;
82       Subject* _subject;
83       int _execState;
84     };
85
86
87 //     class SchemaSelectionModel: public QItemSelectionModel
88 //     {
89 //     public:
90 //       SchemaSelectionModel(QAbstractItemModel *model);
91 //       SchemaSelectionModel(QAbstractItemModel *model, QObject *parent);
92 //       virtual ~SchemaSelectionModel();
93 //     };
94
95   }
96 }
97
98 #endif