Salome HOME
Issue #219 Clear selected list if selection type changed
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetMultiSelector.h
index d631f35ef09a3c9c2e43bfa0ed401e4231b7885e..a456a10dc30f68e4cca4dcea030596e6160fecdf 100644 (file)
 #include <ModuleBase.h>
 #include <ModuleBase_ModelWidget.h>
 
+#include <GeomAPI_Shape.h>
+#include <ModelAPI_Result.h>
+
+#include <NCollection_List.hxx>
+#include <TopoDS_Shape.hxx>
+
 #include <QList>
 #include <QString>
 #include <QStringList>
+#include <QPair>
 
 class QWidget;
-class QTextEdit;
+class QListWidget;
+class QComboBox;
+class ModuleBase_IWorkshop;
 
 class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_ModelWidget
 {
   Q_OBJECT
  public:
   ModuleBase_WidgetMultiSelector(QWidget* theParent,
-                                const Config_WidgetAPI* theData,
-                                const std::string& theParentId);
+                                 ModuleBase_IWorkshop* theWorkshop,
+                                 const Config_WidgetAPI* theData,
+                                 const std::string& theParentId);
   virtual ~ModuleBase_WidgetMultiSelector();
 
   /// Saves the internal parameters to the given feature
@@ -41,11 +51,34 @@ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_Model
   /// \return a control list
   virtual QList<QWidget*> getControls() const;
 
- //public slots:
+  virtual bool eventFilter(QObject* theObj, QEvent* theEvent);
+
+ public slots:
+  void activateSelection(bool toActivate);
+  void onSelectionTypeChanged();
+  void onSelectionChanged();
+
+ protected:
+  void filterShapes(const NCollection_List<TopoDS_Shape>& theShapesToFilter,
+                    NCollection_List<TopoDS_Shape>& theResult);
+  void setCurrentShapeType(const TopAbs_ShapeEnum theShapeType);
 
  private:
-  QTextEdit* myListControl;
+   void updateSelectionList();
+
+  QListWidget* myListControl;
+  QComboBox* myTypeCombo;
   QWidget* myMainWidget;
+
+  //TODO: Move into the base of selectors
+  ModuleBase_IWorkshop* myWorkshop;
+
+  /// If true then local selector has to be activated in context
+  bool myUseSubShapes;
+  bool myIsActive;
+
+  typedef QPair<ResultPtr, GeomShapePtr> GeomSelection;
+  QList<GeomSelection> mySelection;
 };
 
 #endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */