1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 * ModuleBase_WidgetMultiSelector.h
6 * Created on: Oct 8, 2014
10 #ifndef MODULEBASE_WIDGETMULTISELECTOR_H_
11 #define MODULEBASE_WIDGETMULTISELECTOR_H_
13 #include <ModuleBase.h>
14 #include <ModuleBase_ModelWidget.h>
16 #include <GeomAPI_Shape.h>
17 #include <ModelAPI_Result.h>
18 #include <ModelAPI_AttributeSelectionList.h>
20 #include <NCollection_List.hxx>
21 #include <TopoDS_Shape.hxx>
25 #include <QStringList>
31 class ModuleBase_IWorkshop;
34 class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_ModelWidget
38 ModuleBase_WidgetMultiSelector(QWidget* theParent,
39 ModuleBase_IWorkshop* theWorkshop,
40 const Config_WidgetAPI* theData,
41 const std::string& theParentId);
42 virtual ~ModuleBase_WidgetMultiSelector();
44 /// Saves the internal parameters to the given feature
45 /// \param theObject a model feature to be changed
46 virtual bool storeValue() const;
48 virtual bool restoreValue();
50 /// Returns the internal parent wiget control, that can be shown anywhere
51 /// \returns the widget
52 QWidget* getControl() const;
54 /// Returns list of widget controls
55 /// \return a control list
56 virtual QList<QWidget*> getControls() const;
58 virtual bool eventFilter(QObject* theObj, QEvent* theEvent);
61 void activateSelection(bool toActivate);
62 void onSelectionTypeChanged();
63 void onSelectionChanged();
67 void onListSelection();
70 void filterShapes(const NCollection_List<TopoDS_Shape>& theShapesToFilter,
71 NCollection_List<TopoDS_Shape>& theResult);
72 void setCurrentShapeType(const TopAbs_ShapeEnum theShapeType);
73 void activateShapeSelection();
76 void updateSelectionList(AttributeSelectionListPtr);
78 QListWidget* myListControl;
79 QComboBox* myTypeCombo;
80 QWidget* myMainWidget;
82 //TODO: Move into the base of selectors
83 ModuleBase_IWorkshop* myWorkshop;
85 /// If true then local selector has to be activated in context
88 typedef QPair<ResultPtr, GeomShapePtr> GeomSelection;
89 QList<GeomSelection> mySelection;
91 QAction* myCopyAction;
94 #endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */