Salome HOME
Feature 32: Image presentation in OCCViewer.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ObjSelector.cxx
index 04bd20f0c0c4d67f5386a436cfe388b0278763d3..a79c1f6b2d1cea3102cc98d318992090a2396f54 100644 (file)
 #include <QLineEdit>
 #include <QToolButton>
 
-HYDROGUI_ObjSelector::HYDROGUI_ObjSelector( HYDROGUI_Module* theModule, QWidget* theParent )
-: QAbstractButton( theParent ), myModule( theModule )
+HYDROGUI_ObjSelector::HYDROGUI_ObjSelector( HYDROGUI_Module* theModule,
+                                            const ObjectKind theObjectKind,
+                                            QWidget* theParent )
+: QAbstractButton( theParent ),
+  myObjectKind( theObjectKind ),
+  myModule( theModule )
 {
   QHBoxLayout* aLayout = new QHBoxLayout( this );
   aLayout->setMargin( 0 );
@@ -97,7 +101,8 @@ void HYDROGUI_ObjSelector::OnSelectionChanged()
   QString anObjName;
   Handle(HYDROData_Object) anObject = HYDROGUI_Tool::GetSelectedObject( myModule );
   if( !anObject.IsNull() )
-    anObjName = anObject->GetName();
+    if( myObjectKind == KIND_UNKNOWN || myObjectKind == anObject->GetKind() )
+      anObjName = anObject->GetName();
 
   SetName( anObjName );
 }
@@ -117,3 +122,8 @@ void HYDROGUI_ObjSelector::Clear()
   myObjName->clear();
   myBtn->setChecked( false );
 }
+
+void HYDROGUI_ObjSelector::SetChecked( const bool theState )
+{
+  myBtn->setChecked( theState );
+}