1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_WidgetValidator.h
4 // Created: 12 Mar 2015
5 // Author: Natalia ERMOLAEVA
8 #ifndef ModuleBase_WidgetValidator_H_
9 #define ModuleBase_WidgetValidator_H_
11 #include <ModuleBase.h>
15 class ModuleBase_ModelWidget;
16 class ModuleBase_IWorkshop;
17 class ModuleBase_ViewerPrs;
21 * Implementation of widget with validators and filters processing.
23 class MODULEBASE_EXPORT ModuleBase_WidgetValidator
27 /// \param theModelWidget the model widget to be validated
28 /// \param theWorkshop the current workshop
29 ModuleBase_WidgetValidator(ModuleBase_ModelWidget* theModelWidget,
30 ModuleBase_IWorkshop* theWorkshop);
31 virtual ~ModuleBase_WidgetValidator();
33 /// Checks all widget validator if the owner is valid. Firstly it checks custom widget validating,
34 /// next, the attribute's validating. It trying on the give selection to current attribute by
35 /// setting the value inside and calling validators. After this, the previous attribute value is
36 /// restored.The valid/invalid value is cashed.
37 /// \param theValue a selected presentation in the view
38 /// \return a boolean value
39 virtual bool isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
41 /// It obtains selection filters from the workshop and activates them in the active viewer
42 /// \param toActivate a flag about activation or deactivation the filters
43 /// \return true if the selection filter of the widget is activated in viewer context
44 bool activateFilters(const bool toActivate);
47 /// Returns true if the workshop validator filter has been already activated
48 /// \return boolean value
49 bool isFilterActivated() const;
52 /// Reference to workshop
53 ModuleBase_ModelWidget* myModelWidget; ///< the current widget to be validated
54 ModuleBase_IWorkshop* myWorkshop; ///< the active workshop
57 #endif /* ModuleBase_WidgetValidator_H_ */