Salome HOME
Merge branch 'python_parametric_api' of https://git.salome-platform.org/git/modules...
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetIntValue.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_WidgetIntValue.h
4 // Created:     04 June 2014
5 // Author:      Vitaly Smetannikov
6
7 #ifndef ModuleBase_WidgetIntValue_H
8 #define ModuleBase_WidgetIntValue_H
9
10 #include "ModuleBase.h"
11 #include "ModuleBase_ModelWidget.h"
12
13 class Config_WidgetAPI;
14 class QWidget;
15 class QLabel;
16 class QTimer;
17 class QSpinBox;
18
19 /**
20 * \ingroup GUI
21 * A class of property panel widget for double value input
22 * It can be defined with "doublevalue" keyword. For example:
23 * \code
24 * <doublevalue id="x" label="X:" icon=":pictures/x_point.png" tooltip="X coordinate"/>
25 * \endcode
26 */
27 class MODULEBASE_EXPORT ModuleBase_WidgetIntValue : public ModuleBase_ModelWidget
28 {
29 Q_OBJECT
30  public:
31   /// Constructor
32   /// \param theParent the parent object
33   /// \param theData the widget configuation. The attribute of the model widget is obtained from
34   /// \param theParentId is Id of a parent structure (widget, operation, group)
35   ModuleBase_WidgetIntValue(QWidget* theParent, const Config_WidgetAPI* theData,
36                                const std::string& theParentId);
37
38   virtual ~ModuleBase_WidgetIntValue();
39
40   /// Returns list of widget controls
41   /// \return a control list
42   virtual QList<QWidget*> getControls() const;
43
44 protected:
45   /// Saves the internal parameters to the given feature
46   /// \return True in success
47   virtual bool storeValueCustom() const;
48
49   //! Read value of corresponded attribute from data model to the input control
50   // \return True in success
51   virtual bool restoreValueCustom();
52
53   /// Fills the widget with default values
54   /// \return true if the widget current value is reset
55   virtual bool resetCustom();
56
57 protected:
58   /// Label of the widget
59   QLabel* myLabel;
60
61   /// Input value control
62   QSpinBox* mySpinBox;
63 };
64
65 #endif