//
#include "HYDROGUI_PolylineDlg.h"
+
+#include "HYDROGUI_Module.h"
#include <CurveCreator_Widget.h>
-#include <CurveCreator_Curve.hxx>
+#include <CurveCreator_ICurve.hxx>
+
+#include <OCCViewer_ViewModel.h>
+#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
addLayout(aNameLayout);
- myEditorWidget =
- new CurveCreator_Widget( this, NULL);
+ myEditorWidget = new CurveCreator_Widget( this, NULL );
+ addWidget( myEditorWidget, 3 );
+
+ myAddElementBox = new QGroupBox( tr( "ADD_ELEMENT" ), this );
+ addWidget( myAddElementBox, 2 );
- addWidget( myEditorWidget );
+ QBoxLayout* anAddElementLayout = new QVBoxLayout( myAddElementBox );
+ anAddElementLayout->setMargin( 0 );
+ anAddElementLayout->setSpacing( 5 );
connect( myEditorWidget, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
+ connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*) ), this, SLOT( processStartedSubOperation(QWidget*) ) );
+ connect( myEditorWidget, SIGNAL( subOperationFinished(QWidget*) ), this, SLOT( processFinishedSubOperation(QWidget*) ) );
+
+ myAddElementBox->hide();
}
HYDROGUI_PolylineDlg::~HYDROGUI_PolylineDlg()
{
}
+void HYDROGUI_PolylineDlg::setOCCViewer( OCCViewer_Viewer* theViewer )
+{
+ myEditorWidget->setOCCViewer( theViewer );
+}
+
+void HYDROGUI_PolylineDlg::processStartedSubOperation( QWidget* theWidget )
+{
+ myEditorWidget->setEnabled( false );
+
+ QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( myAddElementBox->layout() );
+ anAddElementLayout->addWidget( theWidget );
+
+ theWidget->show();
+ myAddElementBox->show();
+}
+
+void HYDROGUI_PolylineDlg::processFinishedSubOperation( QWidget* theWidget )
+{
+ myEditorWidget->setEnabled( true );
+
+ QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( myAddElementBox->layout() );
+ anAddElementLayout->removeWidget( theWidget );
+
+ theWidget->hide();
+ myAddElementBox->hide();
+}
+
void HYDROGUI_PolylineDlg::reset()
{
}
return myName->text();
}
-void HYDROGUI_PolylineDlg::setCurve( CurveCreator_Curve* theCurve )
+void HYDROGUI_PolylineDlg::setCurve( CurveCreator_ICurve* theCurve )
{
myEditorWidget->setCurve( theCurve );
}
{
return myEditorWidget->getSelectedPoints();
}
+
+/**
+ * Redirect the delete action to editor widget
+ */
+void HYDROGUI_PolylineDlg::deleteSelected()
+{
+ myEditorWidget->removeSelected();
+}
+
+/**
+ * Checks whether there are some to delete
+ */
+bool HYDROGUI_PolylineDlg::deleteEnabled()
+{
+ return myEditorWidget->removeEnabled();
+}