1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROGUI_DATAOBJECT_H
24 #define HYDROGUI_DATAOBJECT_H
26 #include <HYDROData_Entity.h>
28 #include <LightApp_DataObject.h>
36 * \class HYDROGUI_DataObject
37 * \brief Module data object, used for object browser tree creation.
39 * This is an Object Browser object that contains reference to data structure
41 * This class inherits CAM_DataObject virtually, so it is necessary to call in the class
42 * constructor the CAM object constructor manually for the correct initialization
44 class HYDROGUI_DataObject : public LightApp_DataObject
49 RefObjectId = RefEntryId + 1, //!< Ref.Object column
50 BathymetryId //!< Bathymetry column
55 * \param theParent parent data object
56 * \param theData reference to the corresponding object from data structure
57 * \param theParentEntry entry of the parent data object (for reference objects)
59 HYDROGUI_DataObject( SUIT_DataObject* theParent,
60 Handle(HYDROData_Entity) theData,
61 const QString& theParentEntry );
64 * Returns the unique object identifier string.
66 virtual QString entry() const;
69 * Returns the entry of the referenced object.
71 virtual QString refEntry() const;
74 * Returns the name of object.
76 virtual QString name() const;
79 * Returns the font of displayed object name.
81 virtual QFont font( const int = SUIT_DataObject::NameId ) const;
84 * Returns the object color.
86 virtual QColor color( const ColorRole, const int = NameId ) const;
89 * Returns the model data object.
91 const Handle(HYDROData_Entity)& modelObject() const { return myData; }
94 * Redefines the object.
96 void setObject( const Handle(HYDROData_Entity)& theObject ) { myData = theObject; }
99 * Returns the entry prefix for all HYDRO data objects.
101 static QString entryPrefix() { return QString( "HYDRO:" ); }
104 * Returns the full entry for the specified data object.
106 static QString dataObjectEntry( const Handle(HYDROData_Entity)& theObject,
107 const bool theWithPrefix = true );
109 * Sets the validity flag: if object is valid or not.
110 * \param theIsValid is true for valid objects, false for invalid
112 void setIsValid( const bool theIsValid );
115 * Returns the validity flag: is object valid or not
116 * \returns false if object is not valid
118 bool isValid() const;
121 Handle(HYDROData_Entity) myData; ///< object from data model
122 QString myParentEntry;
123 bool myIsValid; ///< indicates if the object is valid
127 * \class HYDROGUI_NamedObject
128 * \brief Module data object, used for object browser tree creation.
130 * It contains only name inside, without additional data: it is just information
131 * or grouping object in the Object Browser.
132 * This class inherits CAM_DataObject virtually, so it is necessary to call in the class
133 * constructor the CAM object constructor manually for the correct initialization
135 class HYDROGUI_NamedObject : public virtual LightApp_DataObject
140 * \param theParent parent data object
141 * \param theName displayed name
143 HYDROGUI_NamedObject( SUIT_DataObject* theParent,
144 const QString& theName,
145 const QString& theParentEntry );
148 * Returns the unique object identifier string.
150 virtual QString entry() const;
153 * Returns the name of object.
155 virtual QString name() const;
158 QString myName; ///< name in the OB
159 QString myParentEntry;
163 * \brief Module data object, used for dropping items in the object browser.
165 * It inherits NamedObject with only difference - it accepts dropping.
167 class HYDROGUI_DropTargetObject : public HYDROGUI_NamedObject
172 * \param theParent parent data object
173 * \param theName displayed name
175 HYDROGUI_DropTargetObject( SUIT_DataObject* theParent,
176 const QString& theName,
177 const QString& theParentEntry );
179 bool isDropAccepted() const { return true; }