1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA 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.
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/
19 #ifndef SUIT_DATAOBJECT_H
20 #define SUIT_DATAOBJECT_H
29 class SUIT_DataObject;
30 class SUIT_DataObjectKey;
32 typedef QPtrList<SUIT_DataObject> DataObjectList;
33 typedef QPtrListIterator<SUIT_DataObject> DataObjectListIterator;
36 #pragma warning( disable:4251 )
40 Class provide support data object.
42 class SUIT_EXPORT SUIT_DataObject
47 typedef enum { None, RadioButton, CheckBox } CheckType;
48 typedef enum { Text, Base, Foreground, Background, Highlight, HighlightedText } ColorRole;
50 SUIT_DataObject( SUIT_DataObject* = 0 );
51 virtual ~SUIT_DataObject();
53 SUIT_DataObject* root() const;
54 SUIT_DataObject* lastChild() const;
55 SUIT_DataObject* firstChild() const;
57 int childCount() const;
58 int childPos( const SUIT_DataObject* ) const;
59 SUIT_DataObject* childObject( const int ) const;
62 SUIT_DataObject* nextBrother() const;
63 SUIT_DataObject* prevBrother() const;
65 bool autoDeleteChildren() const;
66 virtual void setAutoDeleteChildren( const bool );
68 virtual void children( DataObjectList&, const bool = false ) const;
69 virtual DataObjectList children( const bool = false );
71 void appendChild( SUIT_DataObject* );
72 virtual void removeChild( SUIT_DataObject* );
73 virtual void insertChild( SUIT_DataObject*, int thePosition );
74 bool replaceChild( SUIT_DataObject*, SUIT_DataObject*, const bool = false );
76 void reparentChildren( const SUIT_DataObject* );
78 virtual QString text( const int ) const;
79 virtual QColor color( const ColorRole ) const;
81 virtual QString name() const;
82 virtual QPixmap icon() const;
83 virtual QString toolTip() const;
85 virtual SUIT_DataObject* parent() const;
86 virtual void setParent( SUIT_DataObject* );
88 virtual bool isDragable() const;
89 virtual bool isDropAccepted( SUIT_DataObject* obj );
91 virtual CheckType checkType() const;
93 virtual bool isOn() const;
94 virtual void setOn( const bool );
96 virtual bool isOpen() const;
97 virtual void setOpen( const bool );
99 virtual SUIT_DataObjectKey* key() const;
101 bool connect( QObject*, const char* );
102 bool disconnect( QObject*, const char* );
106 void dump( const int indent = 2 ) const; // dump to cout
112 SUIT_DataObject* myParent;
113 DataObjectList myChildren;
115 friend class SUIT_DataObject::Signal;
116 friend class SUIT_DataObjectIterator;
119 class SUIT_DataObject::Signal : public QObject
124 Signal( SUIT_DataObject* );
128 void setOwner( SUIT_DataObject* o );
131 void destroyed( SUIT_DataObject* );
134 SUIT_DataObject* myOwner;
138 #pragma warning( default:4251 )