Salome HOME
updated copyright message
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetSelectionFilter.h
index 45b6ec6b64147275e2a62b720c1eacb8bc650614..3303fce0ea699bc0e33e484e6f253f35212619c2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -24,7 +24,7 @@
 #include "ModuleBase_ModelWidget.h"
 #include "ModuleBase_ViewerPrs.h"
 
-#include <ModelAPI_Filter.h>
+#include <ModelAPI_FiltersFeature.h>
 
 #include <SelectMgr_IndexedMapOfOwner.hxx>
 #include <AIS_Shape.hxx>
@@ -41,6 +41,8 @@ class QVBoxLayout;
 class QPushButton;
 class QCheckBox;
 
+class ModelAPI_Filter;
+
 class ModuleBase_IWorkshop;
 
 /**
@@ -94,10 +96,6 @@ public:
   /// Returns filter Id
   std::string filter() const { return myFilterID; }
 
-  /// Returns list of widget controls
-  /// \return a control list
-  QList<QWidget*> getControls() const;
-
   /// Returns list of widgets which reperesent the current filter GUI
   QList<ModuleBase_ModelWidget*> widgets() const {
     return myWidgets;
@@ -143,13 +141,16 @@ class ModuleBase_WidgetSelectionFilter : public ModuleBase_ModelWidget
 {
   Q_OBJECT
 public:
+  static FeaturePtr SelectorFeature;
+  static std::string AttributeId;
+
 
   /// Constructor
   /// \param theParent the parent object
   /// \param theData the widget configuration. The attribute of the model widget is obtained from
   /// a low-level API for reading xml definitions of widgets
   ModuleBase_WidgetSelectionFilter(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
-    const Config_WidgetAPI* theData);
+    const Config_WidgetAPI* theData, bool theReadOnly = false);
 
   /// Destructor
   ~ModuleBase_WidgetSelectionFilter();
@@ -183,9 +184,6 @@ private slots:
   /// Add a filter by Id in combo box
   void onAddFilter(int);
 
-  /// Add a filter by name
-  void onAddFilter(const std::string& theFilter);
-
   /// Process deletion of a filter item
   void onDeleteItem(ModuleBase_FilterItem* theItem);
 
@@ -218,6 +216,18 @@ private:
   /// Call to redisplay the fiter feature
   void redisplayFeature();
 
+  /// Add a filter by name
+  ModuleBase_FilterItem* onAddFilter(const std::string& theFilter);
+
+  /// Return currently created filter items
+  QList<ModuleBase_FilterItem*> itemsList() const;
+
+  /// Translate a string
+  QString translate(const std::string& theString) const;
+
+  /// Store translated names of filters and their instances
+  void storeFilters(const std::list<std::shared_ptr<ModelAPI_Filter> >& theFilters);
+
 private:
   ModuleBase_IWorkshop* myWorkshop;
 
@@ -232,12 +242,6 @@ private:
   /// Type of selection mode
   int mySelectionType;
 
-  /// List of non-used filters
-  std::list<std::string> myFilters;
-
-  /// List of used filters
-  std::list<std::string> myUseFilters;
-
   /// Result of filtering
   QList<ModuleBase_ViewerPrsPtr> myValues;
 
@@ -252,6 +256,9 @@ private:
 
   /// Attribute name which will get result of filtering
   std::string mySelectorAttribute;
+
+  /// Translated name and the corresponding filter
+  std::map<std::string, std::shared_ptr<ModelAPI_Filter> > myFilters;
 };