ModuleBase_ViewerFilters.h
ModuleBase_ViewerPrs.h
ModuleBase_WidgetBoolValue.h
+ ModuleBase_WidgetCheckGroupBox.h
ModuleBase_WidgetChoice.h
ModuleBase_WidgetCreatorFactory.h
ModuleBase_WidgetDoubleValue.h
ModuleBase_ViewerFilters.cpp
ModuleBase_ViewerPrs.cpp
ModuleBase_WidgetBoolValue.cpp
+ ModuleBase_WidgetCheckGroupBox.cpp
ModuleBase_WidgetChoice.cpp
ModuleBase_WidgetCreatorFactory.cpp
ModuleBase_WidgetDoubleValue.cpp
class ModuleBase_ModelWidget;
class ModuleBase_PageBase;
+class ModuleBase_IWorkshop;
+
+class Config_WidgetAPI;
class QWidget;
/// \param theType a type
/// \param theParent a parent widget
virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
- QWidget* theParent) = 0;
+ QWidget* theParent,
+ Config_WidgetAPI* theWidgetApi,
+ std::string theParentId) = 0;
/// Create widget by its type
/// \param theType a type
/// \param theParent a parent widget
virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
- QWidget* theParent = NULL) = 0;
+ QWidget* theParent,
+ Config_WidgetAPI* theWidgetApi,
+ std::string theParentId,
+ ModuleBase_IWorkshop* theWorkshop) = 0;
};
typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;
#include <Events_Loop.h>
#include <QEvent>
-#include <QGraphicsDropShadowEffect>
-#include <QColor>
#include <QLabel>
#include <QFocusEvent>
QLabel* aLabel = qobject_cast<QLabel*>(aWidget);
// We won't set the effect to QLabels - it looks ugly
if(aLabel) continue;
- if(isHighlighted) {
- // If effect is the installed on a different widget, setGraphicsEffect() will
- // remove the effect from the widget and install it on this widget.
- // That's why we create a new effect for each widget
- QGraphicsDropShadowEffect* aGlowEffect = new QGraphicsDropShadowEffect();
- aGlowEffect->setOffset(.0);
- aGlowEffect->setBlurRadius(10.0);
- aGlowEffect->setColor(QColor(0, 170, 255)); // Light-blue color, #00AAFF
- aWidget->setGraphicsEffect(aGlowEffect);
- } else {
- QGraphicsEffect* anEffect = aWidget->graphicsEffect();
- if(anEffect)
- anEffect->deleteLater();
- aWidget->setGraphicsEffect(NULL);
- }
+ // If effect is the installed on a different widget, setGraphicsEffect() will
+ // remove the effect from the widget and install it on this widget.
+ // That's why we create a new effect for each widget
+ ModuleBase_Tools::setShadowEffect(aWidget, isHighlighted);
}
}
#include <QPainter>
#include <QBitmap>
#include <QDoubleSpinBox>
+#include <QGraphicsDropShadowEffect>
+#include <QColor>
#include <sstream>
#endif
}
+void setShadowEffect(QWidget* theWidget, const bool isSetEffect)
+{
+ if (isSetEffect) {
+ QGraphicsDropShadowEffect* aGlowEffect = new QGraphicsDropShadowEffect();
+ aGlowEffect->setOffset(.0);
+ aGlowEffect->setBlurRadius(10.0);
+ aGlowEffect->setColor(QColor(0, 170, 255)); // Light-blue color, #00AAFF
+ theWidget->setGraphicsEffect(aGlowEffect);
+ }
+ else {
+ QGraphicsEffect* anEffect = theWidget->graphicsEffect();
+ if(anEffect)
+ anEffect->deleteLater();
+ theWidget->setGraphicsEffect(NULL);
+ }
+}
+
QPixmap composite(const QString& theAdditionalIcon, const QString& theIcon)
{
QImage anIcon(theIcon);
*/
MODULEBASE_EXPORT void setFocus(QWidget* theWidget, const QString& theInfo = QString());
+
+//! Sets or removes the shadow effect to the widget
+//! \param theWidget a widget to be styled
+//! \param isSetEffect if true, the shadow effect is set, overwise cleared
+//! \return resulting pixmap
+MODULEBASE_EXPORT void setShadowEffect(QWidget* theWidget, const bool isSetEffect);
+
/**
* \ingroup GUI
* Methods to modify a resource pixmap
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: ModuleBase_WidgetCheckGroupBox.cpp
+// Created: 13 Dec 2015
+// Author: Natalia ERMOLAEVA
+
+#include <ModuleBase_WidgetCheckGroupBox.h>
+#include <ModelAPI_AttributeBoolean.h>
+
+#include <Config_WidgetAPI.h>
+#include <Config_Keywords.h>
+
+#include <QWidget>
+#include <QGroupBox>
+#include <QGridLayout>
+#include <QVBoxLayout>
+
+#include <QList>
+
+ModuleBase_WidgetCheckGroupBox::ModuleBase_WidgetCheckGroupBox(QWidget* theParent,
+ const Config_WidgetAPI* theData,
+ const std::string& theParentId)
+: ModuleBase_ModelWidget(theParent, theData, theParentId),
+ ModuleBase_PageBase()
+{
+ QString aToolTip = QString::fromStdString(theData->widgetTooltip());
+ bool isChecked = theData->getBooleanAttribute(ATTR_DEFAULT, false);
+
+ QVBoxLayout* aMainLayout = new QVBoxLayout(this);
+ ModuleBase_Tools::zeroMargins(aMainLayout);
+ myGroupBox = new QGroupBox(this);
+ myGroupBox->setCheckable(true);
+ myGroupBox->setToolTip(aToolTip);
+ myGroupBox->setChecked(isChecked);
+
+ myMainLayout = new QGridLayout(myGroupBox);
+ ModuleBase_Tools::adjustMargins(myMainLayout);
+ myGroupBox->setLayout(myMainLayout);
+
+ // default vertical size policy is preferred
+ aMainLayout->addWidget(myGroupBox);
+ connect(myGroupBox, SIGNAL(clicked(bool)), this, SLOT(onPageClicked()));
+}
+
+ModuleBase_WidgetCheckGroupBox::~ModuleBase_WidgetCheckGroupBox()
+{
+}
+
+void ModuleBase_WidgetCheckGroupBox::setTitle(const QString& theTitle)
+{
+ myGroupBox->setTitle(theTitle);
+}
+
+QWidget* ModuleBase_WidgetCheckGroupBox::pageWidget()
+{
+ return myGroupBox;
+}
+
+QList<QWidget*> ModuleBase_WidgetCheckGroupBox::getControls() const
+{
+ QList<QWidget*> aControls;
+ aControls.append(myGroupBox);
+
+ return aControls;
+}
+
+void ModuleBase_WidgetCheckGroupBox::onPageClicked()
+{
+ storeValue();
+}
+
+void ModuleBase_WidgetCheckGroupBox::addPageStretch()
+{
+}
+
+void ModuleBase_WidgetCheckGroupBox::placeModelWidget(ModuleBase_ModelWidget* theWidget)
+{
+ const int kCol = 0;
+ const int kRow = myMainLayout->count();
+ // it seems, that the align on left is not necessary here, but leads to widgets, which are
+ // not extended on full width of the parent page. The case is grouped widgets in
+ // the sketch translation operation
+ myMainLayout->addWidget(theWidget, kRow, kCol, Qt::AlignTop);// | Qt::AlignLeft);
+ myMainLayout->setRowStretch(kRow, 0);
+
+}
+
+void ModuleBase_WidgetCheckGroupBox::placePageWidget(ModuleBase_PageBase* theWidget)
+{
+ QWidget* aWidget = dynamic_cast<QWidget*>(theWidget);
+ if (!aWidget) {
+#ifdef _DEBUG
+ std::cout << "ModuleBase_PageGroupBox::placePageWidget: can not cast page" << std::endl;
+#endif
+ return;
+ }
+ const int kCol = 0;
+ const int kRow = myMainLayout->count();
+ myMainLayout->addWidget(aWidget, kRow, kCol);
+ myMainLayout->setRowStretch(kRow, 0);
+}
+
+QLayout* ModuleBase_WidgetCheckGroupBox::pageLayout()
+{
+ return myMainLayout;
+}
+
+bool ModuleBase_WidgetCheckGroupBox::storeValueCustom() const
+{
+ DataPtr aData = myFeature->data();
+ std::shared_ptr<ModelAPI_AttributeBoolean> aBool = aData->boolean(attributeID());
+ aBool->setValue(myGroupBox->isChecked());
+ updateObject(myFeature);
+
+ return true;
+}
+
+bool ModuleBase_WidgetCheckGroupBox::restoreValueCustom()
+{
+ DataPtr aData = myFeature->data();
+ std::shared_ptr<ModelAPI_AttributeBoolean> aRef = aData->boolean(attributeID());
+
+ bool isBlocked = myGroupBox->blockSignals(true);
+ myGroupBox->setChecked(aRef->value());
+ myGroupBox->blockSignals(isBlocked);
+
+ return true;
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: ModuleBase_WidgetCheckGroupBox.h
+// Created: 13 Dec 2015
+// Author: Natalia ERMOLAEVA
+
+#ifndef ModuleBase_WidgetCheckGroupBox_H_
+#define ModuleBase_WidgetCheckGroupBox_H_
+
+#include <ModuleBase.h>
+#include <ModuleBase_PageBase.h>
+#include <ModuleBase_ModelWidget.h>
+
+class QGroupBox;
+class QGridLayout;
+
+/**
+* \ingroup GUI
+* Implements a model widget for switch as a container widget. It can be defined in XML with "toolbox" keyword
+*/
+class MODULEBASE_EXPORT ModuleBase_WidgetCheckGroupBox : public ModuleBase_ModelWidget,
+ public ModuleBase_PageBase
+{
+ Q_OBJECT
+public:
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theData the widget configuration. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
+ ModuleBase_WidgetCheckGroupBox(QWidget* theParent, const Config_WidgetAPI* theData,
+ const std::string& theParentId);
+ virtual ~ModuleBase_WidgetCheckGroupBox();
+
+ void setTitle(const QString& theTitle);
+
+ /// Methods to be redefined from ModuleBase_PageBase: start
+ /// Cast the page to regular QWidget
+ virtual QWidget* pageWidget();
+ /// Methods to be redefined from ModuleBase_PageBase: end
+
+ /// Methods to be redefined from ModuleBase_ModelWidget: start
+ /// Returns list of widget controls
+ /// \return a control list
+ virtual QList<QWidget*> getControls() const;
+ /// Methods to be redefined from ModuleBase_ModelWidget: end
+
+protected slots:
+ // store value to the model
+ void onPageClicked();
+
+protected:
+ /// Methods to be redefined from ModuleBase_PageBase: start
+ /// Adds the given widget to page's layout
+ virtual void placeModelWidget(ModuleBase_ModelWidget* theWidget);
+ /// Adds the given page to page's layout
+ virtual void placePageWidget(ModuleBase_PageBase* theWidget);
+ /// Returns page's layout (QGridLayout)
+ virtual QLayout* pageLayout();
+ /// Adds a stretch to page's layout
+ virtual void addPageStretch();
+ /// Methods to be redefined from ModuleBase_PageBase: end
+
+
+ /// Methods to be redefined from ModuleBase_ModelWidget: start
+ /// Saves the internal parameters to the given feature
+ /// \return True in success
+ virtual bool storeValueCustom() const;
+ /// Restore value from attribute data to the widget's control
+ virtual bool restoreValueCustom();
+ /// Methods to be redefined from ModuleBase_ModelWidget: end
+
+private:
+ QGroupBox* myGroupBox;
+ QGridLayout* myMainLayout; ///< page's layout
+};
+
+#endif /* ModuleBase_WidgetCheckGroupBox_H_ */
#include <ModuleBase_WidgetCreatorFactory.h>
#include <ModuleBase_IWidgetCreator.h>
+#include <Config_WidgetAPI.h>
+
#include <Events_Error.h>
#include <QStringList>
}
ModuleBase_PageBase* ModuleBase_WidgetCreatorFactory::createPageByType(
- const std::string& theType, QWidget* theParent)
+ const std::string& theType, QWidget* theParent,
+ Config_WidgetAPI* theWidgetApi, std::string theParentId)
{
ModuleBase_PageBase* aPage = 0;
if (myPageToCreator.contains(theType)) {
WidgetCreatorPtr aCreator = myPageToCreator[theType];
- aPage = aCreator->createPageByType(theType, theParent);
+ aPage = aCreator->createPageByType(theType, theParent, theWidgetApi, theParentId);
}
return aPage;
ModuleBase_ModelWidget* ModuleBase_WidgetCreatorFactory::createWidgetByType(
- const std::string& theType, QWidget* theParent)
+ const std::string& theType, QWidget* theParent,
+ Config_WidgetAPI* theWidgetApi, std::string theParentId,
+ ModuleBase_IWorkshop* theWorkshop)
{
ModuleBase_ModelWidget* aWidget = 0;
if (myCreators.contains(theType)) {
WidgetCreatorPtr aCreator = myCreators[theType];
- aWidget = aCreator->createWidgetByType(theType, theParent);
+ aWidget = aCreator->createWidgetByType(theType, theParent, theWidgetApi, theParentId,
+ theWorkshop);
}
return aWidget;
class ModuleBase_ModelWidget;
class ModuleBase_PageBase;
+class ModuleBase_IWorkshop;
class QWidget;
/// \param theType a type
/// \param theParent a parent widget
ModuleBase_PageBase* createPageByType(const std::string& theType,
- QWidget* theParent = NULL);
+ QWidget* theParent,
+ Config_WidgetAPI* theWidgetApi,
+ std::string theParentId);
/// Create widget by its type
/// \param theType a type
/// \param theParent a parent widget
ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
- QWidget* theParent = NULL);
+ QWidget* theParent,
+ Config_WidgetAPI* theWidgetApi,
+ std::string theParentId,
+ ModuleBase_IWorkshop* theWorkshop);
private:
/// Constructor is hidden
#include <ModuleBase_WidgetToolbox.h>
#include <ModuleBase_PageBase.h>
#include <ModuleBase_PageGroupBox.h>
+#include <ModuleBase_WidgetCheckGroupBox.h>
#include <ModuleBase_PageWidget.h>
#include <ModuleBase_WidgetExprEditor.h>
#include <ModuleBase_WidgetCreatorFactory.h>
aPage->setTitle(aGroupName);
aResult = aPage;
}
-
+ else if (theType == WDG_CHECK_GROUP) {
+ QString aGroupName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME));
+ ModuleBase_WidgetCheckGroupBox* aPage = new ModuleBase_WidgetCheckGroupBox(theParent,
+ myWidgetApi, myParentId);
+ aPage->setTitle(aGroupName);
+ aResult = aPage;
+ }
if (!aResult)
- aResult = ModuleBase_WidgetCreatorFactory::get()->createPageByType(theType, theParent);
+ aResult = ModuleBase_WidgetCreatorFactory::get()->createPageByType(theType, theParent,
+ myWidgetApi, myParentId);
+
+ ModuleBase_ModelWidget* aWidget = dynamic_cast<ModuleBase_ModelWidget*>(aResult);
+ if (aWidget)
+ myModelWidgets.append(aWidget);
return aResult;
}
} else {
result = myWorkshop->module()->createWidgetByType(theType, theParent, myWidgetApi, myParentId);
if (!result)
- result = ModuleBase_WidgetCreatorFactory::get()->createWidgetByType(theType, theParent);
+ result = ModuleBase_WidgetCreatorFactory::get()->createWidgetByType(theType, theParent,
+ myWidgetApi, myParentId, myWorkshop);
#ifdef _DEBUG
if (!result) {
qDebug("ModuleBase_WidgetFactory::fillWidget: find bad widget type %s", theType.c_str());
SketchShapePlugin_Plugin.h
SketchShapePlugin_Validators.h
SketchShapePlugin_Tools.h
+ SketchShapePlugin_WidgetCheckGroupBox.h
SketchShapePlugin_WidgetCreator.h
+ SketchShapePlugin_WidgetMultiSelector.h
)
SET(PROJECT_SOURCES
SketchShapePlugin_Plugin.cpp
SketchShapePlugin_Validators.cpp
SketchShapePlugin_Tools.cpp
+ SketchShapePlugin_WidgetCheckGroupBox.cpp
SketchShapePlugin_WidgetCreator.cpp
+ SketchShapePlugin_WidgetMultiSelector.cpp
)
SET(PROJECT_LIBRARIES
SketchShapePlugin_PageGroupBox::SketchShapePlugin_PageGroupBox(QWidget* theParent)
: ModuleBase_PageGroupBox(theParent)
{
- setTitle("SketchShapePlugin_PageGroupBox");
+}
+
+void SketchShapePlugin_PageGroupBox::setHighlightedGroupBox(bool isHighlighted)
+{
+ ModuleBase_Tools::setShadowEffect(this, isHighlighted);
}
SketchShapePlugin_PageGroupBox(QWidget* theParent = 0);
/// Destructs the page
virtual ~SketchShapePlugin_PageGroupBox() {}
+
+ //! Switch On/Off highlighting of the widget
+ //! Set highlight to the parent group box if there is such parent
+ void setHighlightedGroupBox(bool isHighlighted);
};
#endif /* SKETCHSHAPEPLUGIN_PAGEGROUPBOX_H_ */
return FeaturePtr();
}
-/*ModuleBase_ModelWidget* SketchShapePlugin_Plugin::createWidgetByType(const std::string& theType,
- QWidget* theParent)
-{
- ModuleBase_ModelWidget* aWidget = 0;
- if (theType == "sketchshape_groupbox")
- aWidget = new SketchShapePlugin_PageGroupBox(theParent);
- return aWidget;
-}*/
-
/// Creates the feature object of this plugin by the feature string ID
virtual FeaturePtr createFeature(std::string theFeatureID);
- /// Create widget by its type
- /// \param theType a type
- /// \param theParent a parent widget
- //virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
- // QWidget* theParent = NULL);
public:
SketchShapePlugin_Plugin();
};
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchShapePlugin_PageGroupBox.h
+// Created: 13 Dec 2015
+// Author: Natalia ERMOLAEVA
+
+#include <SketchShapePlugin_WidgetCheckGroupBox.h>
+
+#include <SketchShapePlugin_PageGroupBox.h>
+
+SketchShapePlugin_WidgetCheckGroupBox::SketchShapePlugin_WidgetCheckGroupBox(QWidget* theParent,
+ const Config_WidgetAPI* theData,
+ const std::string& theParentId)
+ : ModuleBase_WidgetCheckGroupBox(theParent, theData, theParentId)
+{
+}
+
+void SketchShapePlugin_WidgetCheckGroupBox::setHighlighted(bool isHighlighted)
+{
+ SketchShapePlugin_PageGroupBox* aShapeGroupBox = 0;
+ QWidget* aParent = qobject_cast<QWidget*>(parent());
+ while (aParent) {
+ aShapeGroupBox = dynamic_cast<SketchShapePlugin_PageGroupBox*>(aParent);
+ if (aShapeGroupBox)
+ break;
+ aParent = qobject_cast<QWidget*>(aParent->parent());
+ }
+
+ if (aShapeGroupBox)
+ aShapeGroupBox->setHighlightedGroupBox(isHighlighted);
+}
+
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchShapePlugin_PageGroupBox.h
+// Created: 13 Dec 2015
+// Author: Natalia ERMOLAEVA
+
+#ifndef SKETCHSHAPEPLUGIN_WIDGET_CHECK_GROUP_BOX_H_
+#define SKETCHSHAPEPLUGIN_WIDGET_CHECK_GROUP_BOX_H_
+
+#include <ModuleBase_WidgetCheckGroupBox.h>
+
+class QWidget;
+
+/*!
+ * \ingroup GUI
+ * Represent a property panel's list of ModuleBase_ModelWidgets.
+ */
+class SketchShapePlugin_WidgetCheckGroupBox : public ModuleBase_WidgetCheckGroupBox
+{
+ //Q_OBJECT
+public:
+ /// Constructs a page that looks like a QGroupBox
+ SketchShapePlugin_WidgetCheckGroupBox(QWidget* theParent, const Config_WidgetAPI* theData,
+ const std::string& theParentId);
+ /// Destructs the page
+ virtual ~SketchShapePlugin_WidgetCheckGroupBox() {}
+
+ //! Switch On/Off highlighting of the widget
+ //! Set highlight to the parent group box if there is such parent
+ virtual void setHighlighted(bool isHighlighted);
+};
+
+#endif /* SKETCHSHAPEPLUGIN_WIDGET_CHECK_GROUP_BOX_H_ */
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
#include "SketchShapePlugin_WidgetCreator.h"
+
#include "SketchShapePlugin_PageGroupBox.h"
+#include "SketchShapePlugin_WidgetMultiSelector.h"
+#include "SketchShapePlugin_WidgetCheckGroupBox.h"
+
SketchShapePlugin_WidgetCreator::SketchShapePlugin_WidgetCreator()
: ModuleBase_IWidgetCreator()
{
myPages.insert("sketchshape_groupbox");
+ myPages.insert("sketchshape_check_groupbox");
+
+ myWidgets.insert("sketchshape_multi_selector");
}
const std::set<std::string>& SketchShapePlugin_WidgetCreator::pageTypes()
const std::set<std::string>& SketchShapePlugin_WidgetCreator::widgetTypes()
{
- return myTypes;
+ return myWidgets;
}
ModuleBase_PageBase* SketchShapePlugin_WidgetCreator::createPageByType(
- const std::string& theType, QWidget* theParent)
+ const std::string& theType, QWidget* theParent,
+ Config_WidgetAPI* theWidgetApi, std::string theParentId)
{
ModuleBase_PageBase* aPage = 0;
if (myPages.find(theType) == myPages.end())
if (theType == "sketchshape_groupbox") {
aPage = new SketchShapePlugin_PageGroupBox(theParent);
}
+ else if (theType == "sketchshape_check_groupbox") {
+ aPage = new SketchShapePlugin_WidgetCheckGroupBox(theParent, theWidgetApi, theParentId);
+ }
return aPage;
}
ModuleBase_ModelWidget* SketchShapePlugin_WidgetCreator::createWidgetByType(
- const std::string& theType, QWidget* theParent)
+ const std::string& theType, QWidget* theParent,
+ Config_WidgetAPI* theWidgetApi, std::string theParentId,
+ ModuleBase_IWorkshop* theWorkshop)
{
ModuleBase_ModelWidget* aWidget = 0;
- if (myTypes.find(theType) == myTypes.end())
+ if (myWidgets.find(theType) == myWidgets.end())
return aWidget;
- //if (theType == "sketchshape_groupbox") {
- // aWidget = new SketchShapePlugin_PageGroupBox(theParent);
- //}
+ if (theType == "sketchshape_multi_selector") {
+ aWidget = new SketchShapePlugin_WidgetMultiSelector(theParent, theWorkshop, theWidgetApi,
+ theParentId);
+ }
return aWidget;
}
#include <set>
class ModuleBase_ModelWidget;
+class ModuleBase_IWorkshop;
class QWidget;
/**
/// \param theType a type
/// \param theParent a parent widget
virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
- QWidget* theParent);
+ QWidget* theParent,
+ Config_WidgetAPI* theWidgetApi,
+ std::string theParentId);
/// Create widget by its type
/// \param theType a type
/// \param theParent a parent widget
virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
- QWidget* theParent = NULL);
+ QWidget* theParent,
+ Config_WidgetAPI* theWidgetApi,
+ std::string theParentId,
+ ModuleBase_IWorkshop* theWorkshop);
private:
std::set<std::string> myPages; /// types of pages
- std::set<std::string> myTypes; /// types of widgets
+ std::set<std::string> myWidgets; /// types of widgets
};
typedef std::shared_ptr<SketchShapePlugin_WidgetCreator> SketchShapePlguinWidgetCreatorPtr;
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchShapePlugin_PageGroupBox.h
+// Created: 13 Dec 2015
+// Author: Natalia ERMOLAEVA
+
+#include <SketchShapePlugin_WidgetMultiSelector.h>
+
+#include <SketchShapePlugin_PageGroupBox.h>
+
+#include <ModuleBase_IWorkshop.h>
+
+#include <Config_WidgetAPI.h>
+
+SketchShapePlugin_WidgetMultiSelector::SketchShapePlugin_WidgetMultiSelector(QWidget* theParent,
+ ModuleBase_IWorkshop* theWorkshop,
+ const Config_WidgetAPI* theData,
+ const std::string& theParentId)
+ : ModuleBase_WidgetMultiSelector(theParent, theWorkshop, theData, theParentId)
+{
+}
+
+void SketchShapePlugin_WidgetMultiSelector::setHighlighted(bool isHighlighted)
+{
+ SketchShapePlugin_PageGroupBox* aShapeGroupBox = 0;
+ QWidget* aParent = qobject_cast<QWidget*>(parent());
+ while (aParent) {
+ aShapeGroupBox = dynamic_cast<SketchShapePlugin_PageGroupBox*>(aParent);
+ if (aShapeGroupBox)
+ break;
+ aParent = qobject_cast<QWidget*>(aParent->parent());
+ }
+
+ if (aShapeGroupBox)
+ aShapeGroupBox->setHighlightedGroupBox(isHighlighted);
+}
+
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchShapePlugin_PageGroupBox.h
+// Created: 13 Dec 2015
+// Author: Natalia ERMOLAEVA
+
+#ifndef SKETCHSHAPEPLUGIN_WIDGET_MULTI_SELECTOR_H_
+#define SKETCHSHAPEPLUGIN_WIDGET_MULTI_SELECTOR_H_
+
+#include <ModuleBase_WidgetMultiSelector.h>
+
+class ModuleBase_IWorkshop;
+class QWidget;
+
+/*!
+ * \ingroup GUI
+ * Represent a property panel's list of ModuleBase_ModelWidgets.
+ */
+class SketchShapePlugin_WidgetMultiSelector : public ModuleBase_WidgetMultiSelector
+{
+ //Q_OBJECT
+public:
+ /// Constructs a multi selector widget, which can not be highlighted itself,
+ /// the parent SketchShapePlugin_GroupBox is highlighted instead of it
+ SketchShapePlugin_WidgetMultiSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
+ const Config_WidgetAPI* theData,
+ const std::string& theParentId);
+ /// Destructs the page
+ virtual ~SketchShapePlugin_WidgetMultiSelector() {}
+
+ //! Switch On/Off highlighting of the widget
+ //! Set highlight to the parent group box if there is such parent
+ virtual void setHighlighted(bool isHighlighted);
+};
+
+#endif /* SKETCHSHAPEPLUGIN_PAGEGROUPBOX_H_ */
<validator id="PartSet_SketchEntityValidator" parameters="Sketch"/>
</shape_selector>
<sketchshape_groupbox title="Direction">
- <boolvalue id="VertexChoice" label="VERTICES" default="true" tooltip="Vertices selection on sketch"/>
- <sketch_multi_selector id="VertexList"
- label=""
- tooltip="Select list of vertices"
- type_choice="Vertices Edges Faces"
- use_external="false"
- use_choice="false">
- <validator id="SketchShapePlugin_FeatureValidator" />
- </sketch_multi_selector>
-
- <boolvalue id="EdgeChoice" label="EDGES" default="true" tooltip="Edges selection on sketch"/>
- <sketch_multi_selector id="EdgeList"
- label=""
- tooltip="Select list of edges"
- type_choice="Vertices Edges Faces"
- use_external="false"
- use_choice="false">
- <validator id="SketchShapePlugin_FeatureValidator" />
- </sketch_multi_selector>
-
- <boolvalue id="FaceChoice" label="FACES" default="true" tooltip="Faces selection on sketch"/>
- <sketch_multi_selector id="FaceList"
- label=""
- tooltip="Select list of faces"
- type_choice="Vertices Edges Faces"
- use_external="false"
- use_choice="false">
- <validator id="SketchShapePlugin_FeatureValidator" />
- </sketch_multi_selector>
+ <sketchshape_check_groupbox id="VertexChoice" title="VERTICES" default="true" tooltip="Vertices selection on sketch">
+ <sketchshape_multi_selector id="VertexList"
+ label=""
+ tooltip="Select list of vertices"
+ type_choice="Vertices Edges Faces"
+ use_external="false"
+ use_choice="false">
+ <validator id="SketchShapePlugin_FeatureValidator" />
+ </sketchshape_multi_selector>
+ </sketchshape_check_groupbox>
+ <sketchshape_check_groupbox id="EdgeChoice" title="EDGES" default="true" tooltip="Edges selection on sketch">
+ <sketchshape_multi_selector id="EdgeList"
+ label=""
+ tooltip="Select list of edges"
+ type_choice="Vertices Edges Faces"
+ use_external="false"
+ use_choice="false">
+ <validator id="SketchShapePlugin_FeatureValidator" />
+ </sketchshape_multi_selector>
+ </sketchshape_check_groupbox>
+ <sketchshape_check_groupbox id="FaceChoice" title="FACES" default="true" tooltip="Faces selection on sketch">
+ <sketchshape_multi_selector id="FaceList"
+ label=""
+ tooltip="Select list of faces"
+ type_choice="Vertices Edges Faces"
+ use_external="false"
+ use_choice="false">
+ <validator id="SketchShapePlugin_FeatureValidator" />
+ </sketchshape_multi_selector>
+ </sketchshape_check_groupbox>
</sketchshape_groupbox>
</feature>
</group>