]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModuleBase/ModuleBase_WidgetValidated.h
Salome HOME
Multi-selection widget to be used in the extrusion feature.
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetValidated.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_WidgetValidated.h
4 // Created:     12 Mar 2015
5 // Author:      Natalia ERMOLAEVA
6
7
8 #ifndef MODULEBASE_WIDGETVALIDATED_H_
9 #define MODULEBASE_WIDGETVALIDATED_H_
10
11 #include <ModuleBase.h>
12 #include <ModuleBase_ModelWidget.h>
13
14 #include <GeomAPI_Shape.h>
15 #include <ModelAPI_Object.h>
16
17 #include <SelectMgr_ListOfFilter.hxx>
18
19 class QWidget;
20 class ModuleBase_IWorkshop;
21 class Config_WidgetAPI;
22
23 /**
24 * \ingroup GUI
25 * Implementation of widget with validators and filters processing.
26 */
27 class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidget
28 {
29   Q_OBJECT
30  public:
31   /// Constructor
32   /// \param theParent the parent object
33   /// \param theData the widget configuation. The attribute of the model widget is obtained from
34   /// \param theParentId is Id of a parent of the current attribute
35   ModuleBase_WidgetValidated(QWidget* theParent,
36                              const Config_WidgetAPI* theData,
37                              const std::string& theParentId);
38   virtual ~ModuleBase_WidgetValidated();
39
40 protected:
41   /// Check the selected with validators if installed
42   /// \param theObj the object for checking
43   /// \param theShape the shape for checking
44   virtual bool isValid(ObjectPtr theObj, GeomShapePtr theShape) const;
45
46   /// It obtains selection filters from the workshop and activates them in the active viewer
47   /// \param theWorkshop an active workshop
48   /// \param toActivate a flag about activation or deactivation the filters
49   virtual void activateFilters(ModuleBase_IWorkshop* theWorkshop, const bool toActivate) const;
50
51   /// Fills the given list with all widget filters.
52   /// \param theWorkshop an active workshop
53   /// \param theFilters a list of filters
54   void selectionFilters(ModuleBase_IWorkshop* theWorkshop,
55                         SelectMgr_ListOfFilter& theFilters) const;
56 };
57
58 #endif /* MODULEBASE_WIDGETVALIDATED_H_ */