1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_WidgetPoint2D.cpp
4 // Created: 25 Apr 2014
5 // Author: Natalia ERMOLAEVA
7 #include "PartSet_WidgetPoint2DFlyout.h"
9 #include "ModuleBase_WidgetValidator.h"
10 #include "ModuleBase_ViewerPrs.h"
12 #include <XGUI_Workshop.h>
13 #include <XGUI_ModuleConnector.h>
14 #include <XGUI_Displayer.h>
16 #include <Config_WidgetAPI.h>
17 #include <Config_Keywords.h>
22 PartSet_WidgetPoint2DFlyout::PartSet_WidgetPoint2DFlyout(QWidget* theParent,
23 ModuleBase_IWorkshop* theWorkshop,
24 const Config_WidgetAPI* theData)
25 : PartSet_WidgetPoint2D(theParent, theWorkshop, theData)
27 myWidgetValidator = new ModuleBase_WidgetValidator(this, myWorkshop);
30 bool PartSet_WidgetPoint2DFlyout::setSelection(QList<ModuleBase_ViewerPrsPtr>& theValues,
31 const bool theToValidate)
33 PartSet_WidgetPoint2D::setSelection(theValues, theToValidate);
34 // true value should be returned to set this control as processed the selection
35 // to move focus to the next control if it is filled by preselection
39 bool PartSet_WidgetPoint2DFlyout::isValidSelectionCustom(
40 const std::shared_ptr<ModuleBase_ViewerPrs>& theValue)
45 bool PartSet_WidgetPoint2DFlyout::useSelectedShapes() const
50 bool PartSet_WidgetPoint2DFlyout::focusTo()
52 bool aCanAcceptFocus = true;
53 if (isInternal() && isComputedDefault()) {
54 AISObjectPtr anObject = workshop()->displayer()->getAISObject(feature());
55 aCanAcceptFocus = anObject.get() && !anObject->isEmptyDistanceGeometry();
58 aCanAcceptFocus = PartSet_WidgetPoint2D::focusTo();
59 return aCanAcceptFocus;
62 XGUI_Workshop* PartSet_WidgetPoint2DFlyout::workshop() const
64 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
65 return aConnector->workshop();