Salome HOME
SketchShapePlugin: checked group box/multi editor controls, which highlight the paren...
[modules/shaper.git] / src / SketchShapePlugin / SketchShapePlugin_WidgetCreator.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #include "SketchShapePlugin_WidgetCreator.h"
4
5 #include "SketchShapePlugin_PageGroupBox.h"
6
7 #include "SketchShapePlugin_WidgetMultiSelector.h"
8 #include "SketchShapePlugin_WidgetCheckGroupBox.h"
9
10 SketchShapePlugin_WidgetCreator::SketchShapePlugin_WidgetCreator()
11 : ModuleBase_IWidgetCreator()
12 {
13   myPages.insert("sketchshape_groupbox");
14   myPages.insert("sketchshape_check_groupbox");
15
16   myWidgets.insert("sketchshape_multi_selector");
17 }
18
19 const std::set<std::string>& SketchShapePlugin_WidgetCreator::pageTypes()
20 {
21   return myPages;
22 }
23
24 const std::set<std::string>& SketchShapePlugin_WidgetCreator::widgetTypes()
25 {
26   return myWidgets;
27 }
28
29 ModuleBase_PageBase* SketchShapePlugin_WidgetCreator::createPageByType(
30                                    const std::string& theType, QWidget* theParent,
31                                    Config_WidgetAPI* theWidgetApi, std::string theParentId)
32 {
33   ModuleBase_PageBase* aPage = 0;
34   if (myPages.find(theType) == myPages.end())
35     return aPage;
36
37   if (theType == "sketchshape_groupbox") {
38     aPage = new SketchShapePlugin_PageGroupBox(theParent);
39   }
40   else if (theType == "sketchshape_check_groupbox") {
41     aPage = new SketchShapePlugin_WidgetCheckGroupBox(theParent, theWidgetApi, theParentId);
42   }
43
44   return aPage;
45 }
46
47 ModuleBase_ModelWidget* SketchShapePlugin_WidgetCreator::createWidgetByType(
48                                    const std::string& theType, QWidget* theParent,
49                                    Config_WidgetAPI* theWidgetApi, std::string theParentId,
50                                    ModuleBase_IWorkshop* theWorkshop)
51 {
52   ModuleBase_ModelWidget* aWidget = 0;
53   if (myWidgets.find(theType) == myWidgets.end())
54     return aWidget;
55
56   if (theType == "sketchshape_multi_selector") {
57     aWidget = new SketchShapePlugin_WidgetMultiSelector(theParent, theWorkshop, theWidgetApi,
58                                                         theParentId);
59   }
60
61   return aWidget;
62 }