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