Salome HOME
Image positioning by two points.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ObjSelector.cxx
index 3b7e1e5939c0787fdcaeaf12d2e8647b84d7f221..19ddb76ec31d5b748bccaf6063817fc9a7315983 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 );
@@ -95,11 +99,17 @@ void HYDROGUI_ObjSelector::OnSelectionChanged()
     return;
 
   QString anObjName;
-  Handle(HYDROData_Object) anObject = HYDROGUI_Tool::GetSelectedObject( myModule );
+  Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::GetSelectedObject( myModule );
   if( !anObject.IsNull() )
-    anObjName = anObject->GetName();
+    if( myObjectKind == KIND_UNKNOWN || myObjectKind == anObject->GetKind() )
+      anObjName = anObject->GetName();
 
-  myObjName->setText( anObjName );
+  SetName( anObjName );
+}
+
+void HYDROGUI_ObjSelector::SetName( const QString& theName )
+{
+  myObjName->setText( theName );
 }
 
 QString HYDROGUI_ObjSelector::GetName() const
@@ -112,3 +122,8 @@ void HYDROGUI_ObjSelector::Clear()
   myObjName->clear();
   myBtn->setChecked( false );
 }
+
+void HYDROGUI_ObjSelector::SetChecked( const bool theState )
+{
+  myBtn->setChecked( theState );
+}