Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetPoint2D.h
1 // File:        ModuleBase_WidgetPoint2D.h
2 // Created:     25 Apr 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef ModuleBase_WidgetPoint2D_H
6 #define ModuleBase_WidgetPoint2D_H
7
8 #include <ModuleBase.h>
9 #include "ModuleBase_ModelWidget.h"
10
11 #include <QObject>
12
13 class ModelAPI_Feature;
14
15 class QGroupBox;
16 class QDoubleSpinBox;
17
18 /**\class ModuleBase_WidgetPoint2D
19  * \ingroup GUI
20  * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls
21  */
22 class MODULEBASE_EXPORT ModuleBase_WidgetPoint2D : public ModuleBase_ModelWidget
23 {
24   Q_OBJECT
25 public:
26   /// Constructor
27   /// \theParent the parent object
28   /// \theParent the parent object
29   /// \theData the widget configuation. The attribute of the model widget is obtained from
30   ModuleBase_WidgetPoint2D(QWidget* theParent, const Config_WidgetAPI* theData);
31   /// Destructor
32   virtual ~ModuleBase_WidgetPoint2D();
33
34   /// Saves the internal parameters to the given feature
35   /// \param theFeature a model feature to be changed
36   virtual bool storeValue(FeaturePtr theFeature) const;
37
38   virtual bool restoreValue(FeaturePtr theFeature);
39
40   /// Returns the internal parent wiget control, that can be shown anywhere
41   /// \returns the widget
42   QWidget* getControl() const;
43
44   /// Returns list of widget controls
45   /// \return a control list
46   virtual QList<QWidget*> getControls() const;
47
48   /// Process key release envent on the widget spin box controls
49   /// \param theObject the object where the event happens
50   /// \param theEvent the processed event
51   virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
52
53 private:
54   QGroupBox* myGroupBox; ///< the parent group box for all intenal widgets
55   QDoubleSpinBox* myXSpin; ///< the spin box for the X coordinate
56   QDoubleSpinBox* myYSpin; ///< the spin box for the Y coordinate
57 };
58
59 #endif