1 // Copyright (C) 2006-2014 CEA/DEN, EDF R&D
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, or (at your option) any later version.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _SCHEMAITEM_HXX_
21 #define _SCHEMAITEM_HXX_
23 #include "SchemaModel.hxx"
36 class SchemaItem: public QObject, public GuiObserver
41 SchemaItem(SchemaItem *parent, QString label, Subject* subject);
42 virtual ~SchemaItem();
44 virtual void appendChild(SchemaItem *child);
45 virtual void removeChild(SchemaItem *child);
46 virtual void insertChild(int row, SchemaItem *child);
48 virtual SchemaItem *child(int row);
49 virtual int childCount() const;
50 virtual int columnCount() const;
51 virtual QVariant data(int column, int role) const;
52 virtual Qt::ItemFlags flags(const QModelIndex &index);
53 virtual int row() const;
54 virtual SchemaItem *parent();
55 virtual Subject* getSubject();
56 virtual void update(GuiEvent event, int type, Subject* son);
57 virtual void select(bool isSelected);
58 virtual void toggleState();
59 QModelIndex modelIndex(int column = 0);
60 virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
61 virtual ItemMimeData* mimeData(ItemMimeData *mime);
62 virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action);
63 virtual void reparent(SchemaItem *parent);
64 virtual void setCaseValue();
66 bool isEmphasized() {return _emphasized; };
67 void setEmphasize(bool emphasize) {_emphasized = emphasize; };
70 virtual QVariant editionToolTip(int column) const;
71 virtual QVariant runToolTip(int column) const;
72 virtual QVariant editionWhatsThis(int column) const;
73 virtual QVariant runWhatsThis(int column) const;
74 virtual QString getMimeFormat();
75 virtual void setExecState(int execState);
76 QList<SchemaItem*> _childItems;
77 QList<QVariant> _itemData;
78 QList<QVariant> _itemDeco;
79 QList<QVariant> _itemForeground;
80 QList<QVariant> _itemBackground;
81 QList<QVariant> _itemCheckState;
82 QList<QVariant> _itemToolTip;
83 QList<QVariant> _itemWhatsThis;
85 SchemaItem *_parentItem;
92 // class SchemaSelectionModel: public QItemSelectionModel
95 // SchemaSelectionModel(QAbstractItemModel *model);
96 // SchemaSelectionModel(QAbstractItemModel *model, QObject *parent);
97 // virtual ~SchemaSelectionModel();