SHAPER  9.12.0
ModuleBase_WidgetSelector.h
1 // Copyright (C) 2014-2023 CEA, EDF
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 email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef ModuleBase_WidgetSelector_H
21 #define ModuleBase_WidgetSelector_H
22 
23 #include "ModuleBase.h"
24 #include "ModuleBase_WidgetValidated.h"
25 #include "ModuleBase_Definitions.h"
26 
27 #include <ModelAPI_Object.h>
28 #include <ModelAPI_Attribute.h>
29 #include <GeomAPI_Shape.h>
30 
31 class Config_WidgetAPI;
32 class QWidget;
35 class ModelAPI_Result;
36 
42 class MODULEBASE_EXPORT ModuleBase_WidgetSelector : public ModuleBase_WidgetValidated
43 {
44 Q_OBJECT
45  public:
46 
52  const Config_WidgetAPI* theData);
53 
54  virtual ~ModuleBase_WidgetSelector();
55 
59  virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
60 
62  virtual bool isViewerSelector() { return true; }
63 
65  virtual void updateSelectionModesAndFilters(bool toActivate);
66 
70  virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
71 
74  virtual bool setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
75 
77  virtual void deactivate();
78 
82  virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getAttributeSelection() const;
83 
84  virtual bool isWholeResultAllowed() const;
85 
86 protected:
88  virtual bool processSelection();
89 
92  virtual void updateOnSelectionChanged(const bool theDone);
93 
95  // NDS: has body is temporary
96  virtual void updateFocus() {};
97 
100  QIntList getShapeTypes() const;
101 
104  virtual QIntList shapeTypes() const = 0;
105 
107  // NDS: has body is temporary
108  virtual void updateSelectionName() {};
109 
111  virtual void activateCustom();
112 
119  bool acceptSubShape(const GeomShapePtr& theShape,
120  const std::shared_ptr<ModelAPI_Result>& theResult) const;
121 
126  virtual void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
127  ObjectPtr& theObject,
128  GeomShapePtr& theShape);
129 
130 protected:
131  bool myIsPointsFiltering;
132 };
133 
134 #endif
Provides low-level API for WidgetFactory for reading xml definitions of widgets.
Definition: Config_WidgetAPI.h:46
The result of a feature.
Definition: ModelAPI_Result.h:35
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes)
Fills given container with selection modes if the widget has it.
Definition: ModuleBase_ModelWidget.cpp:116
virtual void activateCustom()
The method called when widget is activated.
Definition: ModuleBase_ModelWidget.h:410
virtual bool processSelection()
Returns true if envent is processed. It applyes workshop selection for the widget attribute.
Definition: ModuleBase_ModelWidget.cpp:515
Presentation.
Definition: ModuleBase_ViewerPrs.h:37
Implementation of widget for selection.
Definition: ModuleBase_WidgetSelector.h:43
virtual QIntList shapeTypes() const =0
Retunrs a list of possible shape types.
virtual bool isViewerSelector()
Defines if it is supposed that the widget should interact with the viewer.
Definition: ModuleBase_WidgetSelector.h:62
virtual void updateFocus()
Update focus after the attribute value change.
Definition: ModuleBase_WidgetSelector.h:96
virtual void updateSelectionName()
Computes and updates name of selected object in the widget.
Definition: ModuleBase_WidgetSelector.h:108
Implementation of widget with validators and filters processing.
Definition: ModuleBase_WidgetValidated.h:54
virtual bool isValidSelectionCustom(const std::shared_ptr< ModuleBase_ViewerPrs > &thePrs)
Checks the widget validity.
Definition: ModuleBase_WidgetValidated.cpp:313
virtual bool setSelectionCustom(const std::shared_ptr< ModuleBase_ViewerPrs > &thePrs)=0
Fills the attribute with the value of the selected owner.
virtual void deactivate()
The method called when widget is deactivated.
Definition: ModuleBase_WidgetValidated.cpp:69