Salome HOME
Add tutorial help page.
[modules/shaper.git] / src / XGUI / XGUI_PropertyPanel.cpp
index 33288b465827441990ea5b4fd9c9e87c22c753cc..3ce0ed1713e41f3b2a26160b78c0b9e764042641 100755 (executable)
@@ -36,6 +36,7 @@
 #include <ModuleBase_WidgetFactory.h>
 #include <ModuleBase_OperationDescription.h>
 #include <ModuleBase_Events.h>
+#include <ModuleBase_IModule.h>
 #include <ModuleBase_IWorkshop.h>
 
 #include <Events_Loop.h>
@@ -66,6 +67,7 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* th
     : ModuleBase_IPropertyPanel(theParent),
     myActiveWidget(NULL),
     myPreselectionWidget(NULL),
+    myInternalActiveWidget(NULL),
     myPanelPage(NULL),
     myOperationMgr(theMgr)
 {
@@ -230,6 +232,14 @@ void XGUI_PropertyPanel::createContentPanel(FeaturePtr theFeature)
     findButton(PROP_PANEL_OK_PLUS)->setVisible(aFeatureInfo->isApplyContinue());
 }
 
+ModuleBase_ModelWidget* XGUI_PropertyPanel::activeWidget(const bool isUseCustomWidget) const
+{
+  if (isUseCustomWidget && myInternalActiveWidget)
+    return myInternalActiveWidget;
+
+  return myActiveWidget;
+}
+
 void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget)
 {
   // it is possible that the property panel widgets have not been visualized
@@ -392,8 +402,8 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext)
 #endif
   ModuleBase_ModelWidget* aFocusMWidget = ModuleBase_ModelWidget::findModelWidget(this,
                                                                          aFocusWidget);
-  if (aFocusMWidget)
-    aFocusMWidget->setHighlighted(false);
+  //if (aFocusMWidget)
+  //  aFocusMWidget->setHighlighted(false);
 
   QWidget* aNewFocusWidget = 0;
   if (aFocusWidget) {
@@ -449,9 +459,13 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext)
 
     ModuleBase_ModelWidget* aNewFocusMWidget = ModuleBase_ModelWidget::findModelWidget(this,
                                                                               aNewFocusWidget);
-    if (aNewFocusMWidget)
+    if (aNewFocusMWidget) {
+      if (aFocusMWidget) {
+        aFocusMWidget->setHighlighted(false);
+      }
       aNewFocusMWidget->emitFocusInWidget();
-    isChangedFocus = true;
+      isChangedFocus = true;
+    }
   }
   return isChangedFocus;
 }
@@ -574,6 +588,25 @@ void XGUI_PropertyPanel::onAcceptData()
   }
 }
 
+void XGUI_PropertyPanel::setInternalActiveWidget(ModuleBase_ModelWidget* theWidget)
+{
+  if (theWidget)
+  {
+    myInternalActiveWidget = theWidget;
+    emit propertyPanelActivated();
+  }
+  else
+  {
+    if (myInternalActiveWidget)
+    {
+      delete myInternalActiveWidget;
+      myInternalActiveWidget = 0;
+    }
+    emit propertyPanelDeactivated();
+  }
+  myOperationMgr->workshop()->selectionActivate()->updateSelectionModes();
+  myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters();
+}
 
 ModuleBase_ModelWidget* XGUI_PropertyPanel::preselectionWidget() const
 {