#include "ModuleBase.h"
-#include <list>
+#include <set>
#include <string>
class ModuleBase_ModelWidget;
/// Returns a list of possible widget types, which this creator can process
/// \param theTypes
- virtual void widgetTypes(std::list<std::string>& theTypes) = 0;
+ virtual const std::set<std::string>& widgetTypes() = 0;
/// Create widget by its type
/// \param theType a type
SketchShapePlugin_Plugin.h
SketchShapePlugin_Validators.h
SketchShapePlugin_Tools.h
+ SketchShapePlugin_WidgetCreator.h
)
SET(PROJECT_SOURCES
SketchShapePlugin_Plugin.cpp
SketchShapePlugin_Validators.cpp
SketchShapePlugin_Tools.cpp
+ SketchShapePlugin_WidgetCreator.cpp
)
SET(PROJECT_LIBRARIES
plugin-SketchShape.xml
)
-ADD_DEFINITIONS(-DSKETCHSHAPEPLUGIN_EXPORTS)
+ADD_DEFINITIONS(-DSKETCHSHAPEPLUGIN_EXPORTS -DWNT)
ADD_LIBRARY(SketchShapePlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES})
TARGET_LINK_LIBRARIES(SketchShapePlugin ${PROJECT_LIBRARIES})
// Created: 25 Nov 2015
// Author: Natalia ERMOLAEVA
-//#include <SketchShapePlugin_PageGroupBox.h>
+#include <SketchShapePlugin_PageGroupBox.h>
-//#include <QGridLayout>
-
-/*SketchShapePlugin_PageGroupBox::SketchShapePlugin_PageGroupBox(QWidget* theParent)
+SketchShapePlugin_PageGroupBox::SketchShapePlugin_PageGroupBox(QWidget* theParent)
: ModuleBase_PageGroupBox(theParent)
{
setTitle("SketchShapePlugin_PageGroupBox");
-}*/
+}
* \ingroup GUI
* Represent a property panel's list of ModuleBase_ModelWidgets.
*/
-class SketchShapePlugin_PageGroupBox// : public ModuleBase_PageGroupBox
+class SketchShapePlugin_PageGroupBox : public ModuleBase_PageGroupBox
{
//Q_OBJECT
- public:
+public:
/// Constructs a page that looks like a QGroupBox
- SketchShapePlugin_PageGroupBox(QWidget* theParent = 0) {};
+ SketchShapePlugin_PageGroupBox(QWidget* theParent = 0);
/// Destructs the page
- virtual ~SketchShapePlugin_PageGroupBox() {};
+ virtual ~SketchShapePlugin_PageGroupBox() {}
};
#endif /* SKETCHSHAPEPLUGIN_PAGEGROUPBOX_H_ */
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#include "SketchShapePlugin_WidgetCreator.h"
+#include "SketchShapePlugin_PageGroupBox.h"
+
+SketchShapePlugin_WidgetCreator::SketchShapePlugin_WidgetCreator()
+: ModuleBase_IWidgetCreator()
+{
+ myTypes.insert("sketchshape_groupbox");
+}
+
+const std::set<std::string>& SketchShapePlugin_WidgetCreator::widgetTypes()
+{
+ return myTypes;
+}
+
+ModuleBase_ModelWidget* SketchShapePlugin_WidgetCreator::createWidgetByType(
+ const std::string& theType, QWidget* theParent)
+{
+ ModuleBase_ModelWidget* aWidget = 0;
+ if (myTypes.find(theType) != myTypes.end())
+ return aWidget;
+
+ if (theType == "sketchshape_groupbox") {
+ //aWidget =
+ new SketchShapePlugin_PageGroupBox(theParent);
+ }
+
+ return aWidget;
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef SketchShapePlugin_WidgetCreator_H
+#define SketchShapePlugin_WidgetCreator_H
+
+#include <ModuleBase_IWidgetCreator.h>
+
+#include <string>
+#include <set>
+
+class ModuleBase_ModelWidget;
+class QWidget;
+
+/**
+* \ingroup GUI
+* Interface to WidgetCreator which can create specific widgets by type
+*/
+class SketchShapePlugin_WidgetCreator : public ModuleBase_IWidgetCreator
+{
+public:
+ /// Default constructor
+ SketchShapePlugin_WidgetCreator();
+
+ /// Virtual destructor
+ ~SketchShapePlugin_WidgetCreator() {}
+
+ /// Returns a list of possible widget types, which this creator can process
+ /// \return theTypes
+ virtual const std::set<std::string>& widgetTypes();
+
+ /// 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);
+
+private:
+ std::set<std::string> myTypes; /// types of widgets
+};
+
+
+#endif
<feature id="SketchShape" title="Sketch vertices, edges and faces" tooltip="Construct vertices, edges and faces by sketch" icon=":icons/sketchshape.png">
<sketchshape_groupbox title="Direction">
<boolvalue id="VertexChoice" label="VERTICES" default="true" tooltip="Vertices selection on sketch"/>
-
- <sketch_multi_selector id="VertexList"
+ <sketch_multi_selector id="VertexList"
label=""
tooltip="Select list of mirroring objects"
type_choice="Vertices"
use_external="false"
use_choice="false">
- <validator id="SketchShapePlugin_FeatureValidator" />
- </sketch_multi_selector>
+ <validator id="SketchShapePlugin_FeatureValidator" />
+ </sketch_multi_selector>
</sketchshape_groupbox>
</feature>
</group>