X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetValidated.h;h=8c05cbb046a64055f2bf67cee0ec5aa0d22c5c2b;hb=4229e8db7828717e6a2525de807d937b7921d9a9;hp=90a83677ead697466b913709069bcf38e764feb3;hpb=8e13a6fd505815aba8d7f64d10a5626817698e61;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.h b/src/ModuleBase/ModuleBase_WidgetValidated.h index 90a83677e..8c05cbb04 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.h +++ b/src/ModuleBase/ModuleBase_WidgetValidated.h @@ -18,6 +18,7 @@ class QWidget; class ModuleBase_IWorkshop; +class ModuleBase_ISelection; class Config_WidgetAPI; class Handle_SelectMgr_EntityOwner; @@ -41,39 +42,51 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg /// Checks all widget validator if the owner is valid /// \param theOwner a selected owner in the view /// \return a boolean value - bool isValid(const Handle_SelectMgr_EntityOwner& theOwner); + bool isValidSelection(const ModuleBase_ViewerPrs& theValue); + + /// Set the given wrapped value to the current widget + /// This value should be processed in the widget according to the needs + /// The method is called by the current operation to process the operation preselection. + /// It is redefined to check the value validity and if it is, fill the attribute with by value + /// \param theValue the wrapped widget value + virtual bool setSelection(ModuleBase_ViewerPrs theValue); protected: /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different /// parameters of the current attribute - /// \param isBackup a boolean flag, if true, store values from the attribute - /// to backup, otherwise set the backed up values to the attribute - virtual void backupAttributeValue(const bool isBackup) = 0; + virtual void storeAttributeValue() = 0; + + /// Creates a backup of the current values of the attribute + /// It should be realized in the specific widget because of different + /// parameters of the current attribute + /// \param theValid a boolean flag, if restore happens for valid parameters + virtual void restoreAttributeValue(const bool theValid) = 0; /// Fills the attribute with the value of the selected owner /// \param theOwner a selected owner - virtual void setSelection(const Handle_SelectMgr_EntityOwner& theOwner) = 0; + virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs) = 0; + + virtual void removePresentations() {}; /// Checks the current attibute in all attribute validators // \return true if all validators return that the attribute is valid bool isValidAttribute() const; - /// Check the selected with validators if installed - /// \param theObj the object for checking - /// \param theShape the shape for checking - virtual bool isValid(ObjectPtr theObj, GeomShapePtr theShape) const; - /// It obtains selection filters from the workshop and activates them in the active viewer /// \param theWorkshop an active workshop /// \param toActivate a flag about activation or deactivation the filters virtual void activateFilters(ModuleBase_IWorkshop* theWorkshop, const bool toActivate) const; - /// Fills the given list with all widget filters. - /// \param theWorkshop an active workshop - /// \param theFilters a list of filters - void selectionFilters(ModuleBase_IWorkshop* theWorkshop, - SelectMgr_ListOfFilter& theFilters) const; + /// Returns a list of selected presentations. Firstly it is obtained from the viewer, + /// if there are not selected objects in the viewer, it get the selection from the object browser. + /// If the browser has selected objects, the viewer prs objects are created with only object + /// field of the presentation initialized. The widget should accept the selection in the object + /// browser at the same way as in the viewer. + /// \param theSelection a selection, where the selected objects and presentations are found + /// \return a list of presentations + QList getSelectedEntitiesOrObjects(ModuleBase_ISelection* theSelection) const; + }; #endif /* MODULEBASE_WIDGETVALIDATED_H_ */