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 #include "HYDROGUI_DataObject.h"
25 #include <HYDROData_Image.h>
27 #include <SUIT_DataObject.h>
29 #include <TDF_Tool.hxx>
31 HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent,
32 Handle(HYDROData_Object) theData,
33 const QString& theParentEntry )
34 : CAM_DataObject( theParent ),
35 LightApp_DataObject( theParent ),
37 myParentEntry( theParentEntry )
41 QString HYDROGUI_DataObject::entry() const
43 QString anEntry = HYDROGUI_DataObject::dataObjectEntry( modelObject() );
45 anEntry.prepend( myParentEntry + "_" );
49 QString HYDROGUI_DataObject::refEntry() const
51 if( !myParentEntry.isEmpty() )
52 return HYDROGUI_DataObject::dataObjectEntry( modelObject() );
56 QString HYDROGUI_DataObject::name() const
58 if( !myData.IsNull() )
59 return myData->GetName();
63 QFont HYDROGUI_DataObject::font( const int theId ) const
65 QFont aFont = LightApp_DataObject::font( theId );
68 Handle(HYDROData_Image) anImage = Handle(HYDROData_Image)::DownCast( modelObject() );
69 if( !anImage.IsNull() && anImage->MustBeUpdated() )
70 aFont.setItalic( true );
75 QString HYDROGUI_DataObject::dataObjectEntry( const Handle(HYDROData_Object)& theObject )
77 QString aEntryStr = QString::null;
78 if( !theObject.IsNull() )
80 TCollection_AsciiString aLabEntr;
81 TDF_Tool::Entry( theObject->Label(), aLabEntr );
82 aEntryStr = HYDROGUI_DataObject::entryPrefix() + QString( aLabEntr.ToCString() );
87 HYDROGUI_NamedObject::HYDROGUI_NamedObject( SUIT_DataObject* theParent,
88 const QString& theName,
89 const QString& theParentEntry )
90 : CAM_DataObject( theParent ),
91 LightApp_DataObject( theParent ),
93 myParentEntry( theParentEntry )
97 QString HYDROGUI_NamedObject::entry() const
99 QString anEntry = HYDROGUI_DataObject::entryPrefix() + name();
100 if( !myParentEntry.isEmpty() )
101 anEntry.prepend( myParentEntry + "_" );
105 QString HYDROGUI_NamedObject::name() const