Salome HOME
150f4c6fd784aba9fab7af1be443179270af9d60
[modules/shaper.git] / src / PartSet / PartSet_WidgetMultiSelector.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_WidgetMultiSelector.h
4 // Created:     15 Apr 2015
5 // Author:      Natalia Ermolaeva
6
7
8 #ifndef PartSet_WidgetMultiSelector_H
9 #define PartSet_WidgetMultiSelector_H
10
11 #include "PartSet.h"
12
13 #include <ModuleBase_WidgetMultiSelector.h>
14 #include <ModuleBase_ViewerPrs.h>
15
16 #include <ModelAPI_CompositeFeature.h>
17
18 class PartSet_ExternalObjectsMgr;
19
20 /**
21 * \ingroup Modules
22 * Customosation of ModuleBase_WidgetMultiSelector in order to provide 
23 * working with sketch specific objects and creation of external objects.
24 */
25 class PARTSET_EXPORT PartSet_WidgetMultiSelector: public ModuleBase_WidgetMultiSelector
26 {
27 Q_OBJECT
28  public:
29   /// Constructor
30   /// \param theParent the parent object
31   /// \param theWorkshop instance of workshop interface
32   /// \param theData the widget configuation. The attribute of the model widget is obtained from
33   PartSet_WidgetMultiSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
34                               const Config_WidgetAPI* theData);
35
36   virtual ~PartSet_WidgetMultiSelector();
37
38   /// Defines if it is supposed that the widget should interact with the viewer.
39   virtual bool isViewerSelector() { return true; }
40
41   /// Set sketcher
42   /// \param theSketch a sketcher object
43   void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
44
45   /// Retrurns installed sketcher
46   CompositeFeaturePtr sketch() const { return mySketch; }
47
48 protected:
49   /// Checks the widget validity. By default, it returns true.
50   /// \param thePrs a selected presentation in the view
51   /// \return a boolean value
52   virtual bool isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
53
54   /// Creates a backup of the current values of the attribute
55   /// It should be realized in the specific widget because of different
56   /// parameters of the current attribute
57   /// \param theValid a boolean flag, if restore happens for valid parameters
58   virtual void restoreAttributeValue(const AttributePtr& theAttribute, const bool theValid);
59
60   /// Return an object and geom shape by the viewer presentation
61   /// \param thePrs a selection
62   /// \param theObject an output object
63   /// \param theShape a shape of the selection
64   virtual void getGeomSelection(const ModuleBase_ViewerPrs& thePrs,
65                                 ObjectPtr& theObject,
66                                 GeomShapePtr& theShape);
67
68 protected:
69   /// Manager of external objects
70   PartSet_ExternalObjectsMgr* myExternalObjectMgr;
71
72   /// Pointer to a sketch 
73   CompositeFeaturePtr mySketch;
74 };
75
76 #endif