]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_WidgetMultiSelector.h
Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / PartSet / PartSet_WidgetMultiSelector.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef PartSet_WidgetMultiSelector_H
22 #define PartSet_WidgetMultiSelector_H
23
24 #include "PartSet.h"
25
26 #include <ModuleBase_WidgetMultiSelector.h>
27
28 #include <ModelAPI_CompositeFeature.h>
29
30 class PartSet_ExternalObjectsMgr;
31 class ModuleBase_ViewerPrs;
32
33 /**
34 * \ingroup Modules
35 * Customosation of ModuleBase_WidgetMultiSelector in order to provide 
36 * working with sketch specific objects and creation of external objects.
37 */
38 class PARTSET_EXPORT PartSet_WidgetMultiSelector: public ModuleBase_WidgetMultiSelector
39 {
40 Q_OBJECT
41  public:
42   /// Constructor
43   /// \param theParent the parent object
44   /// \param theWorkshop instance of workshop interface
45   /// \param theData the widget configuation. The attribute of the model widget is obtained from
46   PartSet_WidgetMultiSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
47                               const Config_WidgetAPI* theData);
48
49   virtual ~PartSet_WidgetMultiSelector();
50
51   /// Defines if it is supposed that the widget should interact with the viewer.
52   virtual bool isViewerSelector() { return true; }
53
54   /// Set sketcher
55   /// \param theSketch a sketcher object
56   void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
57
58   /// Retrurns installed sketcher
59   CompositeFeaturePtr sketch() const { return mySketch; }
60
61 protected:
62   /// Checks the widget validity. By default, it returns true.
63   /// \param thePrs a selected presentation in the view
64   /// \return a boolean value
65   virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
66
67   /// Creates a backup of the current values of the attribute
68   /// It should be realized in the specific widget because of different
69   /// parameters of the current attribute
70   /// \param theAttribute an attribute
71   /// \param theValid a boolean flag, if restore happens for valid parameters
72   virtual void restoreAttributeValue(const AttributePtr& theAttribute, const bool theValid);
73
74   /// Return an object and geom shape by the viewer presentation
75   /// \param thePrs a selection
76   /// \param theObject an output object
77   /// \param theShape a shape of the selection
78   virtual void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
79                                 ObjectPtr& theObject,
80                                 GeomShapePtr& theShape);
81
82 protected:
83   /// Manager of external objects
84   PartSet_ExternalObjectsMgr* myExternalObjectMgr;
85
86   /// Pointer to a sketch
87   CompositeFeaturePtr mySketch;
88 };
89
90 #endif