Salome HOME
Merge branch 'V9_9_BR'
[modules/shaper.git] / src / PartSet / PartSet_WidgetPoint2DFlyout.h
1 // Copyright (C) 2014-2022  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 email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef PartSet_WidgetPoint2DFlyout_H
21 #define PartSet_WidgetPoint2DFlyout_H
22
23 #include "PartSet.h"
24 #include <PartSet_WidgetPoint2d.h>
25
26 class XGUI_Workshop;
27
28 /**\class PartSet_WidgetPoint2DFlyout
29  * \ingroup Modules
30  * \brief Implementation of usual point 2d widget with a condition that it can not accept the focus
31  * when the AIS presentation is not visualized in the viewer.
32  */
33 class PARTSET_EXPORT PartSet_WidgetPoint2DFlyout : public PartSet_WidgetPoint2D
34 {
35   Q_OBJECT
36 public:
37   /// Constructor
38   /// \param theParent the parent object
39   /// \param theWorkshop a current workshop
40   /// \param theData the widget configuation. The attribute of the model widget is obtained from
41   PartSet_WidgetPoint2DFlyout(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
42                               const Config_WidgetAPI* theData);
43   /// Destructor
44   virtual ~PartSet_WidgetPoint2DFlyout() {};
45
46   /// Set the given wrapped value to the current widget
47   /// This value should be processed in the widget according to the needs
48   /// \param theValues the wrapped widget values
49   /// \param theToValidate a validation flag
50   virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
51                             const bool theToValidate);
52
53   /// Checks if the selection presentation is valid in widget
54   /// \param theValue a selected presentation in the view
55   /// \return a boolean value
56   virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
57
58   /// Activates the editor control only in case if the mouse over the OCC window, otherwise
59   /// set focus to the usual double value control
60   /// \return the state whether the widget can accept the focus
61   virtual bool focusTo();
62
63   /// Returns true if the attribute can be changed using the selected shapes in the viewer
64   /// and creating a coincidence constraint to them. This control does not use them.
65   virtual bool useSelectedShapes() const;
66
67 private:
68   //! Returns workshop
69   XGUI_Workshop* workshop() const;
70 };
71
72 #endif